Author: jonesde
Date: Sun Jan 11 01:19:34 2009 New Revision: 733436 URL: http://svn.apache.org/viewvc?rev=733436&view=rev Log: Changed screen, form, menu and tree widget actions and conditions to be consistent with simple-method cleanups, includes XSD and java changes Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/dtd/widget-menu.xsd ofbiz/trunk/framework/widget/dtd/widget-screen.xsd ofbiz/trunk/framework/widget/dtd/widget-tree.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Sun Jan 11 01:19:34 2009 @@ -18,9 +18,14 @@ *******************************************************************************/ package org.ofbiz.base.util; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.URL; -import java.util.Iterator; import java.util.List; import java.util.Set; Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Sun Jan 11 01:19:34 2009 @@ -1440,12 +1440,12 @@ </xs:element> <xs:attributeGroup name="attlist.service"> <xs:attribute type="xs:string" name="service-name" use="required"/> - <xs:attribute type="xs:string" name="result-map-name"/> + <xs:attribute type="xs:string" name="result-map"/> <xs:attribute type="xs:string" name="auto-field-map" default="true"> <xs:annotation><xs:documentation>This can be "true", "false" or the name of a Map in the context to use as the source Map for the service context.</xs:documentation></xs:annotation> </xs:attribute> <!-- this is deprecated and should not be used; use result-map-list-name instead: <xs:attribute type="xs:string" name="result-map-list-iterator-name"/> --> - <xs:attribute type="xs:string" name="result-map-list-name"/> + <xs:attribute type="xs:string" name="result-map-list"/> </xs:attributeGroup> <xs:element name="set" substitutionGroup="AllActions"> <xs:complexType> @@ -1502,8 +1502,8 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-and"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="list-name" use="optional"/> + <xs:attribute name="entity-name" type="xs:string" use="required"/> + <xs:attribute name="list" type="xs:string" use="optional"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -1551,8 +1551,8 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-condition"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="list-name" use="optional"/> + <xs:attribute name="entity-name" type="xs:string" use="required"/> + <xs:attribute name="list" type="xs:string" use="optional"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -1599,7 +1599,7 @@ </xs:element> <xs:attributeGroup name="attlist.entity-one"> <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="value-name"/> + <xs:attribute type="xs:string" name="value-field"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -1624,7 +1624,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.condition-expr"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field-name" type="xs:string" use="required"/> <xs:attribute name="operator" default="equals"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -1640,8 +1640,8 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="env-name"/> - <xs:attribute type="xs:string" name="value"/> + <xs:attribute name="from-field" type="xs:string"/> + <xs:attribute name="value" type="xs:string"/> <xs:attribute name="ignore-if-null" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -1701,7 +1701,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.condition-object"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> </xs:attributeGroup> <xs:element name="field-map"> <xs:complexType> @@ -1710,7 +1710,7 @@ </xs:element> <xs:attributeGroup name="attlist.field-map"> <xs:attribute type="xs:string" name="field-name" use="required"/> - <xs:attribute type="xs:string" name="env-name"/> + <xs:attribute type="xs:string" name="from-field"/> <xs:attribute type="xs:string" name="value"/> </xs:attributeGroup> <xs:element name="having-condition-list"> Modified: ofbiz/trunk/framework/widget/dtd/widget-menu.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-menu.xsd?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-menu.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-menu.xsd Sun Jan 11 01:19:34 2009 @@ -468,7 +468,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-validate-method"> - <xs:attribute name="field-name" use="required"/> + <xs:attribute name="field" use="required"/> <xs:attribute name="method" use="required"/> <xs:attribute name="class" default="org.ofbiz.base.util.UtilValidate"/> </xs:attributeGroup> @@ -478,7 +478,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare"> - <xs:attribute name="field-name" use="required"/> + <xs:attribute name="field" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -519,7 +519,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare-field"> - <xs:attribute name="field-name" use="required"/> + <xs:attribute name="field" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -533,7 +533,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute name="to-field-name"/> + <xs:attribute name="to-field"/> <xs:attribute name="type" default="String"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -560,7 +560,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-regexp"> - <xs:attribute name="field-name" use="required"/> + <xs:attribute name="field" use="required"/> <xs:attribute name="expr" use="required"/> </xs:attributeGroup> <xs:element name="if-empty" substitutionGroup="AllConditionals"> Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Sun Jan 11 01:19:34 2009 @@ -196,7 +196,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-validate-method"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> <xs:attribute type="xs:string" name="method" use="required"/> <xs:attribute type="xs:string" name="class" default="org.ofbiz.base.util.UtilValidate"/> </xs:attributeGroup> @@ -206,7 +206,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field" type="xs:string" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -220,7 +220,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="value" use="required"/> + <xs:attribute name="value" type="xs:string" use="required"/> <xs:attribute name="type" default="String"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -247,7 +247,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare-field"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field" type="xs:string" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -261,7 +261,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="to-field-name"/> + <xs:attribute name="to-field" type="xs:string"/> <xs:attribute name="type" default="String"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -288,7 +288,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-regexp"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> <xs:attribute type="xs:string" name="expr" use="required"/> </xs:attributeGroup> <xs:element name="if-empty" substitutionGroup="AllConditionals"> @@ -297,7 +297,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-empty"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> </xs:attributeGroup> <!-- ================ ACTIONS ================ --> @@ -420,7 +420,7 @@ </xs:element> <xs:attributeGroup name="attlist.service"> <xs:attribute type="xs:string" name="service-name" use="required"/> - <xs:attribute type="xs:string" name="result-map-name"/> + <xs:attribute type="xs:string" name="result-map"/> <xs:attribute type="xs:string" name="auto-field-map" default="true"> <xs:annotation><xs:documentation>This can be "true", "false" or the name of a Map in the context to use as the source Map for the service context.</xs:documentation></xs:annotation> </xs:attribute> @@ -460,7 +460,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="list-name" use="required"/> + <xs:attribute type="xs:string" name="list" use="required"/> <xs:attribute name="result-set-type" default="scroll"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -518,7 +518,7 @@ </xs:simpleType> </xs:attribute> <xs:attribute type="xs:string" name="delegator-name"/> - <xs:attribute type="xs:string" name="list-name" use="required"/> + <xs:attribute type="xs:string" name="list" use="required"/> <xs:attribute name="result-set-type" default="scroll"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -538,8 +538,8 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-one"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="value-name" use="required"/> + <xs:attribute name="entity-name" type="xs:string" use="required"/> + <xs:attribute name="value-field" type="xs:string" use="required"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -563,10 +563,10 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.get-related-one"> - <xs:attribute name="value-name" type="xs:string" use="required"/> + <xs:attribute name="value-field" type="xs:string" use="required"/> <xs:attribute name="relation-name" type="xs:string" use="required"/> - <xs:attribute type="xs:string" name="use-cache" default="false"/> - <xs:attribute type="xs:string" name="to-value-name" use="required"/> + <xs:attribute name="use-cache" type="xs:string" default="false"/> + <xs:attribute name="to-value-field" type="xs:string" use="required"/> </xs:attributeGroup> <xs:element name="get-related" substitutionGroup="AllActions"> <xs:complexType> @@ -574,12 +574,12 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.get-related"> - <xs:attribute type="xs:string" name="value-name" use="required"/> + <xs:attribute type="xs:string" name="value-field" use="required"/> <xs:attribute type="xs:string" name="relation-name" use="required"/> - <xs:attribute type="xs:string" name="map-name"/> - <xs:attribute type="xs:string" name="order-by-list-name"/> + <xs:attribute type="xs:string" name="map"/> + <xs:attribute type="xs:string" name="order-by-list"/> <xs:attribute type="xs:string" name="use-cache" default="false"/> - <xs:attribute type="xs:string" name="list-name" use="required"/> + <xs:attribute type="xs:string" name="list" use="required"/> </xs:attributeGroup> <xs:element name="condition-list"> <xs:complexType> @@ -643,7 +643,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="env-name"/> + <xs:attribute type="xs:string" name="from-field"/> <xs:attribute type="xs:string" name="value"/> <xs:attribute name="ignore-if-null" default="false"> <xs:simpleType> Modified: ofbiz/trunk/framework/widget/dtd/widget-tree.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-tree.xsd?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-tree.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-tree.xsd Sun Jan 11 01:19:34 2009 @@ -225,14 +225,14 @@ </xs:element> <xs:attributeGroup name="attlist.service"> <xs:attribute type="xs:string" name="service-name" use="required"/> - <xs:attribute type="xs:string" name="result-map-name"/> + <xs:attribute type="xs:string" name="result-map"/> <xs:attribute type="xs:string" name="auto-field-map" default="true"> <xs:annotation><xs:documentation>This can be "true", "false" or the name of a Map in the context to use as the source Map for the service context.</xs:documentation></xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="result-map-list-name"/> - <xs:attribute type="xs:string" name="result-map-list-iterator-name"/> - <xs:attribute type="xs:string" name="result-map-value-name"/> - <xs:attribute type="xs:string" name="value-name"/> + <xs:attribute type="xs:string" name="result-map-list"/> + <!-- deprecated, use result-map-list instead <xs:attribute type="xs:string" name="result-map-list-iterator-name"/> --> + <xs:attribute type="xs:string" name="result-map-value"/> + <xs:attribute type="xs:string" name="value"/> </xs:attributeGroup> <xs:element name="entity-and"> @@ -246,8 +246,8 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-and"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="list-name" /> + <xs:attribute name="entity-name" type="xs:string" use="required"/> + <xs:attribute name="list" type="xs:string"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -294,7 +294,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-condition"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> + <xs:attribute name="entity-name" type="xs:string" use="required"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -320,8 +320,8 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="delegator-name"/> - <xs:attribute type="xs:string" name="list-name" /> + <xs:attribute name="delegator-name" type="xs:string"/> + <xs:attribute name="list" type="xs:string"/> <xs:attribute name="result-set-type" default="scroll"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -341,8 +341,8 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.entity-one"> - <xs:attribute type="xs:string" name="entity-name" use="required"/> - <xs:attribute type="xs:string" name="value-name"/> + <xs:attribute name="entity-name" type="xs:string" use="required"/> + <xs:attribute name="value-field" type="xs:string"/> <xs:attribute name="use-cache" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -405,7 +405,7 @@ </xs:element> <xs:attributeGroup name="attlist.field-map"> <xs:attribute type="xs:string" name="field-name" use="required"/> - <xs:attribute type="xs:string" name="env-name"/> + <xs:attribute type="xs:string" name="from-field"/> <xs:attribute type="xs:string" name="value"/> </xs:attributeGroup> <xs:element name="out-field-map"> @@ -462,7 +462,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.condition-expr"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field-name" type="xs:string" use="required"/> <xs:attribute name="operator" default="equals"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -478,8 +478,8 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="env-name"/> - <xs:attribute type="xs:string" name="value"/> + <xs:attribute name="from-field" type="xs:string"/> + <xs:attribute name="value" type="xs:string"/> <xs:attribute name="ignore-if-null" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -627,7 +627,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-validate-method"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> <xs:attribute type="xs:string" name="method" use="required"/> <xs:attribute type="xs:string" name="class" default="org.ofbiz.base.util.UtilValidate"/> </xs:attributeGroup> @@ -637,7 +637,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field" type="xs:string" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -670,7 +670,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="format"/> + <xs:attribute name="format" type="xs:string"/> </xs:attributeGroup> <xs:element name="if-compare-field" substitutionGroup="AllConditionals"> <xs:complexType> @@ -678,7 +678,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-compare-field"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute name="field" type="xs:string" use="required"/> <xs:attribute name="operator" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -692,7 +692,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute type="xs:string" name="to-field-name"/> + <xs:attribute name="to-field" type="xs:string"/> <xs:attribute name="type" default="String"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -719,7 +719,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-regexp"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> <xs:attribute type="xs:string" name="expr" use="required"/> </xs:attributeGroup> <xs:element name="if-empty" substitutionGroup="AllConditionals"> @@ -728,7 +728,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.if-empty"> - <xs:attribute type="xs:string" name="field-name" use="required"/> + <xs:attribute type="xs:string" name="field" use="required"/> </xs:attributeGroup> </xs:schema> <!-- @@ -740,7 +740,7 @@ <label text="${description} [${productCategoryId}]" style="tabletext"/> <sub-node node-name="ChildProductCategory"> <entity-and entity-name="ProductCategoryRollup"> - <constraint field-name="parentProductCategoryId" env-name="productCategoryId"/> + <constraint field-name="parentProductCategoryId" from-field="productCategoryId"/> <order-by field-name="sequenceNum"/> </entity-many> </sub-node> @@ -753,7 +753,7 @@ <label text="${description} [${productCategoryId}]" style="tableheadtext"/> <sub-node node-name="ChildProductCategory"> <entity-and entity-name="ProductCategoryRollup"> - <constraint field-name="parentProductCategoryId" env-name="productCategoryId"/> + <constraint field-name="parentProductCategoryId" from-field="productCategoryId"/> <order-by field-name="sequenceNum"/> </entity-many> <out-field-map field-name="productCategoryId"/> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Sun Jan 11 01:19:34 2009 @@ -20,14 +20,13 @@ import java.text.MessageFormat; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Locale; import java.util.Map; -import java.util.regex.PatternSyntaxException; import java.util.TimeZone; +import java.util.regex.PatternSyntaxException; import org.ofbiz.base.util.BshUtil; import org.ofbiz.base.util.Debug; @@ -297,10 +296,11 @@ public Service(ModelForm modelForm, Element serviceElement) { super (modelForm, serviceElement); this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map")); + if (this.resultMapNameAcsr.isEmpty()) this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); - if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-name"))) { - if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-iterator-name"))) { + if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list")) && UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-name"))) { + if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-iterator")) && UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-iterator-name"))) { String lstNm = modelForm.getListName(); if (UtilValidate.isEmpty(lstNm)) { lstNm = ModelForm.DEFAULT_FORM_RESULT_LIST_NAME; @@ -308,10 +308,12 @@ this.resultMapListNameExdr = FlexibleStringExpander.getInstance(lstNm); } else { // this is deprecated, but support it for now anyway - this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name")); + this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator")); + if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name")); } } else { - this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name")); + this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list")); + if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name")); } this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement); @@ -405,14 +407,15 @@ // if (!useCache) UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc); // make list-name optional - if (UtilValidate.isEmpty(entityAndElement.getAttribute("list-name"))) { + if (UtilValidate.isEmpty(entityAndElement.getAttribute("list")) && UtilValidate.isEmpty(entityAndElement.getAttribute("list-name"))) { String lstNm = modelForm.getListName(); if (UtilValidate.isEmpty(lstNm)) { lstNm = ModelForm.DEFAULT_FORM_RESULT_LIST_NAME; } - entityAndElement.setAttribute("list-name", lstNm); + entityAndElement.setAttribute("list", lstNm); } - this.actualListName = entityAndElement.getAttribute("list-name"); + this.actualListName = entityAndElement.getAttribute("list"); + if (UtilValidate.isEmpty(this.actualListName)) this.actualListName = entityAndElement.getAttribute("list-name"); finder = new ByAndFinder(entityAndElement); } @@ -447,14 +450,15 @@ // if (!useCache) UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc); // make list-name optional - if (UtilValidate.isEmpty(entityConditionElement.getAttribute("list-name"))) { + if (UtilValidate.isEmpty(entityConditionElement.getAttribute("list")) && UtilValidate.isEmpty(entityConditionElement.getAttribute("list-name"))) { String lstNm = modelForm.getListName(); if (UtilValidate.isEmpty(lstNm)) { lstNm = ModelForm.DEFAULT_FORM_RESULT_LIST_NAME; } - entityConditionElement.setAttribute("list-name", lstNm); + entityConditionElement.setAttribute("list", lstNm); } - this.actualListName = entityConditionElement.getAttribute("list-name"); + this.actualListName = entityConditionElement.getAttribute("list"); + if (UtilValidate.isEmpty(this.actualListName)) this.actualListName = entityConditionElement.getAttribute("list-name"); finder = new ByConditionFinder(entityConditionElement); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Sun Jan 11 01:19:34 2009 @@ -100,10 +100,8 @@ public static List<MenuCondition> readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) { List<MenuCondition> condList = FastList.newInstance(); - List subElementList = UtilXml.childElementList(conditionElement); - Iterator subElementIter = subElementList.iterator(); - while (subElementIter.hasNext()) { - Element subElement = (Element) subElementIter.next(); + List<? extends Element> subElementList = UtilXml.childElementList(conditionElement); + for (Element subElement: subElementList) { condList.add(readCondition(modelMenuItem, subElement)); } return condList; @@ -143,7 +141,7 @@ } public static class And extends MenuCondition { - protected List subConditions; + protected List<MenuCondition> subConditions; public And(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); @@ -152,9 +150,7 @@ public boolean eval(Map<String, Object> context) { // return false for the first one in the list that is false, basic and algo - Iterator subConditionIter = this.subConditions.iterator(); - while (subConditionIter.hasNext()) { - MenuCondition subCondition = (MenuCondition) subConditionIter.next(); + for (MenuCondition subCondition: this.subConditions) { if (!subCondition.eval(context)) { return false; } @@ -164,7 +160,7 @@ } public static class Xor extends MenuCondition { - protected List subConditions; + protected List<MenuCondition> subConditions; public Xor(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); @@ -174,9 +170,7 @@ public boolean eval(Map<String, Object> context) { // if more than one is true stop immediately and return false; if all are false return false; if only one is true return true boolean foundOneTrue = false; - Iterator subConditionIter = this.subConditions.iterator(); - while (subConditionIter.hasNext()) { - MenuCondition subCondition = (MenuCondition) subConditionIter.next(); + for (MenuCondition subCondition: this.subConditions) { if (subCondition.eval(context)) { if (foundOneTrue) { // now found two true, so return false @@ -191,7 +185,7 @@ } public static class Or extends MenuCondition { - protected List subConditions; + protected List<MenuCondition> subConditions; public Or(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); @@ -200,9 +194,7 @@ public boolean eval(Map<String, Object> context) { // return true for the first one in the list that is true, basic or algo - Iterator subConditionIter = this.subConditions.iterator(); - while (subConditionIter.hasNext()) { - MenuCondition subCondition = (MenuCondition) subConditionIter.next(); + for (MenuCondition subCondition: this.subConditions) { if (subCondition.eval(context)) { return true; } @@ -225,7 +217,7 @@ } } - public static class IfServicePermission extends MenuCondition { + public static class IfServicePermission extends MenuCondition { protected FlexibleStringExpander serviceExdr; protected FlexibleStringExpander actionExdr; protected FlexibleStringExpander resExdr; @@ -337,7 +329,8 @@ public IfValidateMethod(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -399,7 +392,8 @@ public IfCompare(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -425,9 +419,8 @@ messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); StringBuffer fullString = new StringBuffer(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append((String) message); } Debug.logWarning(fullString.toString(), module); @@ -448,8 +441,10 @@ public IfCompareField(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); - this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field")); + if (this.toFieldAcsr.isEmpty()) this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -474,9 +469,8 @@ messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: "); StringBuffer fullString = new StringBuffer(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append((String) message); } Debug.logWarning(fullString.toString(), module); @@ -496,7 +490,8 @@ public IfRegexp(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -553,6 +548,3 @@ } } } - - - Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java Sun Jan 11 01:19:34 2009 @@ -21,7 +21,6 @@ import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -65,6 +64,7 @@ /** * Widget Library - Screen model class */ +@SuppressWarnings("serial") public abstract class ModelScreenAction implements Serializable { public static final String module = ModelScreenAction.class.getName(); @@ -80,10 +80,8 @@ public static List<ModelScreenAction> readSubActions(ModelScreen modelScreen, Element parentElement) { List<ModelScreenAction> actions = FastList.newInstance(); - List actionElementList = UtilXml.childElementList(parentElement); - Iterator actionElementIter = actionElementList.iterator(); - while (actionElementIter.hasNext()) { - Element actionElement = (Element) actionElementIter.next(); + List<? extends Element> actionElementList = UtilXml.childElementList(parentElement); + for (Element actionElement: actionElementList) { if ("set".equals(actionElement.getNodeName())) { actions.add(new SetField(modelScreen, actionElement)); } else if ("property-map".equals(actionElement.getNodeName())) { @@ -112,18 +110,15 @@ return actions; } - public static void runSubActions(List actions, Map<String, Object> context) throws GeneralException { + public static void runSubActions(List<ModelScreenAction> actions, Map<String, Object> context) throws GeneralException { if (actions == null) return; - Iterator actionIter = actions.iterator(); - while (actionIter.hasNext()) { - ModelScreenAction action = (ModelScreenAction) actionIter.next(); + for (ModelScreenAction action: actions) { if (Debug.verboseOn()) Debug.logVerbose("Running screen action " + action.getClass().getName(), module); action.runAction(context); } } - @SuppressWarnings("serial") public static class SetField extends ModelScreenAction { protected FlexibleMapAccessor<Object> field; protected FlexibleMapAccessor<Object> fromField; @@ -277,7 +272,6 @@ } } - @SuppressWarnings("serial") public static class PropertyMap extends ModelScreenAction { protected FlexibleStringExpander resourceExdr; protected FlexibleMapAccessor<ResourceBundleMapWrapper> mapNameAcsr; @@ -322,7 +316,6 @@ } } - @SuppressWarnings("serial") public static class PropertyToField extends ModelScreenAction { protected FlexibleStringExpander resourceExdr; @@ -379,7 +372,6 @@ } } - @SuppressWarnings("serial") public static class Script extends ModelScreenAction { protected String location; @@ -420,7 +412,6 @@ } } - @SuppressWarnings("serial") public static class Service extends ModelScreenAction { protected FlexibleStringExpander serviceNameExdr; protected FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr; @@ -430,7 +421,8 @@ public Service(ModelScreen modelScreen, Element serviceElement) { super (modelScreen, serviceElement); this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map")); + if (this.resultMapNameAcsr.isEmpty()) this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement); } @@ -496,7 +488,6 @@ } } - @SuppressWarnings("serial") public static class EntityOne extends ModelScreenAction { protected PrimaryKeyFinder finder; @@ -516,7 +507,6 @@ } } - @SuppressWarnings("serial") public static class EntityAnd extends ModelScreenAction { protected ByAndFinder finder; @@ -536,7 +526,6 @@ } } - @SuppressWarnings("serial") public static class EntityCondition extends ModelScreenAction { ByConditionFinder finder; @@ -556,7 +545,6 @@ } } - @SuppressWarnings("serial") public static class GetRelatedOne extends ModelScreenAction { protected FlexibleMapAccessor<Object> valueNameAcsr; protected FlexibleMapAccessor<Object> toValueNameAcsr; @@ -565,8 +553,10 @@ public GetRelatedOne(ModelScreen modelScreen, Element getRelatedOneElement) { super (modelScreen, getRelatedOneElement); - this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("value-name")); - this.toValueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("to-value-name")); + this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("value-field")); + if (this.valueNameAcsr.isEmpty()) this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("value-name")); + this.toValueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("to-value-field")); + if (this.toValueNameAcsr.isEmpty()) this.toValueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("to-value-name")); this.relationName = getRelatedOneElement.getAttribute("relation-name"); this.useCache = "true".equals(getRelatedOneElement.getAttribute("use-cache")); } @@ -598,7 +588,6 @@ } - @SuppressWarnings("serial") public static class GetRelated extends ModelScreenAction { protected FlexibleMapAccessor<Object> valueNameAcsr; protected FlexibleMapAccessor<List<GenericValue>> listNameAcsr; @@ -609,11 +598,15 @@ public GetRelated(ModelScreen modelScreen, Element getRelatedElement) { super (modelScreen, getRelatedElement); - this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("value-name")); - this.listNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("list-name")); + this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("value-field")); + if (this.valueNameAcsr.isEmpty()) this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("value-name")); + this.listNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("list")); + if (this.listNameAcsr.isEmpty()) this.listNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("list-name")); this.relationName = getRelatedElement.getAttribute("relation-name"); - this.mapAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("map-name")); - this.orderByListAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("order-by-list-name")); + this.mapAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("map")); + if (this.mapAcsr.isEmpty()) this.mapAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("map-name")); + this.orderByListAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("order-by-list")); + if (this.orderByListAcsr.isEmpty()) this.orderByListAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("order-by-list-name")); this.useCache = "true".equals(getRelatedElement.getAttribute("use-cache")); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java Sun Jan 11 01:19:34 2009 @@ -20,7 +20,6 @@ import java.io.Serializable; import java.lang.reflect.Method; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -28,22 +27,29 @@ import javolution.util.FastList; -import org.ofbiz.base.util.*; -import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; -import org.ofbiz.base.util.UtilGenerics; -import org.ofbiz.entity.GenericValue; -import org.ofbiz.entityext.permission.EntityPermissionChecker; -import org.ofbiz.minilang.operation.BaseCompare; -import org.ofbiz.security.Security; -import org.ofbiz.service.*; - import org.apache.oro.text.regex.MalformedPatternException; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.PatternCompiler; import org.apache.oro.text.regex.PatternMatcher; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.ObjectType; +import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.UtilXml; +import org.ofbiz.base.util.collections.FlexibleMapAccessor; +import org.ofbiz.base.util.string.FlexibleStringExpander; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entityext.permission.EntityPermissionChecker; +import org.ofbiz.minilang.operation.BaseCompare; +import org.ofbiz.security.Security; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ModelService; +import org.ofbiz.service.ServiceUtil; import org.w3c.dom.Element; /** @@ -322,7 +328,8 @@ public IfValidateMethod(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -384,7 +391,8 @@ public IfCompare(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -432,8 +440,10 @@ public IfCompareField(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); - this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field")); + if (this.toFieldAcsr.isEmpty()) this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -479,7 +489,8 @@ public IfRegexp(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -513,7 +524,8 @@ public IfEmpty(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); } public boolean eval(Map<String, Object> context) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java Sun Jan 11 01:19:34 2009 @@ -18,13 +18,12 @@ *******************************************************************************/ package org.ofbiz.widget.tree; -import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Locale; import java.util.Map; -import java.util.regex.PatternSyntaxException; import java.util.TimeZone; +import java.util.regex.PatternSyntaxException; import javolution.util.FastMap; @@ -45,7 +44,6 @@ import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelService; - import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -213,7 +211,6 @@ protected FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; protected FlexibleStringExpander resultMapListNameExdr; - protected FlexibleStringExpander resultMapListIteratorNameExdr; protected FlexibleStringExpander resultMapValueNameExdr; protected FlexibleStringExpander valueNameExdr; protected Map<FlexibleMapAccessor<Object>, Object> fieldMap; @@ -231,12 +228,16 @@ public void initService( Element serviceElement ) { this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map")); + if (this.resultMapNameAcsr.isEmpty()) this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); - this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name")); - this.resultMapListIteratorNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name")); - this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value-name")); - this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value-name")); + this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list")); + if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name")); + if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name")); + this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value")); + if (this.resultMapValueNameExdr.isEmpty()) this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value-name")); + this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value")); + if (this.valueNameExdr.isEmpty()) this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value-name")); this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement); } @@ -280,19 +281,20 @@ context.putAll(result); } String resultMapListName = resultMapListNameExdr.expandString(context); - String resultMapListIteratorName = resultMapListIteratorNameExdr.expandString(context); + //String resultMapListIteratorName = resultMapListIteratorNameExdr.expandString(context); String resultMapValueName = resultMapValueNameExdr.expandString(context); String valueName = valueNameExdr.expandString(context); if (this.modelSubNode != null) { //ListIterator iter = null; - if (UtilValidate.isNotEmpty(resultMapListIteratorName)) { - ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(result.get(resultMapListIteratorName)); - this.modelSubNode.setListIterator(listIt); - } else if (UtilValidate.isNotEmpty(resultMapListName)) { + if (UtilValidate.isNotEmpty(resultMapListName)) { List<? extends Map<String, ? extends Object>> lst = UtilGenerics.checkList(result.get(resultMapListName)); - if (lst != null ) { - this.modelSubNode.setListIterator(lst.listIterator()); + if (lst != null) { + if (lst instanceof ListIterator) { + this.modelSubNode.setListIterator((ListIterator) lst); + } else { + this.modelSubNode.setListIterator(lst.listIterator()); + } } } } else { @@ -319,8 +321,11 @@ public EntityOne(ModelTree.ModelNode modelNode, Element entityOneElement) { super (modelNode, entityOneElement); - this.valueName = UtilFormatOut.checkEmpty(entityOneElement.getAttribute("value-name"), null); - entityOneElement.setAttribute( "value-name", this.valueName); + + this.valueName = UtilFormatOut.checkEmpty(entityOneElement.getAttribute("value"), entityOneElement.getAttribute("value-name")); + if (UtilValidate.isEmpty(this.valueName)) this.valueName = null; + entityOneElement.setAttribute("value", this.valueName); + finder = new PrimaryKeyFinder(entityOneElement); } @@ -343,10 +348,12 @@ super (modelSubNode, entityAndElement); boolean useCache = "true".equalsIgnoreCase(entityAndElement.getAttribute("use-cache")); Document ownerDoc = entityAndElement.getOwnerDocument(); - if (!useCache) - UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc); - this.listName = UtilFormatOut.checkEmpty(entityAndElement.getAttribute("list-name"), "_LIST_ITERATOR_"); + if (!useCache) UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc); + + this.listName = UtilFormatOut.checkEmpty(entityAndElement.getAttribute("list"), entityAndElement.getAttribute("list-name")); + if (UtilValidate.isEmpty(this.listName)) this.listName = "_LIST_ITERATOR_"; entityAndElement.setAttribute( "list-name", this.listName); + finder = new ByAndFinder(entityAndElement); } @@ -380,11 +387,12 @@ super (modelSubNode, entityConditionElement); Document ownerDoc = entityConditionElement.getOwnerDocument(); boolean useCache = "true".equalsIgnoreCase(entityConditionElement.getAttribute("use-cache")); - if (!useCache) - UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc); + if (!useCache) UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc); - this.listName = UtilFormatOut.checkEmpty(entityConditionElement.getAttribute("list-name"), "_LIST_ITERATOR_"); + this.listName = UtilFormatOut.checkEmpty(entityConditionElement.getAttribute("list"), entityConditionElement.getAttribute("list-name")); + if (UtilValidate.isEmpty(this.listName)) this.listName = "_LIST_ITERATOR_"; entityConditionElement.setAttribute( "list-name", this.listName); + finder = new ByConditionFinder(entityConditionElement); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=733436&r1=733435&r2=733436&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Sun Jan 11 01:19:34 2009 @@ -19,7 +19,6 @@ package org.ofbiz.widget.tree; import java.lang.reflect.Method; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; @@ -27,6 +26,12 @@ import javolution.util.FastList; +import org.apache.oro.text.regex.MalformedPatternException; +import org.apache.oro.text.regex.Pattern; +import org.apache.oro.text.regex.PatternCompiler; +import org.apache.oro.text.regex.PatternMatcher; +import org.apache.oro.text.regex.Perl5Compiler; +import org.apache.oro.text.regex.Perl5Matcher; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.ObjectType; @@ -37,13 +42,6 @@ import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.minilang.operation.BaseCompare; import org.ofbiz.security.Security; - -import org.apache.oro.text.regex.MalformedPatternException; -import org.apache.oro.text.regex.Pattern; -import org.apache.oro.text.regex.PatternCompiler; -import org.apache.oro.text.regex.PatternMatcher; -import org.apache.oro.text.regex.Perl5Compiler; -import org.apache.oro.text.regex.Perl5Matcher; import org.w3c.dom.Element; /** @@ -235,7 +233,8 @@ public IfValidateMethod(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -297,7 +296,8 @@ public IfCompare(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -323,9 +323,8 @@ messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); StringBuffer fullString = new StringBuffer(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append((String) message); } Debug.logWarning(fullString.toString(), module); @@ -346,8 +345,10 @@ public IfCompareField(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); - this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field")); + if (this.toFieldAcsr.isEmpty()) this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -372,9 +373,8 @@ messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: "); StringBuffer fullString = new StringBuffer(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append((String) message); } Debug.logWarning(fullString.toString(), module); @@ -394,7 +394,8 @@ public IfRegexp(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -428,7 +429,8 @@ public IfEmpty(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field")); + if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); } public boolean eval(Map<String, Object> context) { @@ -451,6 +453,3 @@ } } } - - - |
Free forum by Nabble | Edit this page |