[jira] Created: (OFBIZ-3875) Introduce an in operator for compare in minilang

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

[jira] Created: (OFBIZ-3875) Introduce an in operator for compare in minilang

Nicolas Malin (Jira)
Introduce an in operator for compare in minilang
------------------------------------------------

                 Key: OFBIZ-3875
                 URL: https://issues.apache.org/jira/browse/OFBIZ-3875
             Project: OFBiz
          Issue Type: New Feature
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Jacques Le Roux
            Assignee: Jacques Le Roux
            Priority: Minor


It could be convenient to have an "in" operator for compare in minlange. Here is a patch, if nobody see any problems with it, nor have a better solution I will commit it in some days.



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-3875) Introduce an in operator for compare in minilang

Nicolas Malin (Jira)

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

Jacques Le Roux updated OFBIZ-3875:
-----------------------------------

    Attachment: in for compare.patch

> Introduce an in operator for compare in minilang
> ------------------------------------------------
>
>                 Key: OFBIZ-3875
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3875
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: in for compare.patch
>
>
> It could be convenient to have an "in" operator for compare in minlange. Here is a patch, if nobody see any problems with it, nor have a better solution I will commit it in some days.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-3875) Introduce an in operator for compare in minilang

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

    [ https://issues.apache.org/jira/browse/OFBIZ-3875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892157#action_12892157 ]

Scott Gray commented on OFBIZ-3875:
-----------------------------------

The appropriate format for converting a String to a List is: [value1, value2, value3, ...]
There is a converter for this so you only need to call simpleTypeConvert() with the appropriate target type instead of attempting to perform the conversion manually.

Have you tested the comparison's behavior when value2 doesn't resolve to a Collection?

> Introduce an in operator for compare in minilang
> ------------------------------------------------
>
>                 Key: OFBIZ-3875
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3875
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: in for compare.patch
>
>
> It could be convenient to have an "in" operator for compare in minlange. Here is a patch, if nobody see any problems with it, nor have a better solution I will commit it in some days.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-3875) Introduce an in operator for compare in minilang

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

    [ https://issues.apache.org/jira/browse/OFBIZ-3875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892224#action_12892224 ]

Jacques Le Roux commented on OFBIZ-3875:
----------------------------------------

Thanks for the tip Scott,

I only looked at simpleTypeConvert javadoc which says
{quote}
Supported types
     * include: String, Boolean, Double, Float, Long, Integer, Date (java.sql.Date),
     * Time, Timestamp, TimeZone;
{quote}
So I did my own.

When you say the format should be [value1, value2, value3, ...] do you mean formally, ie should we put also the square brackets? Because I'd like this to be consistent with what we currently have in other places (ie "val1,val2,val3")

Currently the comparison's behavior is to not compare when value2 doesn't resolve to a Collection. For instance for "CASH" The message returned is eg:
{quote}
Error with comparison in if-compare between field [.parameters.paymentMethodTypeId] with value [CASH] and value [CASH] with operator [in] and type [String]:
Specified compare operator "in" not known.
{quote}

I also tried cases like ",", ",CASH" ",,CASH" ,"CASH,,"  "CASH,,CHECK" without issues (1st rejected, 2d OK, 3d OK, 4th OK, 5thOK). I think it's strong enough...

> Introduce an in operator for compare in minilang
> ------------------------------------------------
>
>                 Key: OFBIZ-3875
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3875
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: in for compare.patch
>
>
> It could be convenient to have an "in" operator for compare in minlange. Here is a patch, if nobody see any problems with it, nor have a better solution I will commit it in some days.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-3875) Introduce an in operator for compare in minilang

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

    [ https://issues.apache.org/jira/browse/OFBIZ-3875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892448#action_12892448 ]

Scott Gray commented on OFBIZ-3875:
-----------------------------------

The javadoc is probably out of date now that it is uses the conversion framework.  The converter is CollectionConverters.StringToList and calls StringUtil.toList(Object) and yes the format is exactly as I described with the square brackets indicating a list and commas with a trailing space separating the items.  Here is an example that works right now:
{quote}
<set field="testList" value="[CASH, CHECK]" type="List"/>
{quote}

If we are only capable of doing an "in" comparison on a collection then we should probably return a more suitable error message when value2 doesn't resolve to one.  The current error message would leave me scratching my head.

> Introduce an in operator for compare in minilang
> ------------------------------------------------
>
>                 Key: OFBIZ-3875
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3875
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: in for compare.patch
>
>
> It could be convenient to have an "in" operator for compare in minlange. Here is a patch, if nobody see any problems with it, nor have a better solution I will commit it in some days.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.