roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r421716 - in /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util: WeblogCommentRequest.java WeblogFeedRequest.java WeblogPageRequest.java WeblogRequest.java WeblogSearchRequest.java WeblogTrackbackRequest.java
Date Thu, 13 Jul 2006 22:17:02 GMT
Author: agilliland
Date: Thu Jul 13 15:17:01 2006
New Revision: 421716

URL: http://svn.apache.org/viewvc?rev=421716&view=rev
Log:
second part of parsed request tweaks.  new methods that return pojos are actually filled out
now.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogCommentRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogTrackbackRequest.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogCommentRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogCommentRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogCommentRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogCommentRequest.java
Thu Jul 13 15:17:01 2006
@@ -23,6 +23,9 @@
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.WeblogEntryData;
 
 
@@ -196,6 +199,16 @@
     }
 
     public WeblogEntryData getWeblogEntry() {
+        
+        if(weblogEntry == null && weblogAnchor != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog entry "+weblogAnchor, ex);
+            }
+        }
+        
         return weblogEntry;
     }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
Thu Jul 13 15:17:01 2006
@@ -23,6 +23,9 @@
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.WeblogCategoryData;
 
 
@@ -114,6 +117,12 @@
             try {
                 this.weblogCategoryName = 
                         URLDecoder.decode(request.getParameter("cat"), "UTF-8");
+                
+                // all categories must start with a /
+                if(!this.weblogCategoryName.startsWith("/")) {
+                    this.weblogCategoryName = "/"+this.weblogCategoryName;
+                }
+
             } catch (UnsupportedEncodingException ex) {
                 // should never happen, utf-8 is always supported by java
             }
@@ -164,6 +173,16 @@
     }
 
     public WeblogCategoryData getWeblogCategory() {
+        
+        if(weblogCategory == null && weblogCategoryName != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog category "+weblogCategoryName, ex);
+            }
+        }
+        
         return weblogCategory;
     }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
Thu Jul 13 15:17:01 2006
@@ -24,11 +24,13 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.UserManager;
+import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.WeblogCategoryData;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WeblogTemplate;
-import org.apache.roller.pojos.WebsiteData;
-
 
 /**
  * Represents a request for a Roller weblog page.
@@ -108,7 +110,12 @@
                 pathElements = pathInfo.split("/", 2);
                 this.context = pathElements[0];
                 this.weblogCategoryName = "/"+pathElements[1];
-                    
+                
+                // all categories must start with a /
+                if(!this.weblogCategoryName.startsWith("/")) {
+                    this.weblogCategoryName = "/"+this.weblogCategoryName;
+                }
+
             } else if(pathElements.length == 2) {
                 
                 this.context = pathElements[0];
@@ -172,6 +179,12 @@
                 try {
                     this.weblogCategoryName = 
                             URLDecoder.decode(request.getParameter("cat"), "UTF-8");
+                    
+                    // all categories must start with a /
+                    if(!this.weblogCategoryName.startsWith("/")) {
+                        this.weblogCategoryName = "/"+this.weblogCategoryName;
+                    }
+                    
                 } catch (UnsupportedEncodingException ex) {
                     // should never happen
                     log.error(ex);
@@ -255,6 +268,16 @@
     }
 
     public WeblogEntryData getWeblogEntry() {
+        
+        if(weblogEntry == null && weblogAnchor != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog entry "+weblogAnchor, ex);
+            }
+        }
+        
         return weblogEntry;
     }
 
@@ -263,6 +286,16 @@
     }
 
     public WeblogTemplate getWeblogPage() {
+        
+        if(weblogPage == null && weblogPageName != null) {
+            try {
+                UserManager umgr = RollerFactory.getRoller().getUserManager();
+                weblogPage = umgr.getPageByLink(getWeblog(), weblogPageName);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog page "+weblogPageName, ex);
+            }
+        }
+        
         return weblogPage;
     }
 
@@ -271,6 +304,16 @@
     }
 
     public WeblogCategoryData getWeblogCategory() {
+        
+        if(weblogCategory == null && weblogCategoryName != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog category "+weblogCategoryName, ex);
+            }
+        }
+        
         return weblogCategory;
     }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java
Thu Jul 13 15:17:01 2006
@@ -21,6 +21,10 @@
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.UserManager;
 import org.apache.roller.pojos.WebsiteData;
 
 
@@ -168,6 +172,16 @@
     }
 
     public WebsiteData getWeblog() {
+        
+        if(weblog == null && weblogHandle != null) {
+            try {
+                UserManager umgr = RollerFactory.getRoller().getUserManager();
+                weblog = umgr.getWebsiteByHandle(weblogHandle, Boolean.TRUE);
+            } catch (RollerException ex) {
+                log.error("Error looking up weblog "+weblogHandle, ex);
+            }
+        }
+        
         return weblog;
     }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
Thu Jul 13 15:17:01 2006
@@ -19,6 +19,11 @@
 package org.apache.roller.ui.rendering.util;
 
 import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.WeblogCategoryData;
 
 
@@ -27,6 +32,8 @@
  */
 public class WeblogSearchRequest extends WeblogRequest {
     
+    private static Log log = LogFactory.getLog(WeblogSearchRequest.class);
+    
     private static final String SEARCH_SERVLET = "/roller-ui/rendering/search";
     
     // lightweight attributes
@@ -88,6 +95,11 @@
         
         if(request.getParameter("cat") != null) {
             this.weblogCategoryName = request.getParameter("cat");
+            
+            // all categories must start with a /
+            if(!this.weblogCategoryName.startsWith("/")) {
+                this.weblogCategoryName = "/"+this.weblogCategoryName;
+            }
         }
     }
 
@@ -116,6 +128,16 @@
     }
 
     public WeblogCategoryData getWeblogCategory() {
+        
+        if(weblogCategory == null && weblogCategoryName != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog category "+weblogCategoryName, ex);
+            }
+        }
+        
         return weblogCategory;
     }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogTrackbackRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogTrackbackRequest.java?rev=421716&r1=421715&r2=421716&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogTrackbackRequest.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogTrackbackRequest.java
Thu Jul 13 15:17:01 2006
@@ -23,6 +23,9 @@
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.WeblogEntryData;
 
 
@@ -189,6 +192,16 @@
     }
 
     public WeblogEntryData getWeblogEntry() {
+        
+        if(weblogEntry == null && weblogAnchor != null) {
+            try {
+                WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
+            } catch (RollerException ex) {
+                log.error("Error getting weblog entry "+weblogAnchor, ex);
+            }
+        }
+        
         return weblogEntry;
     }
 



Mime
View raw message