roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli...@apache.org
Subject svn commit: r448460 [1/2] - in /incubator/roller/trunk: ./ metadata/database/ metadata/database/hibernate/ src/org/apache/roller/business/hibernate/ src/org/apache/roller/model/ src/org/apache/roller/pojos/ src/org/apache/roller/ui/authoring/struts/for...
Date Thu, 21 Sep 2006 05:01:58 GMT
Author: eliast
Date: Wed Sep 20 22:01:56 2006
New Revision: 448460

URL: http://svn.apache.org/viewvc?view=rev&rev=448460
Log:
Initial tagging support commit

- Added new tables (weblogentrytag, weblogentrytagagg)
- Added new POJOs (WeblogEntryTagData, TagCloudEntry)
- Added more tests to WeblogEntryTest
- Added new methods to WeblogManagers (for TagCloud and WeblogEntriesByTag)
- Added support for /tags/ in URL Structure/Refactored all URL code to support/pass-through tagging information
- Updated hibernate.cfg.xml to support new beans
- Modified/Enhanced frontpage template to support tag cloud, hot tags
- Modified WeblogEdit.jsp to allow for editing of tags in entries (as well as WeblogEntryFormEx)
- Updated the build.xml to include new bean in hibernate/wrapper targets
- Added a new WeblogEntriesTagsPager for SiteModel

Added:
    incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java   (with props)
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java   (with props)
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java   (with props)
    incubator/roller/trunk/web/themes/frontpage/tags.vm
Modified:
    incubator/roller/trunk/build.xml
    incubator/roller/trunk/metadata/database/createdb.vm
    incubator/roller/trunk/metadata/database/droptables.sql
    incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.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/WeblogRequestMapper.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PageModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PlanetModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SiteModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/URLModel.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.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/WeblogEntriesMonthPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java
    incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
    incubator/roller/trunk/src/org/apache/roller/util/URLUtilities.java
    incubator/roller/trunk/testdata/WEB-INF/classes/hibernate.cfg.xml
    incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
    incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
    incubator/roller/trunk/web/WEB-INF/jsps/authoring/WeblogEdit.jsp
    incubator/roller/trunk/web/themes/frontpage/Weblog.vm
    incubator/roller/trunk/web/themes/frontpage/_entry.vm
    incubator/roller/trunk/web/themes/frontpage/directory.vm

Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/build.xml?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Wed Sep 20 22:01:56 2006
@@ -154,7 +154,8 @@
             <include name="org/apache/roller/pojos/RefererData.java"/>
             <include name="org/apache/roller/pojos/Template.java"/>
             <include name="org/apache/roller/pojos/UserData.java"/>
-            <include name="org/apache/roller/pojos/WeblogEntryData.java"/>
+            <include name="org/apache/roller/pojos/WeblogEntryData.java"/>
+            <include name="org/apache/roller/pojos/WeblogEntryTagData.java"/>        	
             <include name="org/apache/roller/pojos/WeblogCategoryData.java"/>
             <include name="org/apache/roller/pojos/WebsiteData.java"/>
             <include name="org/apache/roller/pojos/PlanetEntryData.java"/>

Modified: incubator/roller/trunk/metadata/database/createdb.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/createdb.vm?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb.vm (original)
+++ incubator/roller/trunk/metadata/database/createdb.vm Wed Sep 20 22:01:56 2006
@@ -208,6 +208,30 @@
 create index we_status_idx on weblogentry(status);
 create index we_locale_idx on weblogentry(locale);
 
+create table weblogentrytag (
+    id              varchar(48)   not null primary key,
+    entryid         varchar(48)   not null,
+    websiteid       varchar(48)   not null,    
+    userid		    varchar(48)  not null,
+    name            varchar(255)  not null,
+    time         $TIMESTAMP_SQL_TYPE	not null
+);
+
+create index wet_entryid_idx on weblogentrytag( entryid );
+create index wet_websiteid_idx on weblogentrytag( websiteid );
+create index wet_userid_idx on weblogentrytag( userid );
+create index wet_name_idx on weblogentrytag( name );
+
+create table weblogentrytagagg (
+    id              varchar(48)   not null primary key,
+    websiteid       varchar(48)   not null,    
+    name            varchar(255)  not null,
+    count           integer		  not null
+);
+
+create index weta_websiteid_idx on weblogentrytagagg( websiteid );
+create index weta_name_idx on weblogentrytagagg( name );
+
 create table newsfeed (
     id              varchar(48) not null primary key,
     name            varchar(255) not null,

Modified: incubator/roller/trunk/metadata/database/droptables.sql
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/droptables.sql?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/metadata/database/droptables.sql (original)
+++ incubator/roller/trunk/metadata/database/droptables.sql Wed Sep 20 22:01:56 2006
@@ -25,6 +25,8 @@
 drop table roller_comment;
 drop table entryattribute;
 drop table weblogentry;
+drop table weblogentrytag;
+drop table weblogentrytagagg;
 drop table weblogcategory;
 drop table folder;
 drop table folderassoc;

Modified: incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml (original)
+++ incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml Wed Sep 20 22:01:56 2006
@@ -91,7 +91,8 @@
         <mapping resource="org/apache/roller/pojos/UserData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogCategoryData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogCategoryAssoc.hbm.xml" />
-        <mapping resource="org/apache/roller/pojos/WeblogEntryData.hbm.xml" />
+        <mapping resource="org/apache/roller/pojos/WeblogEntryData.hbm.xml" />
+        <mapping resource="org/apache/roller/pojos/WeblogEntryTagData.hbm.xml" />        
         <mapping resource="org/apache/roller/pojos/WebsiteData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/RollerPropertyData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/PermissionsData.hbm.xml" />

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=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java Wed Sep 20 22:01:56 2006
@@ -21,6 +21,7 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.Hashtable;
@@ -29,8 +30,9 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
+
 import org.apache.commons.collections.comparators.ReverseComparator;
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
@@ -41,18 +43,19 @@
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.pojos.RefererData;
 import org.apache.roller.pojos.StatCount;
+import org.apache.roller.pojos.TagCloudEntry;
 import org.apache.roller.pojos.UserData;
 import org.apache.roller.pojos.WeblogCategoryAssoc;
 import org.apache.roller.pojos.WeblogCategoryData;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.util.DateUtil;
-import org.apache.commons.lang.StringUtils;
 import org.apache.roller.util.Utilities;
 import org.hibernate.Criteria;
 import org.hibernate.HibernateException;
 import org.hibernate.Query;
 import org.hibernate.Session;
+import org.hibernate.criterion.CriteriaSpecification;
 import org.hibernate.criterion.Expression;
 import org.hibernate.criterion.Junction;
 import org.hibernate.criterion.MatchMode;
@@ -787,6 +790,80 @@
         } catch (HibernateException e) {
             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,
+        UserData user,
+        boolean sortByCount,
+        int limit) throws RollerException {
+      try {
+        List results = new ArrayList();
+        
+        Session session = ((HibernatePersistenceStrategy) strategy).getSession();
+        
+        StringBuffer queryString = new StringBuffer();
+        queryString.append("select t.name, count(t.name) ");
+        queryString.append("from WeblogEntryTagData t ");
+        queryString.append("where t.time between ? and ? ");
+        if(website != null)
+          queryString.append("and t.website.id = '" + website.getId() + "' ");
+        if(user != null)
+          queryString.append("and t.user.id = '" + user.getId() + "' ");
+        queryString.append("group by t.name ");
+        queryString.append(sortByCount ? "order by count(t.name) desc " : "order by t.name ");
+
+        Query query = session.createQuery(queryString.toString());
+        query.setTimestamp(0, DateUtil.getStartOfDay(startDate));
+        query.setTimestamp(1, DateUtil.getEndOfDay(endDate));
+        if(limit > 0)
+          query.setMaxResults(limit);
+        
+        for (Iterator iter = query.list().iterator(); iter.hasNext();) {
+          Object[] row = (Object[]) iter.next();
+          TagCloudEntry ce = new TagCloudEntry();
+          ce.setName((String) row[0]);
+          ce.setCount(((Integer)row[1]).intValue());
+          results.add(ce);
+        }
+        
+        return results;
+        
+      } catch (HibernateException e) {
+        throw new RollerException(e);
+      }
+
     }
     
     public List getComments(

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=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/model/WeblogManager.java Wed Sep 20 22:01:56 2006
@@ -303,6 +303,34 @@
     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
+     * @param endDate
+     * @param website
+     * @param user
+     * @param sortByCount
+     * @param limit
+     * @return
+     * @throws RollerException
+     */
+    public List getTags(Date startDate,
+        Date endDate,
+        WebsiteData website,
+        UserData user,
+        boolean sortByCount,
+        int limit) throws RollerException;
+        
+    /**
      * Save comment.
      */
     public void saveComment(CommentData comment) throws RollerException;

Added: incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java?view=auto&rev=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java Wed Sep 20 22:01:56 2006
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+/*
+ * Generated file - Do not edit!
+ */
+package org.apache.roller.pojos;
+
+
+/**
+ * Tag bean.
+ * 
+ * @author Elias Torres
+ * 
+ */
+public class TagCloudEntry implements java.io.Serializable {
+
+  private static final long serialVersionUID = 1142064841813545198L;
+
+  private java.lang.String name = null;
+
+  private int count = 0;
+
+  public TagCloudEntry() {
+  }
+
+  public String getName() {
+    return this.name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public int getCount() {
+    return this.count;
+  }
+
+  public void setCount(int count) {
+    this.count = count;
+  }
+
+  public String toString() {
+    StringBuffer str = new StringBuffer("{");
+
+    str.append("name=" + name + " " + "count=" + count);
+    str.append('}');
+
+    return (str.toString());
+  }
+
+}
\ No newline at end of file

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/TagCloudEntry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java Wed Sep 20 22:01:56 2006
@@ -28,6 +28,7 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -97,6 +98,8 @@
     private Map attMap = new HashMap();
     private Set attSet = new TreeSet();
     
+    private Set tagSet = new HashSet();
+    
     //----------------------------------------------------------- Construction
     
     public WeblogEntryData() {
@@ -597,7 +600,119 @@
         this.locale = locale;
     }
     
+    /** 
+     * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.WeblogEntryTagData"
+     *
+     * @ejb:persistent-field
+     * 
+     * @hibernate.set lazy="true" order-by="name" inverse="true" cascade="all-delete-orphan" 
+     * @hibernate.collection-key column="entryid" 
+     * @hibernate.collection-one-to-many class="org.apache.roller.pojos.WeblogEntryTagData"
+     */
+     public Set getTagSet()
+     {
+         return tagSet;
+     }
+     
+     private void setTagSet(Set tagSet) throws RollerException
+     {
+         this.tagSet = tagSet;
+     }    
+     
+     public void addTag(String name) {
+       WeblogEntryTagData tag = new WeblogEntryTagData();
+       tag.setName(stripInvalidTagChars(name));
+       tag.setUser(getCreator());
+       tag.setWebsite(getWebsite());
+       tag.setWeblogEntry(this);
+       tag.setTime(getUpdateTime());       
+       tagSet.add(tag);
+     }
+     
+     public void removeTag(String name) {
+       Iterator it = tagSet.iterator();
+       while(it.hasNext()) {
+         WeblogEntryTagData tag = (WeblogEntryTagData) it.next();
+         if(tag.getName().equals(name)) {
+           it.remove();
+         }
+       }
+     }
+   
+     public void updateTags(List tags) {
+       HashSet newTags = new HashSet(tags);
+              
+       // remove old ones no longer passed.
+       Iterator it = tagSet.iterator();
+       while(it.hasNext()) {
+         WeblogEntryTagData tag = (WeblogEntryTagData) it.next();
+         if(!newTags.contains(tag.getName())) {
+           it.remove();
+         } else {
+           newTags.remove(tag.getName());
+         }
+       }
+       
+       // add new ones, duplicates are taken care of by the db.
+       it = newTags.iterator();
+       while(it.hasNext()) {
+         addTag((String) it.next());
+       }
+    }
+   
+     public boolean checkValidTagChar(char c) {
+       return  c == 45 || c == 46 || c == 95 || 
+         (48 <= c && c <= 57) ||
+         (65 <= c && c <= 90) ||
+         (97 <= c && c <= 122) ||
+         Character.isUnicodeIdentifierPart(c) ||
+         Character.isUnicodeIdentifierStart(c);
+     }
+     
+     public String stripInvalidTagChars(String s) 
+     {
+       StringBuffer sb = new StringBuffer();
+       char [] charArray = s.toCharArray();
+       for(int i = 0; i < charArray.length; i++) 
+       {
+         if(checkValidTagChar(charArray[i]))
+           sb.append(charArray[i]);
+       }
+       return sb.toString();
+     }
+     
+     /**
+      *
+      * @roller.wrapPojoMethod type="simple"
+      */     
+    public String getTags() 
+    {
+       StringBuffer sb = new StringBuffer();
+       for(Iterator it = getTagSet().iterator(); it.hasNext();)
+       {
+           sb.append(((WeblogEntryTagData)it.next()).getName()).append(" ");
+       }
+       if(sb.length() > 0)
+       {
+           sb.deleteCharAt(sb.length()-1);
+       }
+
+       return sb.toString();
+     }  
     
+     public void setTags(String tags)
+     {
+       if (tags == null)
+         return;
+       
+       String[] tagsarr = StringUtils.split(tags, ' ');
+       
+       if (tagsarr == null || tagsarr.length == 0)
+         return;
+       
+       updateTags(Arrays.asList(tagsarr));       
+     }
+
     //------------------------------------------------------------------------
     
     /**

Added: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java?view=auto&rev=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java Wed Sep 20 22:01:56 2006
@@ -0,0 +1,223 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Generated file - Do not edit!
+ */
+package org.apache.roller.pojos;
+
+import java.sql.Timestamp;
+
+import org.apache.roller.util.PojoUtil;
+
+
+/**
+ * Tag bean.
+ * @author Elias Torres
+ *
+ * @ejb:bean name="WeblogEntryTagData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="weblogentrytag"
+ * @hibernate.cache usage="read-write"
+ */
+public class WeblogEntryTagData extends PersistentObject
+    implements java.io.Serializable
+{
+    private static final long serialVersionUID = -2602052289337573384L;
+    private java.lang.String id = null;
+    private WebsiteData website = null;
+    private WeblogEntryData weblogEntry = null;
+    private UserData user = null;
+    private java.lang.String name = null;    
+    private Timestamp time = null;
+
+    public WeblogEntryTagData()
+    {
+    }
+
+    public WeblogEntryTagData(java.lang.String id, 
+                       WebsiteData website, 
+                       WeblogEntryData weblogEntry, 
+                       UserData user, java.lang.String name,
+                       Timestamp time)
+    {
+        this.id = id;
+        this.website = website;
+        this.weblogEntry = weblogEntry;
+        this.user = user;
+        this.name = name;
+        this.time = time;
+    }
+
+    public WeblogEntryTagData(WeblogEntryTagData otherData)
+    {
+        setData(otherData);
+    }
+
+    //------------------------------------------------------- Simple properties
+
+    /** 
+     * Unique ID and primary key of this Referer.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * ID of website that this tag refers to.
+     *
+     * @roller.wrapPojoMethod type="pojo"
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+     */
+    public org.apache.roller.pojos.WebsiteData getWebsite()
+    {
+        return this.website;
+    }
+
+    public void setWebsite(org.apache.roller.pojos.WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * @roller.wrapPojoMethod type="pojo"
+     * @hibernate.many-to-one column="entryid" cascade="none"
+     */
+    public org.apache.roller.pojos.WeblogEntryData getWeblogEntry()
+    {
+        return weblogEntry;
+    }
+
+    /**
+     * @param data
+     */
+    public void setWeblogEntry(org.apache.roller.pojos.WeblogEntryData data)
+    {
+        weblogEntry = data;
+    }
+    
+    /**
+     * @roller.wrapPojoMethod type="pojo"
+     * @hibernate.many-to-one column="userid" cascade="none"
+     */
+    public UserData getUser() {
+        return this.user;
+    }
+    /** @ejb:persistent-field */
+    public void setUser( UserData user ) {
+        this.user = user;
+    }    
+    
+    /**
+     * Tag value
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
+     * @hibernate.property column="name" non-null="true" unique="false"
+     */
+    public String getName() {
+        return this.name;
+    }
+    /** @ejb:persistent-field */
+    public void setName( String name ) {
+        this.name = name;
+    }   
+    
+    /**
+    *
+    * @roller.wrapPojoMethod type="simple"
+    * @ejb:persistent-field
+    * @hibernate.property column="time" non-null="true" unique="false"
+    */
+   public java.sql.Timestamp getTime()
+   {
+       return this.time;
+   }
+
+   /** @ejb:persistent-field */
+   public void setTime(java.sql.Timestamp tagTime)
+   {
+       this.time = tagTime;
+   }    
+
+   public String toString() {
+     StringBuffer str = new StringBuffer("{");
+     
+     str.append("id=" + id + " " +
+             "website=" + website + " " +
+             "weblogEntry=" + weblogEntry + " " +
+             "user=" + user + " " +
+             "name=" + name + " " +
+             "tagTime=" + time);
+     str.append('}');
+     
+     return (str.toString());
+ }
+ 
+   public boolean equals(Object pOther) {
+       if (pOther instanceof WeblogEntryTagData) {
+           WeblogEntryTagData lTest = (WeblogEntryTagData) pOther;
+           boolean lEquals = true;
+           
+           lEquals = PojoUtil.equals(lEquals, this.id, lTest.getId());
+           lEquals = PojoUtil.equals(lEquals, this.website, lTest.getWebsite());
+           lEquals = PojoUtil.equals(lEquals, this.weblogEntry, lTest.getWeblogEntry());
+           lEquals = PojoUtil.equals(lEquals, this.user, lTest.getUser());
+           lEquals = PojoUtil.equals(lEquals, this.name, lTest.getName());
+           lEquals = PojoUtil.equals(lEquals, this.time, lTest.getTime());
+           return lEquals;
+       } else {
+           return false;
+       }
+   }
+ 
+   public int hashCode() {
+       int result = 17;
+       result = PojoUtil.addHashCode(result, this.id);
+       result = PojoUtil.addHashCode(result, this.website);
+       result = PojoUtil.addHashCode(result, this.weblogEntry);
+       result = PojoUtil.addHashCode(result, this.user);
+       result = PojoUtil.addHashCode(result, this.name);
+       result = PojoUtil.addHashCode(result, this.time);
+       
+       return result;
+   }
+ 
+    /**
+     * Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.apache.roller.pojos.PersistentObject otherData)
+    {
+        WeblogEntryTagData data = (WeblogEntryTagData) otherData;
+        this.id = data.getId();
+        this.website = data.getWebsite();
+        this.weblogEntry = data.getWeblogEntry();
+        this.user = data.getUser();
+        this.name = data.getName();
+        this.time = data.getTime();
+    }
+
+}
\ No newline at end of file

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java Wed Sep 20 22:01:56 2006
@@ -21,6 +21,7 @@
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.TimeZone;
 import java.util.Date;
@@ -39,6 +40,7 @@
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.pojos.EntryAttributeData;
 import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WeblogEntryTagData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.ui.core.RollerRequest;
 import org.apache.roller.ui.core.RollerSession;
@@ -59,6 +61,7 @@
     private String mCategoryId = null;
     private String mCreatorId = null;
     private String mWebsiteId = null;
+    private String mTags = null;
     private Date mDate = new Date();    
     private String mDateString = null;        
     private Integer mHours = new Integer(0);
@@ -182,6 +185,11 @@
                 }
             }
         }
+        
+        if(getTags() != null) 
+        {
+          entry.setTags(getTags());
+        }
     }
     
     /**
@@ -204,6 +212,12 @@
             pluginsArray = StringUtils.split(entry.getPlugins(), ",");
         }
         
+        String tags = entry.getTags();
+        if (tags != null && tags.length() > 0)
+        {
+          setTags(tags);
+        }
+                
         attributes = new HashMap();
         Iterator atts = entry.getEntryAttributes().iterator();
         while (atts.hasNext())
@@ -458,7 +472,7 @@
     {
         mWebsiteId = websiteId;
     }
-
+    
     /** Convenience method for checking status */
     public boolean isDraft() 
     {

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -86,7 +86,7 @@
                         ((WeblogEntryData)entries.get(0)).getPubTime());
                 
                 // append 8 char date string on end of selfurl
-                String dayUrl = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, -1, false);
+                String dayUrl = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, null, -1, false);
                               
                 sb.append("<div class=\"hCalendarDayTitleBig\">");
                 sb.append("<a href=\"");
@@ -152,10 +152,10 @@
         try {
             if (nextPrevMonthURL && pageLink != null) { 
                 // next/prev month URLs point to current page
-                url = URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, cat, dateString, -1, false);
+                url = URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, cat, dateString, null, -1, false);
             } else { 
                 // all other URLs point back to main weblog page
-                url = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, -1, false);
+                url = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, null, -1, false);
             }
         } catch (Exception e) {
             mLogger.error("ERROR: creating URL",e);

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -163,9 +163,9 @@
         }
         try {
             if (pageLink == null) { // create date URL
-                url = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, -1, false);
+                url = URLUtilities.getWeblogCollectionURL(weblog, locale, cat, dateString, null, -1, false);
             } else { // create page URL
-                url = URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, cat, dateString, -1, false);
+                url = URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, cat, dateString, null, -1, false);
             }
         } catch (Exception e) {
             log.error("ERROR: creating URL",e);
@@ -224,7 +224,7 @@
     }
     
     public String computeTodayMonthUrl() {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, cat, null, -1, false);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, cat, null, null, -1, false);
     }
     
 }

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/WeblogRequestMapper.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/WeblogRequestMapper.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/WeblogRequestMapper.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/WeblogRequestMapper.java Wed Sep 20 22:01:56 2006
@@ -258,7 +258,8 @@
                 
                 // requests handled by PageServlet
             } else if(context.equals("page") || context.equals("entry") ||
-                    context.equals("date") || context.equals("category")) {
+                    context.equals("date") || context.equals("category")
+                    || context.equals("tags")) {
                 
                 forwardUrl.append(PAGE_SERVLET);
                 forwardUrl.append("/");

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PageModel.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PageModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PageModel.java Wed Sep 20 22:01:56 2006
@@ -19,6 +19,8 @@
 package org.apache.roller.ui.rendering.model; 
 
 import java.util.Map;
+import javax.servlet.jsp.tagext.TagSupport;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -196,6 +198,7 @@
                     pageRequest.getWeblogAnchor(),
                     pageRequest.getWeblogDate(),
                     cat,
+                    pageRequest.getTags(),
                     pageRequest.getPageNum());
         } else if (dateString != null && dateString.length() == 8) {
             return new WeblogEntriesDayPager(
@@ -205,6 +208,7 @@
                     pageRequest.getWeblogAnchor(),
                     pageRequest.getWeblogDate(),
                     cat,
+                    pageRequest.getTags(),
                     pageRequest.getPageNum());
         } else if (dateString != null && dateString.length() == 6) {
             return new WeblogEntriesMonthPager(
@@ -214,7 +218,9 @@
                     pageRequest.getWeblogAnchor(),
                     pageRequest.getWeblogDate(),
                     cat,
+                    pageRequest.getTags(),
                     pageRequest.getPageNum());
+          
         } else {
             return new WeblogEntriesLatestPager(
                     weblog,
@@ -223,6 +229,7 @@
                     pageRequest.getWeblogAnchor(),
                     pageRequest.getWeblogDate(),
                     cat,
+                    pageRequest.getTags(),
                     pageRequest.getPageNum());
         }
     }

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PlanetModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PlanetModel.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PlanetModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/PlanetModel.java Wed Sep 20 22:01:56 2006
@@ -19,6 +19,7 @@
 package org.apache.roller.ui.rendering.model;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -85,7 +86,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         return new PlanetEntriesPager(
             null,
@@ -108,7 +109,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         return new PlanetEntriesPager(
             null,
@@ -131,7 +132,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         return new PlanetEntriesPager(
             feedURL,

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -20,6 +20,7 @@
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -46,6 +47,7 @@
 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.WeblogPageRequest;
 import org.apache.roller.ui.rendering.util.WeblogRequest;
@@ -61,6 +63,7 @@
     
     private WebsiteData weblog = null;
     private WeblogRequest weblogRequest = null;
+    private List tags = new ArrayList();
     private String pageLink = null;
     private int pageNum = 0;
     
@@ -81,6 +84,7 @@
             Template weblogPage = ((WeblogPageRequest)weblogRequest).getWeblogPage();
             pageLink = (weblogPage != null) ? weblogPage.getLink() : null;
             pageNum = ((WeblogPageRequest)weblogRequest).getPageNum();
+            tags = ((WeblogPageRequest)weblogRequest).getTags();
         }
         
         // extract weblog object
@@ -98,7 +102,16 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                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,
@@ -145,8 +158,16 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                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,
             weblogRequest.getLocale(),
@@ -166,7 +187,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         return new CommentsPager(
             pagerUrl,
@@ -182,7 +203,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         if(letter != null && StringUtils.isEmpty(letter)) {
             letter = null;
@@ -203,7 +224,7 @@
         
         String pagerUrl = URLUtilities.getWeblogPageURL(weblog, 
                 weblogRequest.getLocale(), pageLink, 
-                null, null, null, 0, false);
+                null, null, null, null, 0, false);
         
         if(letter != null && StringUtils.isEmpty(letter)) {
             letter = null;
@@ -469,4 +490,49 @@
         }
         return results;
     }
+    
+    /**
+     * @param sinceDay
+     * @return
+     */
+    public List getTags(
+            int sinceDays) {
+        List results = new ArrayList();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        cal.add(Calendar.DATE, -1 * sinceDays);
+        Date startDate = cal.getTime();
+        try {            
+            Roller roller = RollerFactory.getRoller();
+            WeblogManager wmgr = roller.getWeblogManager();
+            results = wmgr.getTags(
+                    startDate, new Date(), null, null, false, -1);
+        } catch (Exception e) {
+            log.error("ERROR: fetching site tags list", e);
+        }
+        return results;
+    }
+    
+    /**
+     * @param sinceDay
+     * @return
+     */
+    public List getHotTags(
+            int sinceDays, int length) {
+        List results = new ArrayList();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        cal.add(Calendar.DATE, -1 * sinceDays);
+        Date startDate = cal.getTime();
+        try {            
+            Roller roller = RollerFactory.getRoller();
+            WeblogManager wmgr = roller.getWeblogManager();
+            results = wmgr.getTags(
+                    startDate, new Date(), null, null, true, length);
+        } catch (Exception e) {
+            log.error("ERROR: fetching site tags list", e);
+        }
+        return results;
+    }    
+    
 }

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/URLModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/URLModel.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/URLModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/URLModel.java Wed Sep 20 22:01:56 2006
@@ -134,22 +134,22 @@
     }
         
     public String getHome() {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, null, -1, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, null, null, -1, true);
     }
     
     
     public String home(int pageNum) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, null, pageNum, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, null, null, pageNum, true);
     }
     
     
     public String home(String customLocale) {
-        return URLUtilities.getWeblogCollectionURL(weblog, customLocale, null, null, -1, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, customLocale, null, null, null, -1, true);
     }
     
     
     public String home(String customLocale, int pageNum) {
-        return URLUtilities.getWeblogCollectionURL(weblog, customLocale, null, null, pageNum, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, customLocale, null, null, null, pageNum, true);
     }
     
     
@@ -173,32 +173,32 @@
 
     
     public String date(String dateString) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, dateString, -1, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, dateString, null, -1, true);
     }
     
     
     public String date(String dateString, int pageNum) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, dateString, pageNum, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, null, dateString, null, pageNum, true);
     }
     
     
     public String category(String catPath) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, null, -1, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, null, null, -1, true);
     }
     
     
     public String category(String catPath, int pageNum) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, null, pageNum, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, null, null, pageNum, true);
     }
     
     
     public String collection(String dateString, String catPath) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, dateString, -1, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, dateString, null, -1, true);
     }
     
     
     public String collection(String dateString, String catPath, int pageNum) {
-        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, dateString, pageNum, true);
+        return URLUtilities.getWeblogCollectionURL(weblog, locale, catPath, dateString, null, pageNum, true);
     }
     
     
@@ -218,12 +218,12 @@
     
     
     public String page(String pageLink) {
-        return URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, null, null, -1, true);
+        return URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, null, null, null, -1, true);
     }
     
     
     public String page(String pageLink, String dateString, String catPath, int pageNum) {
-        return URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, catPath, dateString, pageNum, true);
+        return URLUtilities.getWeblogPageURL(weblog, locale, pageLink, null, catPath, dateString, null, pageNum, true);
     }
     
     

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java Wed Sep 20 22:01:56 2006
@@ -57,6 +57,7 @@
     String entryAnchor = null;
     String dateString = null;
     String catPath = null;
+    List tags = new ArrayList();
     int offset = 0;
     int page = 0;
     int length = 0;
@@ -69,6 +70,7 @@
             String             entryAnchor,
             String             dateString,
             String             catPath,
+            List               tags,
             int                page) {
         
         this.weblog = weblog;
@@ -78,6 +80,9 @@
         this.dateString = dateString;
         this.catPath = catPath;
         
+        if(tags != null)
+          this.tags = tags;
+        
         // make sure offset, length, and page are valid
         length = weblog.getEntryDisplayCount();
         if(page > 0) {
@@ -93,7 +98,7 @@
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, entryAnchor, dateString, catPath);
+        return createURL(0, 0, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags);
     }
     
     
@@ -104,7 +109,7 @@
     
     public String getNextLink() {
         if (hasMoreEntries()) {
-            return createURL(page, 1, weblog, locale, pageLink, entryAnchor, dateString, catPath);
+            return createURL(page, 1, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags);
         }
         return null;
     }
@@ -120,7 +125,7 @@
     
     public String getPrevLink() {
         if (page > 0) {
-            return createURL(page, -1, weblog, locale, pageLink, entryAnchor, dateString, catPath);
+            return createURL(page, -1, weblog, locale, pageLink, entryAnchor, dateString, catPath, tags);
         }
         return null;
     }
@@ -209,17 +214,18 @@
             String             pageLink,
             String             entryAnchor,
             String             dateString,
-            String             catPath) {
+            String             catPath,
+            List               tags) {
         
         int pageNum = page + pageAdd;
         
         if (pageLink != null) {
-            return URLUtilities.getWeblogPageURL(website, locale, pageLink, entryAnchor, catPath, dateString, pageNum, false);
+            return URLUtilities.getWeblogPageURL(website, locale, pageLink, entryAnchor, catPath, dateString, tags, pageNum, false);
         } else if (entryAnchor != null) {
             return URLUtilities.getWeblogEntryURL(website, locale, entryAnchor, true);
         }
         
-        return URLUtilities.getWeblogCollectionURL(website, locale, catPath, dateString, pageNum, false);
+        return URLUtilities.getWeblogCollectionURL(website, locale, catPath, dateString, tags, pageNum, false);
     }
     
 }

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -67,9 +67,10 @@
             String             entryAnchor,
             String             dateString,
             String             catPath,
+            List               tags,
             int                page) {
         
-        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, page);
+        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
         getEntries();
         
@@ -154,7 +155,7 @@
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath);
+        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath, tags);
     }
     
     
@@ -165,7 +166,7 @@
     
     public String getNextLink() {
         if (more) {
-            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath);
+            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath, tags);
         }
         return null;
     }
@@ -181,7 +182,7 @@
     
     public String getPrevLink() {
         if (page > 0) {
-            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath);
+            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath, tags);
         }
         return null;
     }
@@ -198,7 +199,7 @@
     public String getNextCollectionLink() {
         if (nextDay != null) {
             String next = DateUtil.format8chars(nextDay);
-            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath, tags);
         }
         return null;
     }
@@ -215,7 +216,7 @@
     public String getPrevCollectionLink() {
         if (prevDay != null) {
             String prev = DateUtil.format8chars(prevDay);
-            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath, tags);
         }
         return null;
     }

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -58,9 +58,10 @@
             String             entryAnchor,
             String             dateString,
             String             catPath,
+            List               tags,
             int                page) {
         
-        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, page);
+        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
         // initialize the pager collection
         getEntries();

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=448460&r1=448459&r2=448460
==============================================================================
--- 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 Wed Sep 20 22:01:56 2006
@@ -67,9 +67,10 @@
             String             entryAnchor,
             String             dateString,
             String             catPath,
+            List               tags,
             int                page) {
         
-        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, page);
+        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
         getEntries();
         
@@ -147,7 +148,7 @@
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath);
+        return createURL(0, 0, weblog, locale, pageLink, null, null, catPath, tags);
     }
     
     
@@ -158,7 +159,7 @@
     
     public String getNextLink() {
         if (more) {
-            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath);
+            return createURL(page, 1, weblog, locale, pageLink, null, dateString, catPath, tags);
         }
         return null;
     }
@@ -174,7 +175,7 @@
     
     public String getPrevLink() {
         if (offset > 0) {
-            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath);
+            return createURL(page, -1, weblog, locale, pageLink, null, dateString, catPath, tags);
         }
         return null;
     }
@@ -191,7 +192,7 @@
     public String getNextCollectionLink() {
         if (nextMonth != null) {
             String next = DateUtil.format6chars(nextMonth);
-            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, null, next, catPath, tags);
         }
         return null;
     }
@@ -208,7 +209,7 @@
     public String getPrevCollectionLink() {
         if (prevMonth != null) {
             String prev = DateUtil.format6chars(prevMonth);
-            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, null, prev, catPath, tags);
         }
         return null;
     }

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java Wed Sep 20 22:01:56 2006
@@ -21,6 +21,7 @@
 import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import org.apache.commons.logging.Log;
@@ -58,9 +59,10 @@
             String             entryAnchor,
             String             dateString,
             String             catPath,
+            List               tags,
             int                page) {
         
-        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, page);
+        super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
         getEntries();
     }
@@ -85,7 +87,7 @@
     
     
     public String getHomeLink() {
-        return createURL(0, 0, weblog, locale, pageLink, null, dateString, catPath);
+        return createURL(0, 0, weblog, locale, pageLink, null, dateString, catPath, tags);
     }
     
     
@@ -96,7 +98,7 @@
     
     public String getNextLink() {
         if (getNextEntry() != null) {
-            return createURL(0, 0, weblog, locale, pageLink, nextEntry.getAnchor(), dateString, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, nextEntry.getAnchor(), dateString, catPath, tags);
         }
         return null;
     }
@@ -113,7 +115,7 @@
     
     public String getPrevLink() {
         if (getPrevEntry() != null) {
-            return createURL(0, 0, weblog, locale, pageLink, prevEntry.getAnchor(), dateString, catPath);
+            return createURL(0, 0, weblog, locale, pageLink, prevEntry.getAnchor(), dateString, catPath, tags);
         }
         return null;
     }

Added: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java?view=auto&rev=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java Wed Sep 20 22:01:56 2006
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.ui.rendering.pagers;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.UserManager;
+import org.apache.roller.model.WeblogManager;
+import org.apache.roller.pojos.Template;
+import org.apache.roller.pojos.UserData;
+import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WebsiteData;
+import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
+
+
+/**
+ * Simple pager for list of weblog entries.
+ */
+public class WeblogEntriesTagsPager extends AbstractPager {
+    
+    private static Log log = LogFactory.getLog(WeblogEntriesTagsPager.class);
+    
+    private String locale = null;
+    private int sinceDays = -1;
+    private int length = 0;
+    
+    private WebsiteData queryWeblog = null;
+    private UserData queryUser = null;
+    private List queryTags = null;
+    
+    // entries for the pager
+    private List entries;
+    
+    // are there more entries?
+    private boolean more = false;
+    
+    
+    public WeblogEntriesTagsPager(
+            String         baseUrl,
+            WebsiteData    queryWeblog,
+            UserData       queryUser,
+            List           queryTags,
+            String         locale,
+            int            sinceDays,
+            int            pageNum,
+            int            length) {
+        
+        super(baseUrl, pageNum);
+        
+        // store the data
+        this.queryWeblog = queryWeblog;
+        this.queryUser = queryUser;
+        this.queryTags = queryTags;
+        this.locale = locale;
+        this.sinceDays = sinceDays;
+        this.length = length;
+        
+        // initialize the pager collection
+        getItems();
+    }
+    
+    
+    public List getItems() {
+        
+        if (entries == null) {
+            // calculate offset
+            int offset = getPage() * length;
+            
+            List results = new ArrayList();
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(new Date());
+            cal.add(Calendar.DATE, -1 * sinceDays);
+            Date startDate = cal.getTime();
+            try {
+                Roller roller = RollerFactory.getRoller();
+                WeblogManager wmgr = roller.getWeblogManager();
+                UserManager umgr = roller.getUserManager();
+                List rawEntries = wmgr.getWeblogEntriesByTags(queryWeblog, queryTags);
+                
+                // check if there are more results for paging
+                if(rawEntries.size() > length) {
+                    more = true;
+                    rawEntries.remove(rawEntries.size() - 1);
+                }
+                
+                // wrap the results
+                for (Iterator it = rawEntries.iterator(); it.hasNext();) {
+                    WeblogEntryData entry = (WeblogEntryData) it.next();
+                    results.add(WeblogEntryDataWrapper.wrap(entry));
+                }
+                
+            } catch (Exception e) {
+                log.error("ERROR: fetching weblog entries list", e);
+            }
+            
+            entries = results;
+        }
+        
+        return entries;
+    }
+    
+    
+    public boolean hasMoreItems() {
+        return more;
+    }
+
+}

Propchange: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/roller/trunk/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesTagsPager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java Wed Sep 20 22:01:56 2006
@@ -18,7 +18,10 @@
 
 package org.apache.roller.ui.rendering.util;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.lang.StringUtils;
@@ -33,6 +36,7 @@
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WeblogTemplate;
 import org.apache.roller.util.URLUtilities;
+import org.apache.roller.util.Utilities;
 
 
 /**
@@ -55,6 +59,7 @@
     private String weblogPageName = null;
     private String weblogCategoryName = null;
     private String weblogDate = null;
+    private List tags = new ArrayList();
     private int pageNum = 0;
     private Map customParams = new HashMap();
     
@@ -100,6 +105,7 @@
          * /entry/<anchor> - permalink
          * /date/<YYYYMMDD> - date collection view
          * /category/<category> - category collection view
+         * /tags/spring+framework - tags
          * /page/<pagelink> - custom page
          *
          * path info may be null, which indicates the weblog homepage
@@ -136,7 +142,10 @@
                     
                 } else if("page".equals(this.context)) {
                     this.weblogPageName = pathElements[1];
-                    
+
+                } else if("tags".equals(this.context)) {
+                  this.tags = Arrays.asList(StringUtils.split(pathElements[1],"+"));
+                                      
                 } else {
                     throw new InvalidRequestException("context "+this.context+
                             "not supported, "+request.getRequestURL());
@@ -201,6 +210,10 @@
                         this.weblogCategoryName = "/"+this.weblogCategoryName;
                     }
                 }
+                
+                if(request.getParameter("tags") != null) {
+                  this.tags = Arrays.asList(StringUtils.split(URLUtilities.decode(request.getParameter("tags")),"+"));
+                }
             }
         }
         
@@ -222,12 +235,14 @@
         customParams.remove("date");
         customParams.remove("cat");
         customParams.remove("page");
+        customParams.remove("tags");
             
         if(log.isDebugEnabled()) {
             log.debug("context = "+this.context);
             log.debug("weblogAnchor = "+this.weblogAnchor);
             log.debug("weblogDate = "+this.weblogDate);
             log.debug("weblogCategory = "+this.weblogCategoryName);
+            log.debug("tags = "+ Utilities.stringArrayToString((String[])this.tags.toArray(), ","));
             log.debug("weblogPage = "+this.weblogPageName);
             log.debug("pageNum = "+this.pageNum);
         }
@@ -299,6 +314,14 @@
 
     public void setCustomParams(Map customParams) {
         this.customParams = customParams;
+    }
+    
+    public List getTags() {
+      return tags;
+    }
+    
+    public void setTags(List tags) {
+      this.tags = tags;
     }
     
     public WeblogEntryData getWeblogEntry() {

Modified: incubator/roller/trunk/src/org/apache/roller/util/URLUtilities.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/util/URLUtilities.java?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/util/URLUtilities.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/util/URLUtilities.java Wed Sep 20 22:01:56 2006
@@ -23,6 +23,7 @@
 import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import org.apache.roller.config.RollerRuntimeConfig;
 import org.apache.roller.pojos.WebsiteData;
@@ -152,6 +153,7 @@
                                                       String locale,
                                                       String category,
                                                       String dateString,
+                                                      List tags,
                                                       int pageNum,
                                                       boolean absolute) {
         
@@ -178,7 +180,9 @@
             
         } else if(dateString != null && cat == null) {
             pathinfo.append("date/").append(dateString);  
-            
+        
+        } else if(tags != null && tags.size() > 0) {
+            pathinfo.append("tags/").append(Utilities.stringArrayToString((String[])tags.toArray(), ","));
         } else {
             if(dateString != null) params.put("date", dateString);
             if(cat != null) params.put("cat", encode(cat));
@@ -201,6 +205,7 @@
                                                 String entryAnchor,
                                                 String category,
                                                 String dateString,
+                                                List tags,
                                                 int pageNum,
                                                 boolean absolute) {
         
@@ -223,12 +228,15 @@
             if(category != null) {
                 params.put("cat", encode(category));
             }
+            if(tags != null && tags.size() > 0) {
+                params.put("tags",encode(Utilities.stringArrayToString((String[])tags.toArray(), "+")));
+            }
             if(pageNum > 0) {
                 params.put("page", Integer.toString(pageNum));
             }
         } else {
             // if there is no page link then this is just a typical collection url
-            return getWeblogCollectionURL(weblog, locale, category, dateString, pageNum, absolute);
+            return getWeblogCollectionURL(weblog, locale, category, dateString, tags, pageNum, absolute);
         }
         
         return pathinfo.toString() + getQueryString(params);

Modified: incubator/roller/trunk/testdata/WEB-INF/classes/hibernate.cfg.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/testdata/WEB-INF/classes/hibernate.cfg.xml?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/testdata/WEB-INF/classes/hibernate.cfg.xml (original)
+++ incubator/roller/trunk/testdata/WEB-INF/classes/hibernate.cfg.xml Wed Sep 20 22:01:56 2006
@@ -4,7 +4,7 @@
         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 <hibernate-configuration>
     <session-factory>
-    
+    
         <!-- By default Roller uses a JNDI DataSource and the MySQLDialect 
         <property name="show_sql">false</property>
         <property name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
@@ -62,7 +62,8 @@
         <mapping resource="org/apache/roller/pojos/UserData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogCategoryData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/WeblogCategoryAssoc.hbm.xml" />
-        <mapping resource="org/apache/roller/pojos/WeblogEntryData.hbm.xml" />
+        <mapping resource="org/apache/roller/pojos/WeblogEntryData.hbm.xml" />
+        <mapping resource="org/apache/roller/pojos/WeblogEntryTagData.hbm.xml" />        
         <mapping resource="org/apache/roller/pojos/WebsiteData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/RollerPropertyData.hbm.xml" />
         <mapping resource="org/apache/roller/pojos/PermissionsData.hbm.xml" />

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=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java Wed Sep 20 22:01:56 2006
@@ -23,6 +23,10 @@
 
 package org.apache.roller.business;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import junit.framework.Test;
@@ -35,6 +39,7 @@
 import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.UserData;
 import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WeblogEntryTagData;
 import org.apache.roller.pojos.WebsiteData;
 
 
@@ -318,6 +323,309 @@
         TestUtils.endSession(true);
     }
     
+
+    public void testCreateAnEntryWithTags() throws Exception {
+        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+        WeblogEntryData entry = null;
+        
+        WeblogEntryData testEntry = new WeblogEntryData();
+        testEntry.setTitle("entryTestEntry");
+        testEntry.setLink("testEntryLink");
+        testEntry.setText("blah blah entry");
+        testEntry.setAnchor("testEntryAnchor");
+        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+        testEntry.setWebsite(testWeblog);
+        testEntry.setCreator(testUser);
+        testEntry.setCategory(testWeblog.getDefaultCategory());
+                
+        WeblogEntryTagData tag = new WeblogEntryTagData();
+        tag.setName("testTag");
+        tag.setWebsite(testWeblog);
+        tag.setWeblogEntry(testEntry);
+        tag.setUser(testUser);
+        tag.setTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+        
+        testEntry.getTagSet().add(tag);
+        
+        // create a weblog entry
+        mgr.saveWeblogEntry(testEntry);
+        String id = testEntry.getId();
+        TestUtils.endSession(true);
+        
+        // make sure entry was created
+        entry = mgr.getWeblogEntry(id);
+        assertNotNull(entry);
+        assertEquals(testEntry, entry);
+        assertNotNull(entry.getTagSet());
+        assertEquals(1, entry.getTagSet().size());
+        assertEquals("testTag",((WeblogEntryTagData) entry.getTagSet().iterator().next()).getName());
+        
+        // teardown our test entries
+        TestUtils.teardownWeblogEntry(id);
+        TestUtils.endSession(true);
+    }
+
+    public void testCreateAnEntryWithTagsShortcut() throws Exception {
+      
+        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+        WeblogEntryData entry = null;
+        
+        WeblogEntryData testEntry = new WeblogEntryData();
+        testEntry.setTitle("entryTestEntry");
+        testEntry.setLink("testEntryLink");
+        testEntry.setText("blah blah entry");
+        testEntry.setAnchor("testEntryAnchor");
+        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+        testEntry.setWebsite(testWeblog);
+        testEntry.setCreator(testUser);
+        testEntry.setCategory(testWeblog.getDefaultCategory());
+
+        // shortcut
+        testEntry.addTag("testTag");
+        
+        // create a weblog entry
+        mgr.saveWeblogEntry(testEntry);
+        String id = testEntry.getId();
+        TestUtils.endSession(true);
+        
+        // make sure entry was created
+        entry = mgr.getWeblogEntry(id);
+        assertNotNull(entry);
+        assertEquals(testEntry, entry);
+        assertNotNull(entry.getTagSet());
+        assertEquals(1, entry.getTagSet().size());
+        assertEquals("testTag",((WeblogEntryTagData) entry.getTagSet().iterator().next()).getName());
+        
+        // teardown our test entry
+        TestUtils.teardownWeblogEntry(id);
+        TestUtils.endSession(true);
+    }
+    
+    public void testTagUpdate() throws Exception {
+    
+        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+        
+        // setup some test entries to use
+        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+        entry.addTag("testTag");
+        String id = entry.getId();
+        TestUtils.endSession(true);
+
+        entry = mgr.getWeblogEntry(id);
+        assertNotNull(entry);
+        assertNotNull(entry.getTagSet());
+        assertEquals(1, entry.getTagSet().size());
+        assertEquals("testTag",((WeblogEntryTagData) entry.getTagSet().iterator().next()).getName());
+
+        // update a weblog entry tag
+        WeblogEntryTagData tag = ((WeblogEntryTagData) entry.getTagSet().iterator().next());
+        tag.setName("updatedTestTag");
+        TestUtils.endSession(true);
+
+        entry = mgr.getWeblogEntry(id);
+        assertNotNull(entry);
+        assertEquals(1, entry.getTagSet().size());
+        assertEquals("updatedTestTag",((WeblogEntryTagData) entry.getTagSet().iterator().next()).getName());
+      
+        // teardown our test entry
+        TestUtils.teardownWeblogEntry(id);
+        TestUtils.endSession(true);
+        
+    }
+    
+    public void testAddMultipleTags() throws Exception {    
+    
+        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+        
+        // setup some test entries to use
+        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+        entry.addTag("testTag");
+        entry.addTag("whateverTag");
+        String id = entry.getId();
+        TestUtils.endSession(true);
+        
+        entry = mgr.getWeblogEntry(id);
+        entry.addTag("testTag2");
+        TestUtils.endSession(true);
+        
+        entry = mgr.getWeblogEntry(id);
+        assertEquals(3, entry.getTagSet().size());
+        
+        // teardown our test entry
+        TestUtils.teardownWeblogEntry(id);
+        TestUtils.endSession(true);      
+    }
+    
+    public void testAddMultipleIdenticalTags() throws Exception {    
+      
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testTag");
+      String id = entry.getId();
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      entry.addTag("testTag");
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(1, entry.getTagSet().size());
+      
+      // teardown our test entry
+      TestUtils.teardownWeblogEntry(id);
+      TestUtils.endSession(true);      
+  }    
+    
+    public void testRemoveTags() throws Exception {
+
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      UserData testUser = TestUtils.setupUser("entryTestUser3");
+      WebsiteData testWeblog = TestUtils.setupWeblog("entryTestWeblog3", testUser);
+      TestUtils.endSession(true);
+         
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testTag");
+      entry.addTag("testTag2");      
+      String id = entry.getId();
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(2, entry.getTagSet().size());
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      entry.getTagSet().clear();
+      TestUtils.endSession(true);
+
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(0, entry.getTagSet().size());
+      TestUtils.endSession(true);
+      
+      // teardown our test entry
+      //TestUtils.teardownWeblogEntry(id);
+      //TestUtils.endSession(true);      
+    }
+    
+    public void testRemoveTagsViaShortcut() throws Exception {
+
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testTag");
+      entry.addTag("testTag2");      
+      String id = entry.getId();
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(2, entry.getTagSet().size());
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      entry.removeTag("testTag");
+      entry.removeTag("testTag2");
+      TestUtils.endSession(true);
+
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(0, entry.getTagSet().size());
+      TestUtils.endSession(true);
+      
+      // teardown our test entry
+      TestUtils.teardownWeblogEntry(id);
+      TestUtils.endSession(true);      
+    }
+    
+    public void testGetEntriesByTag() throws Exception {
+
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testTag"); 
+      String id = entry.getId();
+      TestUtils.endSession(true);
+      
+      List results = mgr.getWeblogEntriesByTags(testWeblog, Arrays.asList(new String[] {"testTag"}));
+      assertEquals(1,results.size());
+      WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
+      assertEquals(entry, testEntry);
+      
+      // teardown our test entry
+      TestUtils.teardownWeblogEntry(id);
+      TestUtils.endSession(true);      
+    }  
+    
+    public void testRemoveEntryTagCascading() throws Exception {
+      
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testTag"); 
+      String id = entry.getId();
+      TestUtils.endSession(true);
+      
+      List results = mgr.getWeblogEntriesByTags(testWeblog, Arrays.asList(new String[] {"testTag"}));
+      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"}));
+      assertEquals(0,results.size());  
+      
+      // terminate
+      TestUtils.endSession(true);  
+    }
+    
+    public void testUpdateTags() throws Exception {
+
+      WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+      
+      // setup some test entries to use
+      WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
+      entry.addTag("testWillStayTag"); 
+      entry.addTag("testTagWillBeRemoved");
+      String id = entry.getId();
+      TestUtils.endSession(true);
+     
+      entry = mgr.getWeblogEntry(id);
+      assertEquals(2, entry.getTagSet().size());
+      
+      List updateTags = new ArrayList();
+      updateTags.add("testWillStayTag");
+      updateTags.add("testNewTag");
+      updateTags.add("testNewTag3");
+      entry.updateTags(updateTags);
+      TestUtils.endSession(true);
+      
+      entry = mgr.getWeblogEntry(id);
+      HashSet tagNames = new HashSet();
+      for(Iterator it = entry.getTagSet().iterator(); it.hasNext();) {
+        WeblogEntryTagData tagData = (WeblogEntryTagData) it.next();
+        tagNames.add(tagData.getName());
+      }
+      
+      assertEquals(3, entry.getTagSet().size());      
+      assertEquals(3, tagNames.size());
+      assertEquals(true, tagNames.contains("testWillStayTag"));
+      assertEquals(true, tagNames.contains("testNewTag"));
+      assertEquals(true, tagNames.contains("testNewTag3"));
+      
+      // teardown our test entry
+      TestUtils.teardownWeblogEntry(id);
+      TestUtils.endSession(true);    
+    }
+  
     
     /**
      * Test that we can add and remove entry attributes for an entry.

Modified: incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=448460&r1=448459&r2=448460
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties Wed Sep 20 22:01:56 2006
@@ -1424,6 +1424,7 @@
 weblogEdit.spellMode=Spellcheck
 weblogEdit.submitForReview=Submit for Review
 weblogEdit.submittedForReview=Entry submitted for review
+weblogEdit.tags=Tags
 weblogEdit.title=Title
 weblogEdit.unsaved=Not saved
 weblogEdit.updateTime=Last updated 



Mime
View raw message