roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1615466 - in /roller/trunk/app/src/main: java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml resources/sql/createdb.vm
Date Sun, 03 Aug 2014 23:48:17 GMT
Author: gmazza
Date: Sun Aug  3 23:48:16 2014
New Revision: 1615466

URL: http://svn.apache.org/r1615466
Log:
ROL-1739 add a unique constraint on (website, tagname) to trap a potential error in the code.
 Only done for new databases created by createdb.vm; not for old databases upgrading via the
migration script.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml
    roller/trunk/app/src/main/resources/sql/createdb.vm

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=1615466&r1=1615465&r2=1615466&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
Sun Aug  3 23:48:16 2014
@@ -1161,7 +1161,7 @@ public class JPAWeblogEntryManagerImpl i
             siteTagData.setLastUsed(lastUsed);
             strategy.store(siteTagData);
             
-        } else if(siteTagData != null) {
+        } else if (siteTagData != null) {
             siteTagData.setTotal(siteTagData.getTotal() + amount);
             siteTagData.setLastUsed(lastUsed);
             strategy.store(siteTagData);

Modified: roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml?rev=1615466&r1=1615465&r2=1615466&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml
(original)
+++ roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml
Sun Aug  3 23:48:16 2014
@@ -10,61 +10,11 @@
         <named-query name="WeblogEntryTagAggregate.getByName&amp;WebsiteOrderByLastUsedDesc">
             <query>SELECT w FROM WeblogEntryTagAggregate w WHERE w.name = ?1 AND w.weblog
= ?2 ORDER BY w.lastUsed DESC</query>
         </named-query>
-        <named-query name="WeblogEntryTagAggregate.getByName&amp;WebsiteNullOrderByLastUsedDesc">
-            <query>SELECT w FROM WeblogEntryTagAggregate w WHERE w.name = ?1 AND w.weblog
IS NULL ORDER BY w.lastUsed DESC</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getNameByNameIn&amp;Website">
-            <!-- <query>SELECT DISTINCT w.name FROM WeblogEntryTagAggregate w WHERE
w.name IN (?1) AND w.weblog = ?2</query> -->
-            <query>SELECT w.name FROM WeblogEntryTagAggregate w WHERE w.name IN (?1)
AND w.weblog = ?2</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getNameByNameIn&amp;WebsiteNull">
-            <!-- <query>SELECT DISTINCT w.name FROM WeblogEntryTagAggregate w WHERE
w.name IN (?1) AND w.weblog IS NULL</query> -->
-            <query>SELECT w.name FROM WeblogEntryTagAggregate w WHERE w.name IN (?1)
AND w.weblog IS NULL</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsite&amp;StartDate">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 AND w.lastUsed &gt;= ?2 GROUP BY w.name, w.total ORDER BY w.total DESC</query>
-        </named-query>
         <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsite">
             <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 GROUP BY w.name, w.total ORDER BY w.total DESC</query>
         </named-query>
-        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsiteNull&amp;StartDate">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL AND w.lastUsed &gt;= ?1 GROUP BY w.name, w.total ORDER BY w.total DESC</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsiteNull">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL GROUP BY w.name, w.total ORDER BY w.total DESC</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsite&amp;NameStartsWith">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 AND w.name LIKE ?2 GROUP BY w.name, w.total </query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsite">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 GROUP BY w.name, w.total</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsiteNull&amp;NameStartsWith">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL AND w.name LIKE ?2 GROUP BY w.name, w.total</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsiteNull">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL GROUP BY w.name, w.total</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsite&amp;NameStartsWithOrderByName">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 AND w.name LIKE ?2 GROUP BY w.name, w.total ORDER BY w.name</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsiteOrderByName">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 GROUP BY w.name, w.total ORDER BY w.name</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsiteNull&amp;NameStartsWithOrderByName">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL AND w.name LIKE ?2 GROUP BY w.name, w.total ORDER BY w.name</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.getTagsByWebsiteNullOrderByName">
-            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL GROUP BY w.name, w.total ORDER BY w.name</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.updateAddToTotalByName&amp;Weblog">
-            <query>UPDATE WeblogEntryTagAggregate w SET w.total = w.total + ?1, w.lastUsed
= ?2 WHERE w.name = ?3 AND w.weblog = ?4</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.updateAddToTotalByName&amp;WeblogNull">
-            <query>UPDATE WeblogEntryTagAggregate w SET w.total = w.total + ?1 WHERE
w.name = ?2 AND w.weblog IS NULL</query>
-        </named-query>
-        <named-query name="WeblogEntryTagAggregate.updateMinusFromTotalByName&amp;WeblogNull">
-            <query>UPDATE WeblogEntryTagAggregate w SET w.total = w.total - ?1 WHERE
w.name = ?2 AND w.weblog IS NULL</query>
+        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsite&amp;StartDate">
+            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog = ?1 AND w.lastUsed &gt;= ?2 GROUP BY w.name, w.total ORDER BY w.total DESC</query>
         </named-query>
         <named-query name="WeblogEntryTagAggregate.removeByTotalLessEqual">
             <query>DELETE FROM WeblogEntryTagAggregate w WHERE w.total &lt;= ?1</query>
@@ -72,8 +22,15 @@
         <named-query name="WeblogEntryTagAggregate.removeByWeblog">
             <query>DELETE FROM WeblogEntryTagAggregate w WHERE w.weblog = ?1</query>
         </named-query>
-
-
+        <named-query name="WeblogEntryTagAggregate.getByName&amp;WebsiteNullOrderByLastUsedDesc">
+            <query>SELECT w FROM WeblogEntryTagAggregate w WHERE w.name = ?1 AND w.weblog
IS NULL ORDER BY w.lastUsed DESC</query>
+        </named-query>
+        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsiteNull">
+            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL GROUP BY w.name, w.total ORDER BY w.total DESC</query>
+        </named-query>
+        <named-query name="WeblogEntryTagAggregate.getPopularTagsByWebsiteNull&amp;StartDate">
+            <query>SELECT w.name, SUM(w.total) FROM WeblogEntryTagAggregate w WHERE
w.weblog IS NULL AND w.lastUsed &gt;= ?1 GROUP BY w.name, w.total ORDER BY w.total DESC</query>
+        </named-query>
         <attributes>
             <id name="id">
                 <column name="id"/>

Modified: roller/trunk/app/src/main/resources/sql/createdb.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/createdb.vm?rev=1615466&r1=1615465&r2=1615466&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/createdb.vm (original)
+++ roller/trunk/app/src/main/resources/sql/createdb.vm Sun Aug  3 23:48:16 2014
@@ -31,7 +31,7 @@ create table userrole (
 );
 create index ur_username_idx on userrole( username$!db.INDEXSIZE );
 
-create table  roller_userattribute(
+create table roller_userattribute(
     id        varchar(48) not null primary key,
     username  varchar(255) not null,
     attrname  varchar(255) not null,
@@ -222,6 +222,7 @@ create table roller_weblogentrytagagg (
 create index weta_weblogid_idx on roller_weblogentrytagagg( websiteid );
 create index weta_name_idx on roller_weblogentrytagagg( name );
 create index weta_lastused_idx on roller_weblogentrytagagg( lastused );
+alter table roller_weblogentrytagagg add constraint weta_weblog_tag_uq unique ( websiteid,
name );
 
 create table newsfeed (
     id              varchar(48) not null primary key,



Mime
View raw message