Author: mbrohl
Date: Sat Sep 19 14:27:54 2015
New Revision: 1704043
URL: http://svn.apache.org/viewvc?rev=1704043&view=rev
Log:
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.
Modified:
ofbiz/trunk/framework/service/entitydef/entitymodel.xml
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
Modified: ofbiz/trunk/framework/service/entitydef/entitymodel.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/entitydef/entitymodel.xml?rev=1704043&r1=1704042&r2=1704043&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/service/entitydef/entitymodel.xml Sat Sep 19 14:27:54
2015
@@ -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"/>
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=1704043&r1=1704042&r2=1704043&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
Sat Sep 19 14:27:54 2015
@@ -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;
}
}