Oops I missed closing braces :( Thanks Scott for catching that. -- Ashish
On Fri, Jun 13, 2008 at 6:04 AM, Scott Gray <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>: > > > 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 > > > > > > >