roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1571129 - in /roller/trunk/app/src/main: java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java java/org/apache/roller/weblogger/pojos/WeblogCategory.java resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml
Date Mon, 24 Feb 2014 02:43:24 GMT
Author: gmazza
Date: Mon Feb 24 02:43:24 2014
New Revision: 1571129

URL: http://svn.apache.org/r1571129
Log:
Partial, and not completely accurate, implementation of category positioning.  Presently off
when categories get deleted.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogCategory.java
    roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=1571129&r1=1571128&r2=1571129&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
Mon Feb 24 02:43:24 2014
@@ -308,7 +308,6 @@ public class JPAWeblogManagerImpl implem
             if (firstCat == null) {
                 firstCat = c;
             }
-            // TODO: Have weblog add category instead of latter in its constructor?
             this.strategy.store(c);
         }
 

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogCategory.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogCategory.java?rev=1571129&r1=1571128&r2=1571129&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogCategory.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogCategory.java Mon
Feb 24 02:43:24 2014
@@ -46,6 +46,7 @@ public class WeblogCategory implements S
     private String name = null;
     private String description = null;
     private String image = null;
+    private int position;
 
     // associations
     private Weblog weblog = null;
@@ -65,6 +66,7 @@ public class WeblogCategory implements S
         
         this.weblog = weblog;
         weblog.getWeblogCategories().add(this);
+        this.position = weblog.getWeblogCategories().size();
     }
     
     
@@ -145,8 +147,20 @@ public class WeblogCategory implements S
     public void setDescription(String description) {
         this.description = description;
     }
-    
-    
+
+    /**
+     * A 1-based position indicator for desired display order of that category.
+     * Value of 0 indicates no ordering yet assigned.
+     * New categories are always placed at the end of the list.
+     */
+    public int getPosition() {
+        return position;
+    }
+
+    public void setPosition(int position) {
+        this.position = position;
+    }
+
     /**
      * An image icon to represent this category.
      */

Modified: roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml?rev=1571129&r1=1571128&r2=1571129&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml
(original)
+++ roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml
Mon Feb 24 02:43:24 2014
@@ -8,7 +8,7 @@
             class="org.apache.roller.weblogger.pojos.WeblogCategory" access="PROPERTY">
         <table name="weblogcategory"/>
         <named-query name="WeblogCategory.getByWeblog">
-                <query>SELECT w FROM WeblogCategory w WHERE w.weblog = ?1</query>
+            <query>SELECT w FROM WeblogCategory w WHERE w.weblog = ?1 order by w.position</query>
         </named-query>
         <named-query name="WeblogCategory.getByWeblog&amp;Name">
             <query>SELECT w FROM WeblogCategory w WHERE w.weblog = ?1 AND w.name =
?2</query>
@@ -29,6 +29,9 @@
             <basic name="image">
                 <column name="image" insertable="true" updatable="true" unique="false"/>
             </basic>
+            <basic name="position">
+                <column name="position" insertable="true" updatable="true" unique="false"/>
+            </basic>
             <many-to-one name="weblog" target-entity="org.apache.roller.weblogger.pojos.Weblog">
                 <join-column name="websiteid" insertable="true" updatable="true" nullable="false"/>
             </many-to-one>



Mime
View raw message