roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r494546 - /incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
Date Tue, 09 Jan 2007 19:59:01 GMT
Author: agilliland
Date: Tue Jan  9 11:59:00 2007
New Revision: 494546

URL: http://svn.apache.org/viewvc?view=rev&rev=494546
Log:
small query optimization fix.  instead of adding the isenabled=<true/false> criteria
to the query, just check it after the object is returned.  this ensures that the website.handle
index is used for the lookup.


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

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java?view=diff&rev=494546&r1=494545&r2=494546
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
(original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
Tue Jan  9 11:59:00 2007
@@ -448,17 +448,7 @@
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WebsiteData.class);
-            
-            if (enabled != null) {
-                criteria.add(
-                        Expression.conjunction()
-                        .add(new IgnoreCaseEqExpression("handle", handle))
-                        .add(Expression.eq("enabled", enabled)));
-            } else {
-                criteria.add(
-                        Expression.conjunction()
-                        .add(Expression.eq("handle", handle)));
-            }
+            criteria.add(new IgnoreCaseEqExpression("handle", handle));
             
             WebsiteData website = (WebsiteData) criteria.uniqueResult();
             
@@ -468,7 +458,14 @@
                 this.weblogHandleToIdMap.put(website.getHandle(), website.getId());
             }
             
-            return website;
+            // enforce check against enabled status
+            if(website != null && 
+                    (enabled == null || enabled.equals(website.getEnabled()))) {
+                return website;
+            } else {
+                return null;
+            }
+            
         } catch (HibernateException e) {
             throw new RollerException(e);
         }



Mime
View raw message