diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java index e08725a0df..1dbe389efc 100644 --- a/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java +++ b/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java @@ -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 { +public class EntityDeletePlan extends DeletePlan { + public EntityDeletePlan(ConditionPlan wherePlan) { + super(wherePlan); + } } diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java index 693fd9e535..4421ae2fa9 100644 --- a/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java +++ b/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java @@ -41,18 +41,15 @@ import org.ofbiz.sql.SelectPlan; import org.ofbiz.sql.ConditionPlan; import org.ofbiz.sql.ParameterizedConditionException; -public final class EntitySelectPlan extends SelectPlan { +public final class EntitySelectPlan extends SelectPlan { private final DynamicViewEntity dve; - private final ConditionPlan wherePlan; - private final ConditionPlan havingPlan; private final List orderBy; private final int offset = -1; private final int limit = -1; public EntitySelectPlan(DynamicViewEntity dve, ConditionPlan wherePlan, ConditionPlan havingPlan, List 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 @@ public final class EntitySelectPlan extends SelectPlan { 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 @@ public final class EntitySelectPlan extends SelectPlan { return dve; } - public ConditionPlan getWherePlan() { - return wherePlan; - } - - public ConditionPlan getHavingPlan() { - return havingPlan; - } - public List getOrderBy() { return orderBy; } @@ -96,16 +85,16 @@ public final class EntitySelectPlan extends SelectPlan { 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) { diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java index 13f6dab682..45e8ffbfa5 100644 --- a/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java +++ b/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java @@ -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 { +public class EntityUpdatePlan extends UpdatePlan { + public EntityUpdatePlan(ConditionPlan wherePlan) { + super(wherePlan); + } } diff --git a/framework/sql/src/org/ofbiz/sql/DeletePlan.java b/framework/sql/src/org/ofbiz/sql/DeletePlan.java index a0f405cf30..51e90e0c9b 100644 --- a/framework/sql/src/org/ofbiz/sql/DeletePlan.java +++ b/framework/sql/src/org/ofbiz/sql/DeletePlan.java @@ -18,5 +18,14 @@ */ package org.ofbiz.sql; -public abstract class DeletePlan

> extends SQLPlan

{ +public abstract class DeletePlan

, C> extends SQLPlan

{ + private final ConditionPlan wherePlan; + + protected DeletePlan(ConditionPlan wherePlan) { + this.wherePlan = wherePlan; + } + + public ConditionPlan getWherePlan() { + return wherePlan; + } } diff --git a/framework/sql/src/org/ofbiz/sql/Main.java b/framework/sql/src/org/ofbiz/sql/Main.java index 95a75c128f..e8c28dfc71 100644 --- a/framework/sql/src/org/ofbiz/sql/Main.java +++ b/framework/sql/src/org/ofbiz/sql/Main.java @@ -71,16 +71,25 @@ public final class Main { private final static class DebugCondition { } - private final static class DebugDeletePlan extends DeletePlan { + private final static class DebugDeletePlan extends DeletePlan { + protected DebugDeletePlan(ConditionPlan wherePlan) { + super(wherePlan); + } } private final static class DebugInsertPlan extends InsertPlan { } - private final static class DebugSelectPlan extends SelectPlan { + private final static class DebugSelectPlan extends SelectPlan { + protected DebugSelectPlan(ConditionPlan wherePlan, ConditionPlan havingPlan) { + super(wherePlan, havingPlan); + } } - private final static class DebugUpdatePlan extends UpdatePlan { + private final static class DebugUpdatePlan extends UpdatePlan { + protected DebugUpdatePlan(ConditionPlan wherePlan) { + super(wherePlan); + } } private final static class DebugViewPlan extends ViewPlan { diff --git a/framework/sql/src/org/ofbiz/sql/Planner.java b/framework/sql/src/org/ofbiz/sql/Planner.java index 85913821d2..14683c374a 100644 --- a/framework/sql/src/org/ofbiz/sql/Planner.java +++ b/framework/sql/src/org/ofbiz/sql/Planner.java @@ -18,7 +18,7 @@ */ package org.ofbiz.sql; -public abstract class Planner

, C, D extends DeletePlan, I extends InsertPlan, S extends SelectPlan, U extends UpdatePlan, V extends ViewPlan> { +public abstract class Planner

, C, D extends DeletePlan, I extends InsertPlan, S extends SelectPlan, U extends UpdatePlan, V extends ViewPlan> { private final ConditionPlanner conditionPlanner; protected Planner(ConditionPlanner conditionPlanner) { diff --git a/framework/sql/src/org/ofbiz/sql/SelectPlan.java b/framework/sql/src/org/ofbiz/sql/SelectPlan.java index 1bab7c479e..bd1747b8f0 100644 --- a/framework/sql/src/org/ofbiz/sql/SelectPlan.java +++ b/framework/sql/src/org/ofbiz/sql/SelectPlan.java @@ -18,5 +18,20 @@ */ package org.ofbiz.sql; -public abstract class SelectPlan

> extends SQLPlan

{ +public abstract class SelectPlan

, C> extends SQLPlan

{ + private final ConditionPlan wherePlan; + private final ConditionPlan havingPlan; + + protected SelectPlan(ConditionPlan wherePlan, ConditionPlan havingPlan) { + this.wherePlan = wherePlan; + this.havingPlan = havingPlan; + } + + public ConditionPlan getWherePlan() { + return wherePlan; + } + + public ConditionPlan getHavingPlan() { + return havingPlan; + } } diff --git a/framework/sql/src/org/ofbiz/sql/UpdatePlan.java b/framework/sql/src/org/ofbiz/sql/UpdatePlan.java index 81b6e42e9e..7f6ba706a9 100644 --- a/framework/sql/src/org/ofbiz/sql/UpdatePlan.java +++ b/framework/sql/src/org/ofbiz/sql/UpdatePlan.java @@ -18,5 +18,14 @@ */ package org.ofbiz.sql; -public abstract class UpdatePlan

> extends SQLPlan

{ +public abstract class UpdatePlan

, C> extends SQLPlan

{ + private final ConditionPlan wherePlan; + + protected UpdatePlan(ConditionPlan wherePlan) { + this.wherePlan = wherePlan; + } + + public ConditionPlan getWherePlan() { + return wherePlan; + } }