roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r398380 - in /incubator/roller/trunk/src/org/roller/presentation/webservices: atomprotocol/RollerAtomHandler.java xmlrpc/MetaWeblogAPIHandler.java
Date Sun, 30 Apr 2006 16:59:09 GMT
Author: snoopdave
Date: Sun Apr 30 09:59:09 2006
New Revision: 398380

URL: http://svn.apache.org/viewcvs?rev=398380&view=rev
Log:
Use first *valid* cat for API posts

Modified:
    incubator/roller/trunk/src/org/roller/presentation/webservices/atomprotocol/RollerAtomHandler.java
    incubator/roller/trunk/src/org/roller/presentation/webservices/xmlrpc/MetaWeblogAPIHandler.java

Modified: incubator/roller/trunk/src/org/roller/presentation/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/webservices/atomprotocol/RollerAtomHandler.java?rev=398380&r1=398379&r2=398380&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/webservices/atomprotocol/RollerAtomHandler.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/webservices/atomprotocol/RollerAtomHandler.java
Sun Apr 30 09:59:09 2006
@@ -824,6 +824,7 @@
                 }
             }
         } else {
+            // or we fall back to the default Blogger API category
             rollerEntry.setCategory(website.getBloggerCategory());
         }
         return rollerEntry;

Modified: incubator/roller/trunk/src/org/roller/presentation/webservices/xmlrpc/MetaWeblogAPIHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/webservices/xmlrpc/MetaWeblogAPIHandler.java?rev=398380&r1=398379&r2=398380&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/webservices/xmlrpc/MetaWeblogAPIHandler.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/webservices/xmlrpc/MetaWeblogAPIHandler.java
Sun Apr 30 09:59:09 2006
@@ -219,18 +219,7 @@
         Date dateCreated = (Date)postcontent.get("dateCreated");
         if (dateCreated == null) dateCreated = (Date)postcontent.get("pubDate");
         if (dateCreated == null) dateCreated = new Date();
-        
-        String cat = null;
-        if ( postcontent.get("categories") != null ) {
-            Vector cats = (Vector)postcontent.get("categories");
-            if (cats.size() > 0) {
-                // only use the first category passed in
-                cat = (String)cats.elementAt(0);
-            }
-        }
         mLogger.debug("      Title: " + title);
-        mLogger.debug("   Category: " + cat);
-        
         
         try {
             Roller roller = RollerFactory.getRoller();
@@ -251,15 +240,25 @@
             } else {
                 entry.setStatus(WeblogEntryData.DRAFT);
             }
-            
-            
-            if ( cat != null ) {
-                // Use first category specified by request
-                WeblogCategoryData cd =
-                    weblogMgr.getWeblogCategoryByPath(website, cat);
-                entry.setCategory(cd);
-            } else {
-                // Use Blogger API category from user's weblog config
+                        
+            // MetaWeblog supports multiple cats, Roller supports one/entry
+            // so here we take accept the first category that exists
+            WeblogCategoryData rollerCat = null;
+            if ( postcontent.get("categories") != null ) {
+                Vector cats = (Vector)postcontent.get("categories");
+                if (cats != null && cats.size() > 0) {
+                    for (int i=0; i<cats.size(); i++) {
+                        String cat = (String)cats.get(i);
+                        rollerCat = weblogMgr.getWeblogCategoryByPath(website, cat);
+                        if (rollerCat != null) {
+                            entry.setCategory(rollerCat);
+                            break;
+                        }
+                    }
+                }
+            }
+            if (rollerCat == null) { 
+                // or we fall back to the default Blogger API category
                 entry.setCategory(website.getBloggerCategory());
             }
             



Mime
View raw message