You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/06/13 11:55:27 UTC

svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Author: jleroux
Date: Fri Jun 13 02:55:27 2008
New Revision: 667448

URL: http://svn.apache.org/viewvc?rev=667448&view=rev
Log:
My 1st bsh->groovy migration, please check. I will change the file name (uppercase className) remotely as I'm working on Windows currently (files names case insensitive)

Modified:
    ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy (original)
+++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy Fri Jun 13 02:55:27 2008
@@ -18,30 +18,27 @@
  */
 
 import java.util.TreeSet;
-import javolution.util.FastList;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityFieldValue;
 import org.ofbiz.entity.condition.EntityFunction;
 import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
 
-delegator = request.getAttribute("delegator");
 
-andExprs = FastList.newInstance();
-fieldValue = request.getParameter("exampleFeatureId");
-if (UtilValidate.isNotEmpty(fieldValue)) {
+andExprs = [];
+fieldValue = parameters.exampleFeatureId;
+if (fieldValue) {
     andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
             EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
 }
 
-List autocompleteOptions = null;
-if (andExprs.size() > 0) {
+autocompleteOptions = [];
+if (andExprs) {
     entityConditionList = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-    autocompleteOptions = delegator.findList("ExampleFeature", entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId", "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
-    //context.put("autocompleteOptions", autocompleteOptions);
+    autocompleteOptions = delegator.findList("ExampleFeature", entityConditionList, 
+            new TreeSet(['exampleFeatureId', 'description'], ['-exampleFeatureId'], null, false);
+    //context.autocompleteOptions = autocompleteOptions;
 	request.setAttribute("autocompleteOptions", autocompleteOptions);
 }
 return "success";
\ No newline at end of file



Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
Jacques, Everything looks perfect to me.

+1.


On Fri, Jun 13, 2008 at 5:55 AM, <jl...@apache.org> wrote:

> Author: jleroux
> Date: Fri Jun 13 02:55:27 2008
> New Revision: 667448
>
> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
> Log:
> My 1st bsh->groovy migration, please check. I will change the file name
> (uppercase className) remotely as I'm working on Windows currently (files
> names case insensitive)
>
> Modified:
>
>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>
> Modified:
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> (original)
> +++
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> Fri Jun 13 02:55:27 2008
> @@ -18,30 +18,27 @@
>  */
>
>  import java.util.TreeSet;
> -import javolution.util.FastList;
>  import org.ofbiz.entity.condition.EntityCondition;
>  import org.ofbiz.entity.condition.EntityConditionList;
>  import org.ofbiz.entity.condition.EntityExpr;
>  import org.ofbiz.entity.condition.EntityFieldValue;
>  import org.ofbiz.entity.condition.EntityFunction;
>  import org.ofbiz.entity.condition.EntityOperator;
> -import org.ofbiz.base.util.UtilMisc;
> -import org.ofbiz.base.util.UtilValidate;
>
> -delegator = request.getAttribute("delegator");
>
> -andExprs = FastList.newInstance();
> -fieldValue = request.getParameter("exampleFeatureId");
> -if (UtilValidate.isNotEmpty(fieldValue)) {
> +andExprs = [];
> +fieldValue = parameters.exampleFeatureId;
> +if (fieldValue) {
>
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
>             EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
>  }
>
> -List autocompleteOptions = null;
> -if (andExprs.size() > 0) {
> +autocompleteOptions = [];
> +if (andExprs) {
>     entityConditionList = EntityCondition.makeCondition(andExprs,
> EntityOperator.AND);
> -    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
> -    //context.put("autocompleteOptions", autocompleteOptions);
> +    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList,
> +            new TreeSet(['exampleFeatureId', 'description'],
> ['-exampleFeatureId'], null, false);
> +    //context.autocompleteOptions = autocompleteOptions;
>        request.setAttribute("autocompleteOptions", autocompleteOptions);
>  }
>  return "success";
> \ No newline at end of file
>
>
>

Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
Oops I missed closing braces :(
Thanks Scott for catching that.

--
Ashish

On Fri, Jun 13, 2008 at 6:04 AM, Scott Gray <le...@gmail.com> wrote:

> Hi Jacques
>
> Looks good except for one thing:
> +    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList,
> +            new TreeSet(['exampleFeatureId', 'description'],
> ['-exampleFeatureId'], null, false);
> Introduces a bug, there is no closing bracket for the TreeSet.  Also
> instead
> of using a TreeSet you can do this:
> ['exampleFeatureId', 'description'] as Set
>
> Regards
> Scott
>
> 2008/6/13 <jl...@apache.org>:
>
> > Author: jleroux
> > Date: Fri Jun 13 02:55:27 2008
> > New Revision: 667448
> >
> > URL: http://svn.apache.org/viewvc?rev=667448&view=rev
> > Log:
> > My 1st bsh->groovy migration, please check. I will change the file name
> > (uppercase className) remotely as I'm working on Windows currently (files
> > names case insensitive)
> >
> > Modified:
> >
> >
>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> >
> > Modified:
> >
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> > Fri Jun 13 02:55:27 2008
> > @@ -18,30 +18,27 @@
> >  */
> >
> >  import java.util.TreeSet;
> > -import javolution.util.FastList;
> >  import org.ofbiz.entity.condition.EntityCondition;
> >  import org.ofbiz.entity.condition.EntityConditionList;
> >  import org.ofbiz.entity.condition.EntityExpr;
> >  import org.ofbiz.entity.condition.EntityFieldValue;
> >  import org.ofbiz.entity.condition.EntityFunction;
> >  import org.ofbiz.entity.condition.EntityOperator;
> > -import org.ofbiz.base.util.UtilMisc;
> > -import org.ofbiz.base.util.UtilValidate;
> >
> > -delegator = request.getAttribute("delegator");
> >
> > -andExprs = FastList.newInstance();
> > -fieldValue = request.getParameter("exampleFeatureId");
> > -if (UtilValidate.isNotEmpty(fieldValue)) {
> > +andExprs = [];
> > +fieldValue = parameters.exampleFeatureId;
> > +if (fieldValue) {
> >
> >
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
> >             EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
> >  }
> >
> > -List autocompleteOptions = null;
> > -if (andExprs.size() > 0) {
> > +autocompleteOptions = [];
> > +if (andExprs) {
> >     entityConditionList = EntityCondition.makeCondition(andExprs,
> > EntityOperator.AND);
> > -    autocompleteOptions = delegator.findList("ExampleFeature",
> > entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
> > "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
> > -    //context.put("autocompleteOptions", autocompleteOptions);
> > +    autocompleteOptions = delegator.findList("ExampleFeature",
> > entityConditionList,
> > +            new TreeSet(['exampleFeatureId', 'description'],
> > ['-exampleFeatureId'], null, false);
> > +    //context.autocompleteOptions = autocompleteOptions;
> >        request.setAttribute("autocompleteOptions", autocompleteOptions);
> >  }
> >  return "success";
> > \ No newline at end of file
> >
> >
> >
>

Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Jacques Le Roux <ja...@les7arts.com>.
Yes sorry Scott,

This time it's more my fat fingers than Windows ;o)

Jacques

PS : Actually I just bought a Dell 530 with Ubuntu (really affordable) , but I can't find the time to migrate "all" to it. I guess 
at 1st I will simply plug my disks. It's a pity because I have completly enough of Windows :(

From: "Ashish Vijaywargiya" <vi...@gmail.com>
>I think it looks like "Windows Side effect" :-)
>
> --
> Ashish
>
> On Fri, Jun 13, 2008 at 9:52 AM, Vikas Mayur <vi...@gmail.com> wrote:
>
>> Jacques, Looks like Scott name is in french :)
>>
>> Vikas
>>
>> On Fri, Jun 13, 2008 at 6:54 PM, Jacques Le Roux <
>> jacques.le.roux@les7arts.com> wrote:
>>
>> > Thanks for the Set tip Scoot,
>> >
>> > Jacques
>> >
>> > From: "Scott Gray" <le...@gmail.com>
>> >
>> >  Hi Jacques
>> >>
>> >> Looks good except for one thing:
>> >> +    autocompleteOptions = delegator.findList("ExampleFeature",
>> >> entityConditionList,
>> >> +            new TreeSet(['exampleFeatureId', 'description'],
>> >> ['-exampleFeatureId'], null, false);
>> >> Introduces a bug, there is no closing bracket for the TreeSet.  Also
>> >> instead
>> >> of using a TreeSet you can do this:
>> >> ['exampleFeatureId', 'description'] as Set
>> >>
>> >> Regards
>> >> Scott
>> >>
>> >> 2008/6/13 <jl...@apache.org>:
>> >>
>> >>  Author: jleroux
>> >>> Date: Fri Jun 13 02:55:27 2008
>> >>> New Revision: 667448
>> >>>
>> >>> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
>> >>> Log:
>> >>> My 1st bsh->groovy migration, please check. I will change the file name
>> >>> (uppercase className) remotely as I'm working on Windows currently
>> (files
>> >>> names case insensitive)
>> >>>
>> >>> Modified:
>> >>>
>> >>>
>> >>>
>>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> >>>
>> >>> Modified:
>> >>>
>> >>>
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> >>> URL:
>> >>>
>> >>>
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
>> >>>
>> >>>
>> >>>
>> ==============================================================================
>> >>> ---
>> >>>
>> >>>
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> >>> (original)
>> >>> +++
>> >>>
>> >>>
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> >>> Fri Jun 13 02:55:27 2008
>> >>> @@ -18,30 +18,27 @@
>> >>>  */
>> >>>
>> >>>  import java.util.TreeSet;
>> >>> -import javolution.util.FastList;
>> >>>  import org.ofbiz.entity.condition.EntityCondition;
>> >>>  import org.ofbiz.entity.condition.EntityConditionList;
>> >>>  import org.ofbiz.entity.condition.EntityExpr;
>> >>>  import org.ofbiz.entity.condition.EntityFieldValue;
>> >>>  import org.ofbiz.entity.condition.EntityFunction;
>> >>>  import org.ofbiz.entity.condition.EntityOperator;
>> >>> -import org.ofbiz.base.util.UtilMisc;
>> >>> -import org.ofbiz.base.util.UtilValidate;
>> >>>
>> >>> -delegator = request.getAttribute("delegator");
>> >>>
>> >>> -andExprs = FastList.newInstance();
>> >>> -fieldValue = request.getParameter("exampleFeatureId");
>> >>> -if (UtilValidate.isNotEmpty(fieldValue)) {
>> >>> +andExprs = [];
>> >>> +fieldValue = parameters.exampleFeatureId;
>> >>> +if (fieldValue) {
>> >>>
>> >>>
>> >>>
>> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
>> >>>            EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
>> >>>  }
>> >>>
>> >>> -List autocompleteOptions = null;
>> >>> -if (andExprs.size() > 0) {
>> >>> +autocompleteOptions = [];
>> >>> +if (andExprs) {
>> >>>    entityConditionList = EntityCondition.makeCondition(andExprs,
>> >>> EntityOperator.AND);
>> >>> -    autocompleteOptions = delegator.findList("ExampleFeature",
>> >>> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
>> >>> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
>> >>> -    //context.put("autocompleteOptions", autocompleteOptions);
>> >>> +    autocompleteOptions = delegator.findList("ExampleFeature",
>> >>> entityConditionList,
>> >>> +            new TreeSet(['exampleFeatureId', 'description'],
>> >>> ['-exampleFeatureId'], null, false);
>> >>> +    //context.autocompleteOptions = autocompleteOptions;
>> >>>       request.setAttribute("autocompleteOptions", autocompleteOptions);
>> >>>  }
>> >>>  return "success";
>> >>> \ No newline at end of file
>> >>>
>> >>>
>> >>>
>> >>>
>> >>
>> >
>>
> 


Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
I think it looks like "Windows Side effect" :-)

--
Ashish

On Fri, Jun 13, 2008 at 9:52 AM, Vikas Mayur <vi...@gmail.com> wrote:

> Jacques, Looks like Scott name is in french :)
>
> Vikas
>
> On Fri, Jun 13, 2008 at 6:54 PM, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
> > Thanks for the Set tip Scoot,
> >
> > Jacques
> >
> > From: "Scott Gray" <le...@gmail.com>
> >
> >  Hi Jacques
> >>
> >> Looks good except for one thing:
> >> +    autocompleteOptions = delegator.findList("ExampleFeature",
> >> entityConditionList,
> >> +            new TreeSet(['exampleFeatureId', 'description'],
> >> ['-exampleFeatureId'], null, false);
> >> Introduces a bug, there is no closing bracket for the TreeSet.  Also
> >> instead
> >> of using a TreeSet you can do this:
> >> ['exampleFeatureId', 'description'] as Set
> >>
> >> Regards
> >> Scott
> >>
> >> 2008/6/13 <jl...@apache.org>:
> >>
> >>  Author: jleroux
> >>> Date: Fri Jun 13 02:55:27 2008
> >>> New Revision: 667448
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
> >>> Log:
> >>> My 1st bsh->groovy migration, please check. I will change the file name
> >>> (uppercase className) remotely as I'm working on Windows currently
> (files
> >>> names case insensitive)
> >>>
> >>> Modified:
> >>>
> >>>
> >>>
>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> >>>
> >>> Modified:
> >>>
> >>>
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> >>> URL:
> >>>
> >>>
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
> >>>
> >>>
> >>>
> ==============================================================================
> >>> ---
> >>>
> >>>
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> >>> (original)
> >>> +++
> >>>
> >>>
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> >>> Fri Jun 13 02:55:27 2008
> >>> @@ -18,30 +18,27 @@
> >>>  */
> >>>
> >>>  import java.util.TreeSet;
> >>> -import javolution.util.FastList;
> >>>  import org.ofbiz.entity.condition.EntityCondition;
> >>>  import org.ofbiz.entity.condition.EntityConditionList;
> >>>  import org.ofbiz.entity.condition.EntityExpr;
> >>>  import org.ofbiz.entity.condition.EntityFieldValue;
> >>>  import org.ofbiz.entity.condition.EntityFunction;
> >>>  import org.ofbiz.entity.condition.EntityOperator;
> >>> -import org.ofbiz.base.util.UtilMisc;
> >>> -import org.ofbiz.base.util.UtilValidate;
> >>>
> >>> -delegator = request.getAttribute("delegator");
> >>>
> >>> -andExprs = FastList.newInstance();
> >>> -fieldValue = request.getParameter("exampleFeatureId");
> >>> -if (UtilValidate.isNotEmpty(fieldValue)) {
> >>> +andExprs = [];
> >>> +fieldValue = parameters.exampleFeatureId;
> >>> +if (fieldValue) {
> >>>
> >>>
> >>>
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
> >>>            EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
> >>>  }
> >>>
> >>> -List autocompleteOptions = null;
> >>> -if (andExprs.size() > 0) {
> >>> +autocompleteOptions = [];
> >>> +if (andExprs) {
> >>>    entityConditionList = EntityCondition.makeCondition(andExprs,
> >>> EntityOperator.AND);
> >>> -    autocompleteOptions = delegator.findList("ExampleFeature",
> >>> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
> >>> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
> >>> -    //context.put("autocompleteOptions", autocompleteOptions);
> >>> +    autocompleteOptions = delegator.findList("ExampleFeature",
> >>> entityConditionList,
> >>> +            new TreeSet(['exampleFeatureId', 'description'],
> >>> ['-exampleFeatureId'], null, false);
> >>> +    //context.autocompleteOptions = autocompleteOptions;
> >>>       request.setAttribute("autocompleteOptions", autocompleteOptions);
> >>>  }
> >>>  return "success";
> >>> \ No newline at end of file
> >>>
> >>>
> >>>
> >>>
> >>
> >
>

Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Vikas Mayur <vi...@gmail.com>.
Jacques, Looks like Scott name is in french :)

Vikas

On Fri, Jun 13, 2008 at 6:54 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Thanks for the Set tip Scoot,
>
> Jacques
>
> From: "Scott Gray" <le...@gmail.com>
>
>  Hi Jacques
>>
>> Looks good except for one thing:
>> +    autocompleteOptions = delegator.findList("ExampleFeature",
>> entityConditionList,
>> +            new TreeSet(['exampleFeatureId', 'description'],
>> ['-exampleFeatureId'], null, false);
>> Introduces a bug, there is no closing bracket for the TreeSet.  Also
>> instead
>> of using a TreeSet you can do this:
>> ['exampleFeatureId', 'description'] as Set
>>
>> Regards
>> Scott
>>
>> 2008/6/13 <jl...@apache.org>:
>>
>>  Author: jleroux
>>> Date: Fri Jun 13 02:55:27 2008
>>> New Revision: 667448
>>>
>>> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
>>> Log:
>>> My 1st bsh->groovy migration, please check. I will change the file name
>>> (uppercase className) remotely as I'm working on Windows currently (files
>>> names case insensitive)
>>>
>>> Modified:
>>>
>>>
>>>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>>>
>>> Modified:
>>>
>>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>>> URL:
>>>
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
>>>
>>>
>>> ==============================================================================
>>> ---
>>>
>>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>>> (original)
>>> +++
>>>
>>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>>> Fri Jun 13 02:55:27 2008
>>> @@ -18,30 +18,27 @@
>>>  */
>>>
>>>  import java.util.TreeSet;
>>> -import javolution.util.FastList;
>>>  import org.ofbiz.entity.condition.EntityCondition;
>>>  import org.ofbiz.entity.condition.EntityConditionList;
>>>  import org.ofbiz.entity.condition.EntityExpr;
>>>  import org.ofbiz.entity.condition.EntityFieldValue;
>>>  import org.ofbiz.entity.condition.EntityFunction;
>>>  import org.ofbiz.entity.condition.EntityOperator;
>>> -import org.ofbiz.base.util.UtilMisc;
>>> -import org.ofbiz.base.util.UtilValidate;
>>>
>>> -delegator = request.getAttribute("delegator");
>>>
>>> -andExprs = FastList.newInstance();
>>> -fieldValue = request.getParameter("exampleFeatureId");
>>> -if (UtilValidate.isNotEmpty(fieldValue)) {
>>> +andExprs = [];
>>> +fieldValue = parameters.exampleFeatureId;
>>> +if (fieldValue) {
>>>
>>>
>>> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
>>>            EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
>>>  }
>>>
>>> -List autocompleteOptions = null;
>>> -if (andExprs.size() > 0) {
>>> +autocompleteOptions = [];
>>> +if (andExprs) {
>>>    entityConditionList = EntityCondition.makeCondition(andExprs,
>>> EntityOperator.AND);
>>> -    autocompleteOptions = delegator.findList("ExampleFeature",
>>> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
>>> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
>>> -    //context.put("autocompleteOptions", autocompleteOptions);
>>> +    autocompleteOptions = delegator.findList("ExampleFeature",
>>> entityConditionList,
>>> +            new TreeSet(['exampleFeatureId', 'description'],
>>> ['-exampleFeatureId'], null, false);
>>> +    //context.autocompleteOptions = autocompleteOptions;
>>>       request.setAttribute("autocompleteOptions", autocompleteOptions);
>>>  }
>>>  return "success";
>>> \ No newline at end of file
>>>
>>>
>>>
>>>
>>
>

Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks for the Set tip Scoot,

Jacques

From: "Scott Gray" <le...@gmail.com>
> Hi Jacques
>
> Looks good except for one thing:
> +    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList,
> +            new TreeSet(['exampleFeatureId', 'description'],
> ['-exampleFeatureId'], null, false);
> Introduces a bug, there is no closing bracket for the TreeSet.  Also instead
> of using a TreeSet you can do this:
> ['exampleFeatureId', 'description'] as Set
>
> Regards
> Scott
>
> 2008/6/13 <jl...@apache.org>:
>
>> Author: jleroux
>> Date: Fri Jun 13 02:55:27 2008
>> New Revision: 667448
>>
>> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
>> Log:
>> My 1st bsh->groovy migration, please check. I will change the file name
>> (uppercase className) remotely as I'm working on Windows currently (files
>> names case insensitive)
>>
>> Modified:
>>
>>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>>
>> Modified:
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> (original)
>> +++
>> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>> Fri Jun 13 02:55:27 2008
>> @@ -18,30 +18,27 @@
>>  */
>>
>>  import java.util.TreeSet;
>> -import javolution.util.FastList;
>>  import org.ofbiz.entity.condition.EntityCondition;
>>  import org.ofbiz.entity.condition.EntityConditionList;
>>  import org.ofbiz.entity.condition.EntityExpr;
>>  import org.ofbiz.entity.condition.EntityFieldValue;
>>  import org.ofbiz.entity.condition.EntityFunction;
>>  import org.ofbiz.entity.condition.EntityOperator;
>> -import org.ofbiz.base.util.UtilMisc;
>> -import org.ofbiz.base.util.UtilValidate;
>>
>> -delegator = request.getAttribute("delegator");
>>
>> -andExprs = FastList.newInstance();
>> -fieldValue = request.getParameter("exampleFeatureId");
>> -if (UtilValidate.isNotEmpty(fieldValue)) {
>> +andExprs = [];
>> +fieldValue = parameters.exampleFeatureId;
>> +if (fieldValue) {
>>
>> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
>>             EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
>>  }
>>
>> -List autocompleteOptions = null;
>> -if (andExprs.size() > 0) {
>> +autocompleteOptions = [];
>> +if (andExprs) {
>>     entityConditionList = EntityCondition.makeCondition(andExprs,
>> EntityOperator.AND);
>> -    autocompleteOptions = delegator.findList("ExampleFeature",
>> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
>> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
>> -    //context.put("autocompleteOptions", autocompleteOptions);
>> +    autocompleteOptions = delegator.findList("ExampleFeature",
>> entityConditionList,
>> +            new TreeSet(['exampleFeatureId', 'description'],
>> ['-exampleFeatureId'], null, false);
>> +    //context.autocompleteOptions = autocompleteOptions;
>>        request.setAttribute("autocompleteOptions", autocompleteOptions);
>>  }
>>  return "success";
>> \ No newline at end of file
>>
>>
>>
> 


Re: svn commit: r667448 - /ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy

Posted by Scott Gray <le...@gmail.com>.
Hi Jacques

Looks good except for one thing:
+    autocompleteOptions = delegator.findList("ExampleFeature",
entityConditionList,
+            new TreeSet(['exampleFeatureId', 'description'],
['-exampleFeatureId'], null, false);
Introduces a bug, there is no closing bracket for the TreeSet.  Also instead
of using a TreeSet you can do this:
['exampleFeatureId', 'description'] as Set

Regards
Scott

2008/6/13 <jl...@apache.org>:

> Author: jleroux
> Date: Fri Jun 13 02:55:27 2008
> New Revision: 667448
>
> URL: http://svn.apache.org/viewvc?rev=667448&view=rev
> Log:
> My 1st bsh->groovy migration, please check. I will change the file name
> (uppercase className) remotely as I'm working on Windows currently (files
> names case insensitive)
>
> Modified:
>
>  ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
>
> Modified:
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy?rev=667448&r1=667447&r2=667448&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> (original)
> +++
> ofbiz/trunk/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.groovy
> Fri Jun 13 02:55:27 2008
> @@ -18,30 +18,27 @@
>  */
>
>  import java.util.TreeSet;
> -import javolution.util.FastList;
>  import org.ofbiz.entity.condition.EntityCondition;
>  import org.ofbiz.entity.condition.EntityConditionList;
>  import org.ofbiz.entity.condition.EntityExpr;
>  import org.ofbiz.entity.condition.EntityFieldValue;
>  import org.ofbiz.entity.condition.EntityFunction;
>  import org.ofbiz.entity.condition.EntityOperator;
> -import org.ofbiz.base.util.UtilMisc;
> -import org.ofbiz.base.util.UtilValidate;
>
> -delegator = request.getAttribute("delegator");
>
> -andExprs = FastList.newInstance();
> -fieldValue = request.getParameter("exampleFeatureId");
> -if (UtilValidate.isNotEmpty(fieldValue)) {
> +andExprs = [];
> +fieldValue = parameters.exampleFeatureId;
> +if (fieldValue) {
>
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("exampleFeatureId")),
>             EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
>  }
>
> -List autocompleteOptions = null;
> -if (andExprs.size() > 0) {
> +autocompleteOptions = [];
> +if (andExprs) {
>     entityConditionList = EntityCondition.makeCondition(andExprs,
> EntityOperator.AND);
> -    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId",
> "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
> -    //context.put("autocompleteOptions", autocompleteOptions);
> +    autocompleteOptions = delegator.findList("ExampleFeature",
> entityConditionList,
> +            new TreeSet(['exampleFeatureId', 'description'],
> ['-exampleFeatureId'], null, false);
> +    //context.autocompleteOptions = autocompleteOptions;
>        request.setAttribute("autocompleteOptions", autocompleteOptions);
>  }
>  return "success";
> \ No newline at end of file
>
>
>