Author: hansbak Date: Mon Sep 9 03:10:00 2013 New Revision: 1520954 URL: http://svn.apache.org/r1520954 Log: small improvements of the programmable database export
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ProgramExport.groovy ofbiz/trunk/framework/webtools/widget/MiscForms.xml Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ProgramExport.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ProgramExport.groovy?rev=1520954&r1=1520953&r2=1520954&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ProgramExport.groovy (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ProgramExport.groovy Mon Sep 9 03:10:00 2013 @@ -37,9 +37,20 @@ if (UtilValidate.isEmpty(parameters.groo // Use the List variable recordValues to fill it with GenericValue maps. // full groovy syntaxt is available -// examples: -recordValues.add(delegator.findOne("Content", ["contentId": "BLOGROOTBIGAL"], false)); -recordValues.add(delegator.findOne("Content", ["contentId": "BLOGROOTMADMAX"], false)); +import org.ofbiz.entity.util.EntityFindOptions; + +// example: + +// find the first three record in the product entity (if any) +EntityFindOptions findOptions = new EntityFindOptions(); +findOptions.setMaxRows(3); + +List products = delegator.findList("Product", null, null, null, findOptions, false); +if (products != null) { + recordValues.addAll(products); +} + + ''' parameters.groovyProgram = groovyProgram; } else { @@ -76,5 +87,11 @@ if (UtilValidate.isNotEmpty(groovyProgra } catch(IllegalArgumentException e) { request.setAttribute("_ERROR_MESSAGE_", e); return; - } + } catch(NullPointerException e) { + request.setAttribute("_ERROR_MESSAGE_", e); + return; + } catch(Exception e) { + request.setAttribute("_ERROR_MESSAGE_", e); + return; + } } Modified: ofbiz/trunk/framework/webtools/widget/MiscForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/MiscForms.xml?rev=1520954&r1=1520953&r2=1520954&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/widget/MiscForms.xml (original) +++ ofbiz/trunk/framework/webtools/widget/MiscForms.xml Mon Sep 9 03:10:00 2013 @@ -22,7 +22,7 @@ under the License. <form name="ProgramExport" type="single" target="ProgramExport" default-map-name="parameters"> <field name="groovyProgram" widget-style="required" tooltip="${uiLabelMap.CommonRequired}"> - <textarea cols="120" rows="10" /> + <textarea cols="120" rows="20" /> </field> <field name="submitButton" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field> </form>