Author: jonesde
Date: Sun Dec 21 22:26:35 2008 New Revision: 728620 URL: http://svn.apache.org/viewvc?rev=728620&view=rev Log: More simple-method cleanups Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd (original) +++ ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd Sun Dec 21 22:26:35 2008 @@ -1427,7 +1427,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.string-append"> - <xs:attribute type="xs:string" name="field-name" use="required"> + <xs:attribute type="xs:string" name="field" use="required"> <xs:annotation> <xs:documentation> The field that you want string-append to operate on. @@ -1438,13 +1438,6 @@ </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="map-name"> - <xs:annotation> - <xs:documentation> - The name of the map in the method environment. - If not specified the field-name will be used to get the field from the method environment. - </xs:documentation> - </xs:annotation> </xs:attribute> <xs:attribute type="xs:string" name="string" use="required"> <xs:annotation> <xs:documentation> @@ -1452,7 +1445,7 @@ </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="arg-list-name"> + <xs:attribute type="xs:string" name="arg-list"> <xs:annotation> <xs:documentation> arg-list-name is used to insert values from a list into @@ -1510,14 +1503,14 @@ </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="list-name" use="required"> + <xs:attribute type="xs:string" name="list" use="required"> <xs:annotation> <xs:documentation> List to add string to. </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="arg-list-name"> + <xs:attribute type="xs:string" name="arg-list"> <xs:annotation> <xs:documentation> arg-list-name is used to insert values from a list into @@ -1534,7 +1527,7 @@ </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="message-field-name"> + <xs:attribute type="xs:string" name="message-field"> <xs:annotation> <xs:documentation> To insert a message above a field (used in conjunction with @fieldErrors FTL macro) @@ -1553,15 +1546,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.to-string"> - <xs:attribute type="xs:string" name="map-name"> - <xs:annotation> - <xs:documentation> - The name of the map in the method environment. - If not specified the field-name will be used to get the field from the method environment. - </xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute type="xs:string" name="field-name" use="required"> + <xs:attribute type="xs:string" name="field" use="required"> <xs:annotation> <xs:documentation> The name (key) of the map field to use. @@ -1594,15 +1579,7 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.clear-field"> - <xs:attribute type="xs:string" name="map-name"> - <xs:annotation> - <xs:documentation> - The name of the map in the method environment. - If not specified the field-name will be used to get the field from the method environment. - </xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute type="xs:string" name="field-name" use="required"> + <xs:attribute type="xs:string" name="field" use="required"> <xs:annotation> <xs:documentation> The name (key) of the map field to use. @@ -1621,14 +1598,14 @@ </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.first-from-list"> - <xs:attribute type="xs:string" name="entry-name" use="required"> + <xs:attribute type="xs:string" name="entry" use="required"> <xs:annotation> <xs:documentation> The name of the method environment field that will contain the first entry in the list. </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="list-name" use="required"> + <xs:attribute type="xs:string" name="list" use="required"> <xs:annotation> <xs:documentation> The name of the method environment field that contains the list to get the first entry from. @@ -1706,7 +1683,7 @@ </xs:annotation> </xs:attribute> </xs:attributeGroup> - <xs:element name="sequenced-id-to-env" substitutionGroup="EntityMiscOperations"> + <xs:element name="sequenced-id" substitutionGroup="EntityMiscOperations"> <xs:annotation> <xs:documentation> The sequenced-id-to-env tag gets a sequenced ID from the Entity Engine (through the delegator) and puts it in the specified method environment field. @@ -1714,10 +1691,10 @@ </xs:documentation> </xs:annotation> <xs:complexType> - <xs:attributeGroup ref="attlist.sequenced-id-to-env"/> + <xs:attributeGroup ref="attlist.sequenced-id"/> </xs:complexType> </xs:element> - <xs:attributeGroup name="attlist.sequenced-id-to-env"> + <xs:attributeGroup name="attlist.sequenced-id"> <xs:attribute type="xs:string" name="sequence-name" use="required"> <xs:annotation> <xs:documentation> @@ -1726,7 +1703,7 @@ </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute type="xs:string" name="env-name" use="required"> + <xs:attribute type="xs:string" name="field" use="required"> <xs:annotation> <xs:documentation> The name of the method environment field the sequenced ID will be put in. Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java Sun Dec 21 22:26:35 2008 @@ -38,6 +38,16 @@ return "sequenced-id-to-env"; } } + public static final class SequencedIdFactory implements Factory<SequencedIdToEnv> { + public SequencedIdToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) { + return new SequencedIdToEnv(element, simpleMethod); + } + + public String getName() { + return "sequenced-id"; + } + } + String seqName; ContextAccessor<Object> envAcsr; @@ -47,7 +57,7 @@ public SequencedIdToEnv(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); seqName = element.getAttribute("sequence-name"); - envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name")); + envAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("env-name")); // default false, anything but true is false getLongOnly = "true".equals(element.getAttribute("get-long-only")); String staggerMaxStr = element.getAttribute("stagger-max"); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java Sun Dec 21 22:26:35 2008 @@ -49,8 +49,10 @@ public ClearField(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); + + // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported + fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name")); mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name")); - fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } public boolean exec(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java Sun Dec 21 22:26:35 2008 @@ -46,12 +46,11 @@ public FirstFromList(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - this.entryAcsr = new ContextAccessor<Object>(element.getAttribute("entry-name")); - this.listAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("list-name")); + this.entryAcsr = new ContextAccessor<Object>(element.getAttribute("entry"), element.getAttribute("entry-name")); + this.listAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("list"), element.getAttribute("list-name")); } public boolean exec(MethodContext methodContext) { - if (listAcsr.isEmpty()) { Debug.logWarning("No list-name specified in iterate tag, doing nothing", module); return true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java Sun Dec 21 22:26:35 2008 @@ -57,9 +57,12 @@ string = element.getAttribute("string"); prefix = element.getAttribute("prefix"); suffix = element.getAttribute("suffix"); + + // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported + fieldAcsr = new ContextAccessor<String>(element.getAttribute("field"), element.getAttribute("field-name")); mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name")); - fieldAcsr = new ContextAccessor<String>(element.getAttribute("field-name")); - argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name")); + + argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list"), element.getAttribute("arg-list-name")); } public boolean exec(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java Sun Dec 21 22:26:35 2008 @@ -53,9 +53,9 @@ public StringToList(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); string = element.getAttribute("string"); - listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list-name")); - argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name")); - messageFieldName = element.getAttribute("message-field-name"); + listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list"), element.getAttribute("list-name")); + argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list"), element.getAttribute("arg-list-name")); + messageFieldName = UtilValidate.isNotEmpty(element.getAttribute("message-field")) ? element.getAttribute("message-field") : element.getAttribute("message-field-name"); } public boolean exec(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java?rev=728620&r1=728619&r2=728620&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java Sun Dec 21 22:26:35 2008 @@ -51,8 +51,11 @@ public ToString(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); + + // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported + fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name")); mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name")); - fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); + format = element.getAttribute("format"); String npStr = element.getAttribute("numeric-padding"); |
Free forum by Nabble | Edit this page |