Applied patch for OFBIZ-6632: Incorrect comparison in TemporalExpressionWorker.java

This patch introduces some constants for the expression types and corrects the wrong comparison.

Thanks Vyom Jain for spotting this issue and Martin Becker for providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1704043 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Brohl
2015-09-19 14:27:54 +00:00
parent ab33193186
commit cd6eedc2c3
2 changed files with 13 additions and 8 deletions
+2 -2
View File
@@ -158,8 +158,8 @@ under the License.
<field name="fromTempExprId" type="id-ne"><description>The "parent" expression</description></field>
<field name="toTempExprId" type="id-ne"><description>The "child" expression</description></field>
<field name="exprAssocType" type="id"><description>Expression association type.
When applied to DIFFERENCE expression types, valid values are INCLUDED or EXCLUDED.
When applied to SUBSTITUTION expression types, valid values are INCLUDED, EXCLUDED, or SUBSTITUTE.
When applied to DIFFERENCE expression types, valid values are INCLUDE or EXCLUDE.
When applied to SUBSTITUTION expression types, valid values are INCLUDE, EXCLUDE, or SUBSTITUTE.
</description>
</field>
<prim-key field="fromTempExprId"/>
@@ -34,7 +34,7 @@ public class TemporalExpressionWorker {
public final static String module = TemporalExpressionWorker.class.getName();
// Temporal expression constants
// Temporal expression type constants
public final static String DateRange = "DATE_RANGE";
public final static String DayInMonth = "DAY_IN_MONTH";
public final static String DayOfMonthRange = "DAY_OF_MONTH_RANGE";
@@ -50,6 +50,11 @@ public class TemporalExpressionWorker {
public final static String ExpressionTypeList[] = {DateRange, DayInMonth, DayOfMonthRange, DayOfWeekRange,
Difference, Frequency, HourRange, Intersection, MinuteRange, MonthRange, Substitution, Union};
// Temporal expression assoc type constants
public final static String INCLUDE = "INCLUDE";
public final static String EXCLUDE = "EXCLUDE";
public final static String SUBSTITUTE = "SUBSTITUTE";
/** Get a <code>TemporalExpression</code> from persistent storage.
* @param delegator
* @param tempExprId
@@ -96,9 +101,9 @@ public class TemporalExpressionWorker {
GenericValue inclAssoc = null;
GenericValue exclAssoc = null;
for (GenericValue childExpression : childExpressions) {
if ("INCLUDE".equals(childExpression.get("exprAssocType"))) {
if (INCLUDE.equals(childExpression.get("exprAssocType"))) {
inclAssoc = childExpression;
} else if ("EXCLUDE".equals(childExpression.get("exprAssocType"))) {
} else if (EXCLUDE.equals(childExpression.get("exprAssocType"))) {
exclAssoc = childExpression;
}
}
@@ -121,11 +126,11 @@ public class TemporalExpressionWorker {
GenericValue exclAssoc = null;
GenericValue substAssoc = null;
for (GenericValue childExpression : childExpressions) {
if ("INCLUDE".equals(childExpression.get("exprAssocType"))) {
if (INCLUDE.equals(childExpression.get("exprAssocType"))) {
inclAssoc = childExpression;
} else if ("EXCLUDE".equals(childExpression.get("exprAssocType"))) {
} else if (EXCLUDE.equals(childExpression.get("exprAssocType"))) {
exclAssoc = childExpression;
} else if ("SUBSTITUTION".equals(childExpression.get("exprAssocType"))) {
} else if (SUBSTITUTE.equals(childExpression.get("exprAssocType"))) {
substAssoc = childExpression;
}
}