You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/06/10 13:31:17 UTC
svn commit: r666069 - in /ofbiz/trunk/framework:
example/script/org/ofbiz/example/example/ minilang/dtd/
minilang/src/org/ofbiz/minilang/method/ifops/
Author: jonesde
Date: Tue Jun 10 04:31:17 2008
New Revision: 666069
URL: http://svn.apache.org/viewvc?rev=666069&view=rev
Log:
Started effort of cleaning up element and attribute names in simple-methods, there is a lot of work to do here to make things consistent; for more info and a list of all changes see the docs.ofbiz.org Simple Method Cleanup Effort page
Modified:
ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java
Modified: ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml (original)
+++ ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml Tue Jun 10 04:31:17 2008
@@ -36,15 +36,15 @@
<!-- handle statusId change stuff; first put the current statusId in the oldStatusId result -->
<field-to-result field-name="lookedUpValue.statusId" result-name="oldStatusId"/>
- <if-compare-field field-name="lookedUpValue.statusId" operator="not-equals" to-field-name="parameters.statusId">
+ <if-compare-field field="lookedUpValue.statusId" operator="not-equals" to-field="parameters.statusId">
<!-- if the record exists there should be a statusId, but just in case make it so it won't blow up -->
- <if-not-empty field-name="lookedUpValue.statusId">
+ <if-not-empty field="lookedUpValue.statusId">
<!-- if statusId change is not in the StatusValidChange list, complain... -->
<entity-one entity-name="StatusValidChange" value-name="statusValidChange" auto-field-map="false">
<field-map field-name="statusId" env-name="lookedUpValue.statusId"/>
<field-map field-name="statusIdTo" env-name="parameters.statusId"/>
</entity-one>
- <if-empty field-name="statusValidChange">
+ <if-empty field="statusValidChange">
<!-- no valid change record found? return an error... -->
<add-error><fail-property resource="ExampleUiLabels" property="ExampleErrorNoExampleStatusValidChange"/></add-error>
<check-errors/>
@@ -72,7 +72,7 @@
<order-by field-name="-statusDate"/>
</entity-and>
<first-from-list entry-name="oldExampleStatus" list-name="oldExampleStatusList"/>
- <if-not-empty field-name="oldExampleStatus">
+ <if-not-empty field="oldExampleStatus">
<set field="oldExampleStatus.statusEndDate" from-field="nowTimestamp"/>
<store-value value-name="oldExampleStatus"/>
</if-not-empty>
@@ -120,10 +120,10 @@
<entity-one entity-name="Example" value-name="example"/>
<assert>
- <not><if-empty field-name="example"/></not>
- <if-compare-field field-name="example.exampleTypeId" to-field-name="createExampleMap.exampleTypeId" operator="equals"/>
- <if-compare-field field-name="example.exampleName" to-field-name="createExampleMap.exampleName" operator="equals"/>
- <if-compare-field field-name="example.statusId" to-field-name="createExampleMap.statusId" operator="equals"/>
+ <not><if-empty field="example"/></not>
+ <if-compare-field field="example.exampleTypeId" to-field="createExampleMap.exampleTypeId" operator="equals"/>
+ <if-compare-field field="example.exampleName" to-field="createExampleMap.exampleName" operator="equals"/>
+ <if-compare-field field="example.statusId" to-field="createExampleMap.statusId" operator="equals"/>
</assert>
<check-errors/>
Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd (original)
+++ ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd Tue Jun 10 04:31:17 2008
@@ -4161,18 +4161,10 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.if-compare">
- <xs:attribute type="xs:string" name="map-name">
- <xs:annotation>
- <xs:documentation>
- The name of the method environment field that contains the map that the field to be validated will come from.
- If not specified the field-name will be treated as a method environment field name (an env-name).
- </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 of the map field that will be compared.
+ The name of the field in the context (environment) that will be compared.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -4226,35 +4218,18 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.if-compare-field">
- <xs:attribute type="xs:string" name="map-name">
- <xs:annotation>
- <xs:documentation>
- The name of the method environment field that contains the map that the field to be validated will come from.
- If not specified the field-name will be treated as a method environment field name (an env-name).
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute type="xs:string" name="field-name" use="required">
- <xs:annotation>
- <xs:documentation>
- The name of the map field that will be compared.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute type="xs:string" name="to-map-name">
+ <xs:attribute type="xs:string" name="field" use="required">
<xs:annotation>
<xs:documentation>
- The name of the method environment field that contains the map that the field to be compared will come from.
- If left empty will default to the method environment.
- It does not default to the map-name because that would make it impossible to compare a map field to an environment field.
+ The name of the context field that will be compared.
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute type="xs:string" name="to-field-name">
+ <xs:attribute type="xs:string" name="to-field">
<xs:annotation>
<xs:documentation>
- The name of the to-map field that the main field will be compared to.
- If left empty will default to the field-name.
+ The name of the context field that the main field will be compared to.
+ If left empty will default to the field attribute's value.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -4353,18 +4328,10 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.if-empty">
- <xs:attribute type="xs:string" name="map-name">
- <xs:annotation>
- <xs:documentation>
- The name of the method environment field that contains the map that the field to be validated will come from.
- If not specified the field-name will be treated as a method environment field name (an env-name).
- </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 of the map field that will be compared.
+ The name of the context field that will be compared.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -4401,18 +4368,10 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.if-not-empty">
- <xs:attribute type="xs:string" name="map-name">
- <xs:annotation>
- <xs:documentation>
- The name of the method environment field that contains the map that the field to be validated will come from.
- If not specified the field-name will be treated as a method environment field name (an env-name).
- </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 of the map field that will be compared.
+ The name of the context field that will be compared.
</xs:documentation>
</xs:annotation>
</xs:attribute>
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java Tue Jun 10 04:31:17 2008
@@ -36,21 +36,26 @@
public static final String module = IfCompare.class.getName();
- List<MethodOperation> subOps = FastList.newInstance();
- List<MethodOperation> elseSubOps = null;
+ protected List<MethodOperation> subOps = FastList.newInstance();
+ protected List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- String value;
-
- String operator;
- String type;
- String format;
+ protected ContextAccessor mapAcsr;
+ protected ContextAccessor fieldAcsr;
+ protected String value;
+
+ protected String operator;
+ protected String type;
+ protected String format;
public IfCompare(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
+ // NOTE: this is still supported, but is deprecated
this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ if (this.fieldAcsr.isEmpty()) {
+ // NOTE: this is still supported, but is deprecated
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ }
this.value = element.getAttribute("value");
this.operator = element.getAttribute("operator");
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java Tue Jun 10 04:31:17 2008
@@ -36,26 +36,36 @@
public static final String module = IfCompareField.class.getName();
- List<MethodOperation> subOps = FastList.newInstance();
- List<MethodOperation> elseSubOps = null;
+ protected List<MethodOperation> subOps = FastList.newInstance();
+ protected List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor toMapAcsr;
- ContextAccessor toFieldAcsr;
-
- String operator;
- String type;
- String format;
+ protected ContextAccessor mapAcsr;
+ protected ContextAccessor fieldAcsr;
+ protected ContextAccessor toMapAcsr;
+ protected ContextAccessor toFieldAcsr;
+
+ protected String operator;
+ protected String type;
+ protected String format;
public IfCompareField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
+ // NOTE: this is still supported, but is deprecated
this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ if (this.fieldAcsr.isEmpty()) {
+ // NOTE: this is still supported, but is deprecated
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ }
+ // NOTE: this is still supported, but is deprecated
this.toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name"));
// set fieldAcsr to their defualt value of fieldAcsr if empty
- this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field-name"), element.getAttribute("field-name"));
+ this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field"), element.getAttribute("field"));
+ if (this.toFieldAcsr.isEmpty()) {
+ // NOTE: this is still supported, but is deprecated
+ this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field-name"), element.getAttribute("field-name"));
+ }
// do NOT default the to-map-name to the map-name because that
//would make it impossible to compare from a map field to an
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java Tue Jun 10 04:31:17 2008
@@ -42,8 +42,13 @@
public IfEmpty(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
+ // NOTE: this is still supported, but is deprecated
this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ if (this.fieldAcsr.isEmpty()) {
+ // NOTE: this is still supported, but is deprecated
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ }
SimpleMethod.readOperations(element, subOps, simpleMethod);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java?rev=666069&r1=666068&r2=666069&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java Tue Jun 10 04:31:17 2008
@@ -34,16 +34,21 @@
public static final String module = IfNotEmpty.class.getName();
- List<MethodOperation> subOps = FastList.newInstance();
- List<MethodOperation> elseSubOps = null;
+ protected List<MethodOperation> subOps = FastList.newInstance();
+ protected List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ protected ContextAccessor mapAcsr;
+ protected ContextAccessor fieldAcsr;
public IfNotEmpty(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
+ // NOTE: this is still supported, but is deprecated
this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ if (this.fieldAcsr.isEmpty()) {
+ // NOTE: this is still supported, but is deprecated
+ this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ }
SimpleMethod.readOperations(element, subOps, simpleMethod);