[jira] [Created] (OFBIZ-4321) trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another

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

[jira] [Created] (OFBIZ-4321) trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another

Nicolas Malin (Jira)
trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another
------------------------------------------------------------------------------------------------------------------------------------

                 Key: OFBIZ-4321
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4321
             Project: OFBiz
          Issue Type: Bug
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Leon
            Priority: Minor
             Fix For: SVN trunk


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:

{code:xml}
<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>
{code}

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

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

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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4321) trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leon updated OFBIZ-4321:
------------------------

    Attachment: ModelViewEntity.patch

> trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4321
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4321
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: ModelViewEntity.patch
>
>
> 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:
> {code:xml}
> <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>
> {code}
> But there's a trivial defect in current ModelViewEntity which prevent this case working.
> {code:java}
>             } else if ( value == null && (operator.equals(EntityOperator.EQUALS) || operator.equals(EntityOperator.NOT_EQUAL))) {
>                 return EntityCondition.makeCondition(lhs, UtilGenerics.<EntityComparisonOperator<?,?>>cast(operator), null);
>             } else {
> {code}
> In the above code extracted from ModelViewEntity, it does not consider the condition that the relField could be defined when value==null.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (OFBIZ-4321) trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-4321.
----------------------------------

       Resolution: Fixed
    Fix Version/s: Release Branch 11.04
                   Release Branch 10.04
         Assignee: Jacques Le Roux

Thanks Leon,

Well spotted, you patch is in
* trunk at r1137201
* R11.04 at r1137206.
* R10.04 at r1137207  


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



> trivial patch to ModelViewEntity class to make view entity able to handle entity condition between field from one entity and another
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4321
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4321
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: Release Branch 10.04, Release Branch 11.04, SVN trunk
>
>         Attachments: ModelViewEntity.patch
>
>
> 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:
> {code:xml}
> <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>
> {code}
> But there's a trivial defect in current ModelViewEntity which prevent this case working.
> {code:java}
>             } else if ( value == null && (operator.equals(EntityOperator.EQUALS) || operator.equals(EntityOperator.NOT_EQUAL))) {
>                 return EntityCondition.makeCondition(lhs, UtilGenerics.<EntityComparisonOperator<?,?>>cast(operator), null);
>             } else {
> {code}
> In the above code extracted from ModelViewEntity, it does not consider the condition that the relField could be defined when value==null.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira