roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r937919 - /roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
Date Mon, 26 Apr 2010 02:57:00 GMT
Author: snoopdave
Date: Mon Apr 26 02:57:00 2010
New Revision: 937919

URL: http://svn.apache.org/viewvc?rev=937919&view=rev
Log:
Ensure that new entries are valid when created

Modified:
    roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java

Modified: roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=937919&r1=937918&r2=937919&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
(original)
+++ roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
Mon Apr 26 02:57:00 2010
@@ -286,6 +286,23 @@ public class JPAWeblogEntryManagerImpl i
      */
     // TODO: perhaps the createAnchor() and queuePings() items should go outside this method?
     public void saveWeblogEntry(WeblogEntry entry) throws WebloggerException {
+
+        if (entry.getCategory() == null) {
+
+            // Entry is invalid without category, so use weblog client cat
+            WeblogCategory cat = entry.getWebsite().getBloggerCategory();
+            if (cat == null) {
+                // Sill no category, so use first one found
+                cat = (WeblogCategory)
+                    entry.getWebsite().getWeblogCategories().iterator().next();
+            }
+            entry.setCategory(cat);
+        }
+
+        // Entry is invalid without local. if missing use weblog default
+        if (entry.getLocale() == null) {
+            entry.setLocale(entry.getWebsite().getLocale());
+        }
         
         if (entry.getAnchor() == null || entry.getAnchor().trim().equals("")) {
             entry.setAnchor(this.createAnchor(entry));



Mime
View raw message