Files
ofbiz-framework/framework/entity
Jacques Le Roux 7a9e80e6ef A patch from Leon "Trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another" https://issues.apache.org/jira/browse/OFBIZ-4321
In view entity definition, we can use <condition-expr> to create a filter condition between field and some value using specific operator. It should be also possible to make condition between field and rel-field through some kind operator. Such as:

<view-entity entity-name="xxx" package-name="xxx">
        ...
        <entity-condition>
            <condition-expr entity-alias="A" field-name="a" operator="equals" rel-entity-alias="B" rel-field-name="b"  />
        </entity-condition>
    </view-entity>

But there's a trivial defect in current ModelViewEntity which prevent this case working.

} else if ( value == null && (operator.equals(EntityOperator.EQUALS) || operator.equals(EntityOperator.NOT_EQUAL))) {
                return EntityCondition.makeCondition(lhs, UtilGenerics.<EntityComparisonOperator<?,?>>cast(operator), null);
            } else {

In the above code extracted from ModelViewEntity, it does not consider the condition that the relField could be defined when value==null.

JLR:I checked that || should not be used in <<value == null && this.relFieldName>>, it was not obvious to me but is correct

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1137201 13f79535-47bb-0310-9956-ffa450edef68
2011-06-18 15:17:22 +00:00
..
2010-03-17 17:28:01 +00:00