svn commit: r883137 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/sql/ sql/src/org/ofbiz/sql/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r883137 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/sql/ sql/src/org/ofbiz/sql/

doogie-3
Author: doogie
Date: Sun Nov 22 20:06:34 2009
New Revision: 883137

URL: http://svn.apache.org/viewvc?rev=883137&view=rev
Log:
Plans that have condition objects now store those in the abstract classes.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/DeletePlan.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SelectPlan.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/UpdatePlan.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java Sun Nov 22 20:06:34 2009
@@ -18,7 +18,12 @@
  */
 package org.ofbiz.entity.sql;
 
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.sql.ConditionPlan;
 import org.ofbiz.sql.DeletePlan;
 
-public class EntityDeletePlan extends DeletePlan<EntityDeletePlan> {
+public class EntityDeletePlan extends DeletePlan<EntityDeletePlan, EntityCondition> {
+    public EntityDeletePlan(ConditionPlan<EntityCondition> wherePlan) {
+        super(wherePlan);
+    }
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java Sun Nov 22 20:06:34 2009
@@ -41,18 +41,15 @@
 import org.ofbiz.sql.ConditionPlan;
 import org.ofbiz.sql.ParameterizedConditionException;
 
-public final class EntitySelectPlan extends SelectPlan<EntitySelectPlan> {
+public final class EntitySelectPlan extends SelectPlan<EntitySelectPlan, EntityCondition> {
     private final DynamicViewEntity dve;
-    private final ConditionPlan<EntityCondition> wherePlan;
-    private final ConditionPlan<EntityCondition> havingPlan;
     private final List<String> orderBy;
     private final int offset = -1;
     private final int limit = -1;
 
     public EntitySelectPlan(DynamicViewEntity dve, ConditionPlan<EntityCondition> wherePlan, ConditionPlan<EntityCondition> havingPlan, List<String> orderBy) {
+        super(wherePlan, havingPlan);
         this.dve = dve;
-        this.wherePlan = wherePlan;
-        this.havingPlan = havingPlan;
         this.orderBy = orderBy;
         //this.offset = offset;
         //this.limit = limit;
@@ -62,8 +59,8 @@
         EntityCondition whereCondition;
         EntityCondition havingCondition;
         try {
-            whereCondition = wherePlan.getCondition(params);
-            havingCondition = havingPlan.getCondition(params);
+            whereCondition = getWherePlan().getCondition(params);
+            havingCondition = getHavingPlan().getCondition(params);
         } catch (ParameterizedConditionException e) {
             throw (GenericEntityException) new GenericEntityException(e.getMessage()).initCause(e);
         }
@@ -74,14 +71,6 @@
         return dve;
     }
 
-    public ConditionPlan<EntityCondition> getWherePlan() {
-        return wherePlan;
-    }
-
-    public ConditionPlan<EntityCondition> getHavingPlan() {
-        return havingPlan;
-    }
-
     public List<String> getOrderBy() {
         return orderBy;
     }
@@ -96,16 +85,16 @@
 
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("dve=" + dve);
-        if (wherePlan != null) {
+        if (getWherePlan() != null) {
             if (sb.length() > 0) sb.append(", ");
             sb.append("where=(");
-            wherePlan.appendTo(sb);
+            getWherePlan().appendTo(sb);
             sb.append(")");
         }
-        if (havingPlan != null) {
+        if (getHavingPlan() != null) {
             if (sb.length() > 0) sb.append(", ");
             sb.append("having=(");
-            havingPlan.appendTo(sb);
+            getHavingPlan().appendTo(sb);
             sb.append(")");
         }
         if (offset != -1) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java Sun Nov 22 20:06:34 2009
@@ -18,7 +18,12 @@
  */
 package org.ofbiz.entity.sql;
 
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.sql.ConditionPlan;
 import org.ofbiz.sql.UpdatePlan;
 
-public class EntityUpdatePlan extends UpdatePlan<EntityUpdatePlan> {
+public class EntityUpdatePlan extends UpdatePlan<EntityUpdatePlan, EntityCondition> {
+    public EntityUpdatePlan(ConditionPlan<EntityCondition> wherePlan) {
+        super(wherePlan);
+    }
 }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/DeletePlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/DeletePlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/DeletePlan.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/DeletePlan.java Sun Nov 22 20:06:34 2009
@@ -18,5 +18,14 @@
  */
 package org.ofbiz.sql;
 
-public abstract class DeletePlan<P extends DeletePlan<P>> extends SQLPlan<P> {
+public abstract class DeletePlan<P extends DeletePlan<P, C>, C> extends SQLPlan<P> {
+    private final ConditionPlan<C> wherePlan;
+
+    protected DeletePlan(ConditionPlan<C> wherePlan) {
+        this.wherePlan = wherePlan;
+    }
+
+    public ConditionPlan<C> getWherePlan() {
+        return wherePlan;
+    }
 }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Main.java Sun Nov 22 20:06:34 2009
@@ -71,16 +71,25 @@
     private final static class DebugCondition {
     }
 
-    private final static class DebugDeletePlan extends DeletePlan<DebugDeletePlan> {
+    private final static class DebugDeletePlan extends DeletePlan<DebugDeletePlan, DebugCondition> {
+        protected DebugDeletePlan(ConditionPlan<DebugCondition> wherePlan) {
+            super(wherePlan);
+        }
     }
 
     private final static class DebugInsertPlan extends InsertPlan<DebugInsertPlan> {
     }
 
-    private final static class DebugSelectPlan extends SelectPlan<DebugSelectPlan> {
+    private final static class DebugSelectPlan extends SelectPlan<DebugSelectPlan, DebugCondition> {
+        protected DebugSelectPlan(ConditionPlan<DebugCondition> wherePlan, ConditionPlan<DebugCondition> havingPlan) {
+            super(wherePlan, havingPlan);
+        }
     }
 
-    private final static class DebugUpdatePlan extends UpdatePlan<DebugUpdatePlan> {
+    private final static class DebugUpdatePlan extends UpdatePlan<DebugUpdatePlan, DebugCondition> {
+        protected DebugUpdatePlan(ConditionPlan<DebugCondition> wherePlan) {
+            super(wherePlan);
+        }
     }
 
     private final static class DebugViewPlan extends ViewPlan<DebugViewPlan> {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java Sun Nov 22 20:06:34 2009
@@ -18,7 +18,7 @@
  */
 package org.ofbiz.sql;
 
-public abstract class Planner<P extends Planner<P, C, D, I, S, U, V>, C, D extends DeletePlan<D>, I extends InsertPlan<I>, S extends SelectPlan<S>, U extends UpdatePlan<U>, V extends ViewPlan<V>> {
+public abstract class Planner<P extends Planner<P, C, D, I, S, U, V>, C, D extends DeletePlan<D, C>, I extends InsertPlan<I>, S extends SelectPlan<S, C>, U extends UpdatePlan<U, C>, V extends ViewPlan<V>> {
     private final ConditionPlanner<C> conditionPlanner;
 
     protected Planner(ConditionPlanner<C> conditionPlanner) {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SelectPlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SelectPlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SelectPlan.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SelectPlan.java Sun Nov 22 20:06:34 2009
@@ -18,5 +18,20 @@
  */
 package org.ofbiz.sql;
 
-public abstract class SelectPlan<P extends SelectPlan<P>> extends SQLPlan<P> {
+public abstract class SelectPlan<P extends SelectPlan<P, C>, C> extends SQLPlan<P> {
+    private final ConditionPlan<C> wherePlan;
+    private final ConditionPlan<C> havingPlan;
+
+    protected SelectPlan(ConditionPlan<C> wherePlan, ConditionPlan<C> havingPlan) {
+        this.wherePlan = wherePlan;
+        this.havingPlan = havingPlan;
+    }
+
+    public ConditionPlan<C> getWherePlan() {
+        return wherePlan;
+    }
+
+    public ConditionPlan<C> getHavingPlan() {
+        return havingPlan;
+    }
 }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/UpdatePlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/UpdatePlan.java?rev=883137&r1=883136&r2=883137&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/UpdatePlan.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/UpdatePlan.java Sun Nov 22 20:06:34 2009
@@ -18,5 +18,14 @@
  */
 package org.ofbiz.sql;
 
-public abstract class UpdatePlan<P extends UpdatePlan<P>> extends SQLPlan<P> {
+public abstract class UpdatePlan<P extends UpdatePlan<P, C>, C> extends SQLPlan<P> {
+    private final ConditionPlan<C> wherePlan;
+
+    protected UpdatePlan(ConditionPlan<C> wherePlan) {
+        this.wherePlan = wherePlan;
+    }
+
+    public ConditionPlan<C> getWherePlan() {
+        return wherePlan;
+    }
 }