roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli...@apache.org
Subject svn commit: r470186 - /incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
Date Thu, 02 Nov 2006 02:04:56 GMT
Author: eliast
Date: Wed Nov  1 18:04:56 2006
New Revision: 470186

URL: http://svn.apache.org/viewvc?view=rev&rev=470186
Log:
- More forgotten refactoring as it hid inside HQL.

  Bad Elias. I blame Hibernate and declarative programming (HQL).

Modified:
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java

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=470186&r1=470185&r2=470186
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
Wed Nov  1 18:04:56 2006
@@ -46,7 +46,6 @@
 import org.apache.roller.pojos.StatCount;
 import org.apache.roller.pojos.TagStat;
 import org.apache.roller.pojos.TagStatComparator;
-import org.apache.roller.pojos.TaskLockData;
 import org.apache.roller.pojos.UserData;
 import org.apache.roller.pojos.WeblogCategoryAssoc;
 import org.apache.roller.pojos.WeblogCategoryData;
@@ -1308,10 +1307,10 @@
             queryString.append("select name, sum(total) ");
             queryString.append("from WeblogEntryTagAggregateData where ");
             if (website != null) {
-                queryString.append("website.id = ? ");
+                queryString.append("weblog.id = ? ");
                 params.add(website.getId());
             } else {
-                queryString.append("website = NULL ");
+                queryString.append("weblog = NULL ");
             }
             if (startDate != null) {
                 queryString.append("and lastUsed >= ? ");
@@ -1389,9 +1388,9 @@
             queryString.append("select name, sum(total) ");
             queryString.append("from WeblogEntryTagAggregateData where ");
             if (website != null)
-                queryString.append("website.id = '" + website.getId() + "' ");
+                queryString.append("weblog.id = '" + website.getId() + "' ");
             else
-                queryString.append("website = NULL ");
+                queryString.append("weblog = NULL ");
             if (startsWith != null && startsWith.length() > 0)
                 queryString.append("and name like '" + startsWith + "%' ");
 
@@ -1444,9 +1443,9 @@
             
             // are we checking a specific weblog, or site-wide?
             if (weblog != null)
-                queryString.append("and website.id = '" + weblog.getId() + "' ");
+                queryString.append("and weblog.id = '" + weblog.getId() + "' ");
             else
-                queryString.append("and website is null ");
+                queryString.append("and weblog is null ");
             
             Query query = session.createQuery(queryString.toString());
             query.setParameterList("tags", tags);
@@ -1477,7 +1476,7 @@
                         
         Junction conjunction = Expression.conjunction();
         conjunction.add(Expression.eq("name", name));
-        conjunction.add(Expression.eq("website", website));
+        conjunction.add(Expression.eq("weblog", website));
 
         // The reason why add order lastUsed desc is to make sure we keep picking the most
recent
         // one in the case where we have multiple rows (clustered environment)
@@ -1491,7 +1490,7 @@
 
         conjunction = Expression.conjunction();
         conjunction.add(Restrictions.eq("name", name));
-        conjunction.add(Restrictions.isNull("website"));
+        conjunction.add(Restrictions.isNull("weblog"));
         
         criteria = session.createCriteria(WeblogEntryTagAggregateData.class)
             .add(conjunction).addOrder(Order.desc("lastUsed")).setMaxResults(1);
@@ -1506,7 +1505,7 @@
             weblogTagData.setLastUsed(lastUsed);
             session.save(weblogTagData);
         } else if(weblogTagData != null) {
-            session.createQuery("update WeblogEntryTagAggregateData set total = total + ?,
lastUsed = current_timestamp() where name = ? and website = ?")
+            session.createQuery("update WeblogEntryTagAggregateData set total = total + ?,
lastUsed = current_timestamp() where name = ? and weblog = ?")
             .setInteger(0, amount)
             .setString(1, weblogTagData.getName())
             .setParameter(2, website)
@@ -1519,7 +1518,7 @@
             siteTagData.setLastUsed(lastUsed);
             session.save(siteTagData);
         } else if(siteTagData != null) {
-            session.createQuery("update WeblogEntryTagAggregateData set total = total + ?,
lastUsed = current_timestamp() where name = ? and website is null")
+            session.createQuery("update WeblogEntryTagAggregateData set total = total + ?,
lastUsed = current_timestamp() where name = ? and weblog is null")
             .setInteger(0, amount)
             .setString(1, siteTagData.getName())
             .executeUpdate();            



Mime
View raw message