[jboss-svn-commits] JBL Code SVN: r5209 - labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 20 18:02:42 EDT 2006
Author: adamw
Date: 2006-07-20 18:02:41 -0400 (Thu, 20 Jul 2006)
New Revision: 5209
Modified:
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/TagFeed.java
Log:
Small fix
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/TagFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/TagFeed.java 2006-07-20 21:54:16 UTC (rev 5208)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/TagFeed.java 2006-07-20 22:02:41 UTC (rev 5209)
@@ -40,7 +40,7 @@
nameLength = name.length();
cm = ContentManager.getContentManager(attributes.get("id"),
attributes.get("prefix"));
-
+
try {
limit = Integer.parseInt(attributes.get("limit"));
} catch (NumberFormatException e) {
@@ -62,8 +62,33 @@
return tags.get(0).getDateCreated();
}
+ private FeedType getFeedType(String rep) throws IOException {
+ if (FeedType.AUTHOR_ALL.toString().equals(rep)) {
+ return FeedType.AUTHOR_ALL;
+ }
+
+ if (FeedType.RESOURCE.toString().equals(rep)) {
+ return FeedType.RESOURCE;
+ }
+
+ if (FeedType.AUTHOR_UNIQUE.toString().equals(rep)) {
+ return FeedType.AUTHOR_UNIQUE;
+ }
+
+ if (FeedType.AUTHOR_TAG.toString().equals(rep)) {
+ return FeedType.AUTHOR_TAG;
+ }
+
+ if (FeedType.TAGS.toString().equals(rep)) {
+ return FeedType.TAGS;
+ }
+
+ throw new IOException("Invalid tag feed request.");
+ }
+
public void write(OutputStream os, String fullName,
HttpServletRequest request) throws IOException {
+
// Computing the type of the feed to generate.
if (fullName.length() < nameLength+1) {
throw new IOException("Invalid tag feed request.");
@@ -84,14 +109,8 @@
List<Tag> tags;
TagService service = TagTools.getService();
- FeedType ft;
-
- try {
- ft = FeedType.valueOf(infoTokens[0]);
- } catch (IllegalArgumentException e) {
- throw new IOException("Invalid tag feed request.");
- }
-
+ FeedType ft = getFeedType(infoTokens[0]);
+
String[] feedCounterData = new String[] { infoDataDecoded };
try {
switch (ft) {
More information about the jboss-svn-commits
mailing list