roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli...@apache.org
Subject svn commit: r448786 - in /incubator/roller/trunk: src/org/apache/roller/business/hibernate/ src/org/apache/roller/business/search/operations/ src/org/apache/roller/model/ src/org/apache/roller/pojos/ src/org/apache/roller/ui/authoring/struts/actions/ s...
Date Fri, 22 Sep 2006 03:17:27 GMT
Author: eliast
Date: Thu Sep 21 20:17:26 2006
New Revision: 448786

URL: http://svn.apache.org/viewvc?view=rev&rev=448786
Log:
Refactored WeblogManager method for getWeblogEntries method to support tags
- Updated all classes that used the method to include tagging information
  (NOTE: most of the cases, tags was set to NULL, but as we add support for tags, all we have
to do is pass the desired tag list)
- Updated all Cache key generation to include tagging
- Removed WeblogEntriesTagPager and was able to reuse existing pagers to leverage all URL
parameters

Removed:
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java
Modified:
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerPlanetManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java
    incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryManagementAction.java
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/BigWeblogCalendarModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/WeblogCalendarModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/FeedModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesLatestPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesListPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
    incubator/roller/trunk/src/org/apache/roller/util/cache/FuturePostingsInvalidationJob.java
    incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
    incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
    incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java
    incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerPlanetManagerImpl.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerPlanetManagerImpl.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerPlanetManagerImpl.java
Thu Sep 21 20:17:26 2006
@@ -117,6 +117,7 @@
                             null,                        // startDate
                             new Date(),                  // endDate
                             null,                        // catName
+                            null,                        // tags
                             WeblogEntryData.PUBLISHED,   // status
                             null,                        // sortby (null means pubTime)
                             null,                        // locale

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
Thu Sep 21 20:17:26 2006
@@ -402,6 +402,7 @@
             Date        startDate,
             Date        endDate,
             String      catName,
+            List        tags,
             String      status,
             String      sortby,
             String      locale,
@@ -416,57 +417,79 @@
         if (catName != null && catName.trim().equals("/")) {
             catName = null;
         }
-        
+                
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
-            Criteria criteria = session.createCriteria(WeblogEntryData.class);
             
+            ArrayList params = new ArrayList();
+            StringBuffer queryString = new StringBuffer();
+            queryString.append("select distinct e from WeblogEntryData e where ");
+
             if (website != null) {
-                criteria.add(Expression.eq("website", website));
+                queryString.append("website.id = ? ");                
+                params.add(website.getId());
             } else {
-                criteria.createAlias("website","w");
-                criteria.add(Expression.eq("w.enabled", Boolean.TRUE));
+                queryString.append("website.enabled = ? ");                
+                params.add(Boolean.TRUE);                
             }
             
             if (user != null) {
-                criteria.add(Expression.eq("creator", user));
+                queryString.append("and creator.id = ? ");
+                params.add(user.getId());
             }
 
             if (startDate != null) {
-                criteria.add(
-                        Expression.ge("pubTime", startDate));
+                queryString.append("and pubTime >= ? ");
+                params.add(startDate);
             }
             
             if (endDate != null) {
-                criteria.add(
-                        Expression.le("pubTime", endDate));
+                queryString.append("and pubTime <= ? ");
+                params.add(endDate);                
             }
             
             if (cat != null && website != null) {
-                criteria.add(Expression.eq("category", cat));
+                queryString.append("and category.id = ? ");
+                params.add(cat.getId());                
+            }
+            
+            if (tags != null && tags.size() > 0) {
+              for(int i = 0; i < tags.size(); i++) {
+                queryString.append(" and tagSet.name = ?");
+                params.add(tags.get(i));
+              }
             }
             
             if (status != null) {
-                criteria.add(Expression.eq("status", status));
+                queryString.append("and status = ? ");
+                params.add(status);
             }
             
             if (locale != null) {
-                criteria.add(Expression.ilike("locale", locale, MatchMode.START));
+                queryString.append("lower(locale) like ? ");
+                params.add("%" + locale.toLowerCase());
             }
             
             if (sortby != null && sortby.equals("updateTime")) {
-                criteria.addOrder(Order.desc("updateTime"));
+                queryString.append("order by updateTime desc ");
             } else {
-                criteria.addOrder(Order.desc("pubTime"));
+                queryString.append("order by pubTime desc ");
             }
             
+            Query query = session.createQuery(queryString.toString());
+            
+            // set params
+            for(int i = 0; i < params.size(); i++) {
+              query.setParameter(i, params.get(i));
+            }
+                        
             if (offset != 0) {
-                criteria.setFirstResult(offset);
+                query.setFirstResult(offset);
             }
             if (length != -1) {
-                criteria.setMaxResults(length);
+                query.setMaxResults(length);
             }
-            return criteria.list();
+            return query.list();
             
         } catch (HibernateException e) {
             log.error(e);
@@ -791,37 +814,7 @@
             throw new RollerException(e);
         }
     }
-        
-    public List getWeblogEntriesByTags(WebsiteData website, List tags) throws RollerException
{
-      try {
-               
-        if(tags == null || tags.size() == 0)
-          return Collections.EMPTY_LIST;
-        
-        Session session = ((HibernatePersistenceStrategy) strategy).getSession();
-        
-        StringBuffer queryString = new StringBuffer();
-        queryString.append("select distinct e ");
-        queryString.append("from WeblogEntryData e ");
-        queryString.append("where ");
-        queryString.append(" e.tagSet.name = ?");
-        for(int i = 1; tags.size() > 1 && i < tags.size(); i++)
-          queryString.append(" and e.tagSet.name = ?");
-        if(website != null)
-          queryString.append("and t.website.id = '" + website.getId() + "' ");
-        queryString.append("order by e.tagSet.time desc");
-
-        Query query = session.createQuery(queryString.toString());
-        for(int i = 0; i < tags.size(); i++)
-          query.setString(i, (String) tags.get(i));
-              
-        return query.list();
-        
-      } catch (HibernateException e) {
-        throw new RollerException(e);
-      }
-    }
-    
+            
     public List getTags(Date startDate,
         Date endDate,
         WebsiteData website,
@@ -1029,6 +1022,7 @@
             Date    startDate,
             Date    endDate,
             String  catName,
+            List    tags,            
             String  status,
             String  locale,
             int     offset,
@@ -1038,6 +1032,7 @@
             startDate,
             endDate,
             catName,
+            tags,
             status,
             false,
             locale,
@@ -1050,6 +1045,7 @@
             Date    startDate,
             Date    endDate,
             String  catName,
+            List    tags,            
             String  status,
             String  locale,
             int     offset,
@@ -1060,6 +1056,7 @@
             startDate,
             endDate,
             catName,
+            tags,
             status,
             true,
             locale,
@@ -1073,6 +1070,7 @@
             Date    startDate,
             Date    endDate,
             String  catName,
+            List    tags,
             String  status,
             boolean stringsOnly,
             String  locale,
@@ -1088,6 +1086,7 @@
             startDate,
             endDate,
             catName,
+            tags,
             status,
             null,
 locale,             offset,

Modified: incubator/roller/trunk/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java
Thu Sep 21 20:17:26 2006
@@ -108,6 +108,7 @@
                         null,                      // startDate
                         new Date(),                // endDate (don't index 'future' entries)
                         null,                      // catName
+                        null,
                         WeblogEntryData.PUBLISHED, // status
                         null,                      // sortby (null means pubTime)
 null,                         0, -1);     // offset, length, locale

Modified: incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java Thu Sep 21 20:17:26
2006
@@ -79,6 +79,7 @@
             Date        startDate,
             Date        endDate,
             String      catName,
+            List        tags,
             String      status,
             String      sortBy,
             String      locale,             
@@ -105,6 +106,7 @@
             Date        startDate,
             Date        endDate,
             String      catName,
+            List        tags,            
             String      status,
             String      locale,
             int         offset,
@@ -130,6 +132,7 @@
             Date        startDate,
             Date        endDate,
             String      catName,
+            List        tags,            
             String      status,
             String      locale,
             int         offset,
@@ -301,17 +304,7 @@
      * Get all ancestor associates for a category.
      */
     public List getWeblogCategoryAncestorAssocs(WeblogCategoryData data) throws RollerException;
-    
-    /**
-     * Get all entries in a website that contain a specific tag
-     * @param website
-     * @param tag
-     * @return
-     * @throws RollerException
-     */
-    public List getWeblogEntriesByTags(WebsiteData website, List tags) throws RollerException;
-    
-    
+        
     /**
      * Get all tag (name, count) pairs for a specific date range, optionally only for a given
site or user.
      * @param startDate

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java Thu Sep 21 20:17:26
2006
@@ -1206,6 +1206,7 @@
                     null,       // startDate
                     new Date(), // endDate
                     cat,        // cat or null
+                    null, 
                     WeblogEntryData.PUBLISHED, 
                     "pubTime",  // sortby
                     null, 

Modified: incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryManagementAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryManagementAction.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryManagementAction.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryManagementAction.java
Thu Sep 21 20:17:26 2006
@@ -153,6 +153,7 @@
                     startDate,
                     endDate,
                     category,
+                    null,
                     status,
                     queryForm.getSortby(),
 null,                     queryForm.getOffset(),

Modified: incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
Thu Sep 21 20:17:26 2006
@@ -137,6 +137,7 @@
                 null,              // startDate
                 null,              // endDate
                 null,              // catName
+                null,              // tags
                 WeblogEntryData.PUBLISHED, // status
                 null,              // sortby (null for pubTime)
 null,                 0, 20);   
@@ -158,6 +159,7 @@
                 null,              // startDate
                 null,              // endDate
                 null,              // catName
+                null,              // tags
                 WeblogEntryData.DRAFT, // status
                 "updateTime",      // sortby 
 null,                 0, 20);  // maxEntries
@@ -179,6 +181,7 @@
                 null,              // startDate
                 null,              // endDate
                 null,              // catName
+                null,              // tags
                 WeblogEntryData.PENDING, // status
                 "updateTime",      // sortby
 null,                 0, 20);  

Modified: incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/BigWeblogCalendarModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/BigWeblogCalendarModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/BigWeblogCalendarModel.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/BigWeblogCalendarModel.java
Thu Sep 21 20:17:26 2006
@@ -61,6 +61,7 @@
                     startDate,                 // startDate
                     endDate,                   // endDate
                     catName,                   // cat
+                    null,                      // tags
                     WeblogEntryData.PUBLISHED, // status
                     locale,
                     0, -1);

Modified: incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/WeblogCalendarModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/WeblogCalendarModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/WeblogCalendarModel.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/core/tags/calendar/WeblogCalendarModel.java
Thu Sep 21 20:17:26 2006
@@ -122,6 +122,7 @@
                     startDate,                 // startDate
                     endDate,                   // endDate
                     catName,                   // cat
+                    null,                      // tags
                     WeblogEntryData.PUBLISHED, // status
                     locale,
                     0, -1);

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/FeedModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/FeedModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/FeedModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/FeedModel.java Thu Sep
21 20:17:26 2006
@@ -131,6 +131,7 @@
                     null, 
                     new Date(), 
                     feedRequest.getWeblogCategoryName(), 
+                    null, 
                     WeblogEntryData.PUBLISHED, 
                     "pubTime", 
                     feedRequest.getLocale(), 

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java Thu Sep
21 20:17:26 2006
@@ -47,8 +47,8 @@
 import org.apache.roller.ui.rendering.pagers.Pager;
 import org.apache.roller.ui.rendering.pagers.UsersPager;
 import org.apache.roller.ui.rendering.pagers.WeblogEntriesListPager;
-import org.apache.roller.ui.rendering.pagers.WeblogEntriesTagsPager;
 import org.apache.roller.ui.rendering.pagers.WeblogsPager;
+import org.apache.roller.ui.rendering.util.WeblogFeedRequest;
 import org.apache.roller.ui.rendering.util.WeblogPageRequest;
 import org.apache.roller.ui.rendering.util.WeblogRequest;
 import org.apache.roller.util.URLUtilities;
@@ -85,6 +85,8 @@
             pageLink = (weblogPage != null) ? weblogPage.getLink() : null;
             pageNum = ((WeblogPageRequest)weblogRequest).getPageNum();
             tags = ((WeblogPageRequest)weblogRequest).getTags();
+        } else if (weblogRequest instanceof WeblogFeedRequest) {
+            tags = ((WeblogFeedRequest)weblogRequest).getTags();
         }
         
         // extract weblog object
@@ -104,17 +106,9 @@
                 weblogRequest.getLocale(), pageLink, 
                 null, null, null, null, 0, false);
         
-        if(tags.size() > 0) {
-          return new WeblogEntriesTagsPager(
-              pagerUrl, null, null, tags,
-              weblogRequest.getLocale(),
-              sinceDays,
-              pageNum, 
-              length);        
-        }        
-        
         return new WeblogEntriesListPager(
             pagerUrl, null, null, null,
+            tags,
             weblogRequest.getLocale(),
             sinceDays,
             pageNum, 
@@ -159,17 +153,10 @@
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
                 null, null, null, null, 0, false);
-        
-        if(tags.size() > 0) {
-          return new WeblogEntriesTagsPager(
-              pagerUrl, queryWeblog, user, tags,
-              weblogRequest.getLocale(),
-              sinceDays,
-              pageNum, 
-              length);        
-        }
+       
         return new WeblogEntriesListPager(
             pagerUrl, queryWeblog, user, cat,
+            tags,
             weblogRequest.getLocale(),
             sinceDays,
             pageNum, 

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
Thu Sep 21 20:17:26 2006
@@ -115,6 +115,7 @@
                         startDate,
                         endDate,
                         catPath,
+                        tags,
                         WeblogEntryData.PUBLISHED, 
                         locale,
                         offset,  

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesLatestPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesLatestPager.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesLatestPager.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesLatestPager.java
Thu Sep 21 20:17:26 2006
@@ -80,6 +80,7 @@
                         null,
                         new Date(),
                         catPath,
+                        tags,
                         WeblogEntryData.PUBLISHED,
                         locale,
                         offset,

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesListPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesListPager.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesListPager.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesListPager.java
Thu Sep 21 20:17:26 2006
@@ -50,6 +50,7 @@
     private WebsiteData queryWeblog = null;
     private UserData queryUser = null;
     private String queryCat = null;
+    private List queryTags = null;
     
     // entries for the pager
     private List entries;
@@ -63,6 +64,7 @@
             WebsiteData    queryWeblog,
             UserData       queryUser,
             String         queryCat,
+            List           queryTags,
             String         locale,
             int            sinceDays,
             int            pageNum,
@@ -74,6 +76,7 @@
         this.queryWeblog = queryWeblog;
         this.queryUser = queryUser;
         this.queryCat = queryCat;
+        this.queryTags = queryTags;
         this.locale = locale;
         this.sinceDays = sinceDays;
         this.length = length;
@@ -104,6 +107,7 @@
                         startDate,
                         new Date(),
                         queryCat,
+                        queryTags,
                         WeblogEntryData.PUBLISHED,
                         "pubTime",
                         locale,

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
Thu Sep 21 20:17:26 2006
@@ -110,6 +110,7 @@
                         startDate,
                         endDate,
                         catPath,
+                        tags,
                         WeblogEntryData.PUBLISHED, 
                         locale,
                         offset,  

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/SiteWideCache.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/SiteWideCache.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/SiteWideCache.java Thu
Sep 21 20:17:26 2006
@@ -25,6 +25,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.TreeSet;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.config.RollerConfig;
@@ -174,7 +176,7 @@
      *
      * <handle>/<ctx>[/anchor][/language][/user]
      *   or
-     * <handle>/<ctx>[/weblogPage][/date][/category][/language][/user]
+     * <handle>/<ctx>[/weblogPage][/date][/category][/tags][/language][/user]
      *
      *
      * examples ...
@@ -224,6 +226,12 @@
                 
                 key.append("/").append(cat);
             }
+            
+            if(pageRequest.getTags() != null && pageRequest.getTags().size() >
0) {
+              String[] tags = new String[pageRequest.getTags().size()];
+              new TreeSet(pageRequest.getTags()).toArray(tags);
+              key.append("/tags/").append(Utilities.stringArrayToString(tags,"+"));
+            }
         }
         
         if(pageRequest.getLocale() != null) {
@@ -293,6 +301,12 @@
         if(feedRequest.isExcerpts()) {
             key.append("/excerpts");
         }
+        
+        if(feedRequest.getTags() != null && feedRequest.getTags().size() > 0)
{
+          String[] tags = new String[feedRequest.getTags().size()];
+          new TreeSet(feedRequest.getTags()).toArray(tags);
+          key.append("/tags/").append(Utilities.stringArrayToString(tags,"+"));
+        }       
         
         return key.toString();
     }

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java Thu
Sep 21 20:17:26 2006
@@ -23,6 +23,8 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.TreeSet;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.config.RollerConfig;
@@ -173,6 +175,11 @@
             
             key.append("/").append(cat);
         }
+        
+        if(feedRequest.getTags() != null && feedRequest.getTags().size() > 0)
{
+          String[] tags = (String[])new TreeSet(feedRequest.getTags()).toArray();
+          key.append("/tags/").append(Utilities.stringArrayToString(tags,"+"));
+        }        
         
         if(feedRequest.getLocale() != null) {
             key.append("/").append(feedRequest.getLocale());

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogFeedRequest.java
Thu Sep 21 20:17:26 2006
@@ -18,7 +18,12 @@
 
 package org.apache.roller.ui.rendering.util;
 
+import java.util.Arrays;
+import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
@@ -46,6 +51,7 @@
     private String type = null;
     private String format = null;
     private String weblogCategoryName = null;
+    private List   tags = null;
     private boolean excerpts = false;
     
     // heavyweight attributes
@@ -122,6 +128,10 @@
             }
         }
         
+        if(request.getParameter("tags") != null) {
+          this.tags = Arrays.asList(StringUtils.split(URLUtilities.decode(request.getParameter("tags")),"+"));
+        }        
+        
         if(request.getParameter("excerpts") != null) {
             this.excerpts = Boolean.valueOf(request.getParameter("excerpts")).booleanValue();
         }
@@ -156,6 +166,14 @@
 
     public void setWeblogCategoryName(String weblogCategory) {
         this.weblogCategoryName = weblogCategory;
+    }
+    
+    public List getTags() {
+      return tags;
+    }
+
+    public void setTags(List tags) {
+      this.tags = tags;
     }
 
     public boolean isExcerpts() {

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java Thu
Sep 21 20:17:26 2006
@@ -24,6 +24,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.TreeSet;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.config.RollerConfig;
@@ -197,6 +199,11 @@
                 
                 key.append("/").append(cat);
             }
+            
+            if(pageRequest.getTags() != null && pageRequest.getTags().size() >
0) {
+              String[] tags = (String[])new TreeSet(pageRequest.getTags()).toArray();
+              key.append("/tags/").append(Utilities.stringArrayToString(tags,"+"));
+            }            
         }
         
         if(pageRequest.getLocale() != null) {

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldWeblogPageModel.java
Thu Sep 21 20:17:26 2006
@@ -379,6 +379,7 @@
                     startDate,                    // startDate
                     endDate,                      // endDate
                     catParam,                     // catName
+                    null,                         // tags
                     WeblogEntryData.PUBLISHED,    // status
                     mLocale, 0, limit);  
             
@@ -481,6 +482,7 @@
                     null,                        // startDate
                     day,                         // endDate
                     catParam,                    // catName
+                    null,                        // tags
                     WeblogEntryData.PUBLISHED,   // status
                     null,                        // sortby (null for pubTime)
                     mLocale, 0, mWebsite.getEntryDisplayCount());    

Modified: incubator/roller/trunk/src/org/apache/roller/util/cache/FuturePostingsInvalidationJob.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/util/cache/FuturePostingsInvalidationJob.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/util/cache/FuturePostingsInvalidationJob.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/util/cache/FuturePostingsInvalidationJob.java
Thu Sep 21 20:17:26 2006
@@ -114,7 +114,7 @@
             
             // get all published entries between start and end date
             List expiringEntries = wMgr.getWeblogEntries(null, null, now, end, null, 
-                    null, WeblogEntryData.PUBLISHED, null, 0, -1);
+                    null, null, WeblogEntryData.PUBLISHED, null, 0, -1);
             
             // we only really want the weblog ids
             Set expiringWeblogs = new HashSet();

Modified: incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
Thu Sep 21 20:17:26 2006
@@ -286,6 +286,7 @@
                         null,              // startDate
                         null,              // endDate
                         null,              // catName
+                        null,              // tags
                         null,              // status
                         "updateTime",      // sortby
                         null,              // locale

Modified: incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
Thu Sep 21 20:17:26 2006
@@ -463,6 +463,7 @@
                         null,                   // startDate
                         new Date(),             // endDate
                         null,                   // catName
+                        null,                   // tags
                         null, null, 0, -1);
                 
                 Iterator iter = entries.values().iterator();

Modified: incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java
Thu Sep 21 20:17:26 2006
@@ -413,6 +413,7 @@
                         null,              // startDate
                         null,              // endDate
                         null,              // catName
+                        null,              // tags
                         null,              // status
                         "updateTime",      // sortby
                         null,                     0, numposts);

Modified: incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java?view=diff&rev=448786&r1=448785&r2=448786
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java Thu Sep 21
20:17:26 2006
@@ -191,7 +191,7 @@
         
         // get all entries for weblog
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
0, -1);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
null, 0, -1);
         assertNotNull(entries);
         assertEquals(3, entries.size());
         assertEquals(entry3, entries.get(0));
@@ -204,39 +204,39 @@
         
         // get all published entries only 
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, WeblogEntryData.PUBLISHED,
null, null, 0, -1);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, WeblogEntryData.PUBLISHED,
null, null, 0, -1);
         assertNotNull(entries);
         assertEquals(2, entries.size());
         
         // get all entries in date range
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, entry2.getPubTime(), entry2.getPubTime(),
null, null, null, null, 0, -1);
+        entries = mgr.getWeblogEntries(testWeblog, null, entry2.getPubTime(), entry2.getPubTime(),
null, null, null, null, null, 0, -1);
         assertNotNull(entries);
         assertEquals(1, entries.size());
         assertEquals(entry2, entries.get(0));
         
         // get all entries, limited to maxSize
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
0, 2);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
null, 0, 2);
         assertNotNull(entries);
         assertEquals(2, entries.size());
         
         // get all entries in category
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, testWeblog.getDefaultCategory().getName(),
null, null, null, 0, -1);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, testWeblog.getDefaultCategory().getName(),
null, null, null, null, 0, -1);
         assertNotNull(entries);
         assertEquals(3, entries.size());
         
         // get all entries, limited by offset/range
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
1, 1);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
null, 1, 1);
         assertNotNull(entries);
         assertEquals(1, entries.size());
         assertEquals(entry2, entries.get(0));
         
         // get all entries, limited by locale
         entries = null;
-        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, "en_US",
0, -1);
+        entries = mgr.getWeblogEntries(testWeblog, null, null, null, null, null, null, null,
"en_US", 0, -1);
         assertNotNull(entries);
         assertEquals(1, entries.size());
         assertEquals(entry1, entries.get(0));
@@ -276,13 +276,13 @@
         
         // get object map
         entryMap = null;
-        entryMap = mgr.getWeblogEntryObjectMap(testWeblog, null, null, null, null, null,
0, -1);
+        entryMap = mgr.getWeblogEntryObjectMap(testWeblog, null, null, null, null, null,
null, 0, -1);
         assertNotNull(entryMap);
         assertTrue(entryMap.keySet().size() > 1);
         
         // get string map
         entryMap = null;
-        entryMap = mgr.getWeblogEntryStringMap(testWeblog, null, null, null, null, null,
0, -1);
+        entryMap = mgr.getWeblogEntryStringMap(testWeblog, null, null, null, null, null,
null, 0, -1);
         assertNotNull(entryMap);
         assertTrue(entryMap.keySet().size() > 1);
                 
@@ -551,11 +551,11 @@
       String id = entry.getId();
       TestUtils.endSession(true);
       
-      List results = mgr.getWeblogEntriesByTags(testWeblog, Arrays.asList(new String[] {"testTag"}));
+      List results = mgr.getWeblogEntries(testWeblog, null, null, null, null, Arrays.asList(new
String[] {"testTag"}), null, null, null, 0, -1);
       assertEquals(1,results.size());
       WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
       assertEquals(entry, testEntry);
-      
+
       // teardown our test entry
       TestUtils.teardownWeblogEntry(id);
       TestUtils.endSession(true);      
@@ -571,16 +571,17 @@
       String id = entry.getId();
       TestUtils.endSession(true);
       
-      List results = mgr.getWeblogEntriesByTags(testWeblog, Arrays.asList(new String[] {"testTag"}));
+      List results = mgr.getWeblogEntries(testWeblog, null, null, null, null, Arrays.asList(new
String[] {"testTag"}), null, null, null, 0, -1);
       assertEquals(1,results.size());
       WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
       assertEquals(entry, testEntry);
-      
+
       // teardown our test entry
       TestUtils.teardownWeblogEntry(id);
       TestUtils.endSession(true);      
 
-      results = mgr.getWeblogEntriesByTags(testWeblog, Arrays.asList(new String[] {"testTag"}));
+      
+      results = mgr.getWeblogEntries(testWeblog, null, null, null, null, Arrays.asList(new
String[] {"testTag"}), null, null, null, 0, -1);
       assertEquals(0,results.size());  
       
       // terminate



Mime
View raw message