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
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@666069 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -36,15 +36,15 @@ under the License.
|
||||
|
||||
<!-- 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 @@ under the License.
|
||||
<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 @@ under the License.
|
||||
<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/>
|
||||
|
||||
@@ -4161,18 +4161,10 @@ under the License.
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.if-compare">
|
||||
<xs:attribute type="xs:string" name="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 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.
|
||||
The name of the field in the context (environment) that will be compared.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
@@ -4226,35 +4218,18 @@ under the License.
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.if-compare-field">
|
||||
<xs:attribute type="xs:string" name="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 validated will come from.
|
||||
If not specified the field-name will be treated as a method environment field name (an env-name).
|
||||
The name of the context field that will be compared.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute type="xs:string" name="field-name" use="required">
|
||||
<xs:attribute type="xs:string" name="to-field">
|
||||
<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: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.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute type="xs:string" name="to-field-name">
|
||||
<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 @@ under the License.
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.if-empty">
|
||||
<xs:attribute type="xs:string" name="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 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.
|
||||
The name of the context field that will be compared.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
@@ -4401,18 +4368,10 @@ under the License.
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.if-not-empty">
|
||||
<xs:attribute type="xs:string" name="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 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.
|
||||
The name of the context field that will be compared.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
|
||||
@@ -36,21 +36,26 @@ public class IfCompare extends MethodOperation {
|
||||
|
||||
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;
|
||||
protected ContextAccessor mapAcsr;
|
||||
protected ContextAccessor fieldAcsr;
|
||||
protected String value;
|
||||
|
||||
String operator;
|
||||
String type;
|
||||
String format;
|
||||
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");
|
||||
|
||||
@@ -36,26 +36,36 @@ public class IfCompareField extends MethodOperation {
|
||||
|
||||
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;
|
||||
protected ContextAccessor mapAcsr;
|
||||
protected ContextAccessor fieldAcsr;
|
||||
protected ContextAccessor toMapAcsr;
|
||||
protected ContextAccessor toFieldAcsr;
|
||||
|
||||
String operator;
|
||||
String type;
|
||||
String format;
|
||||
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
|
||||
|
||||
@@ -42,8 +42,13 @@ public class IfEmpty extends MethodOperation {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -34,16 +34,21 @@ public class IfNotEmpty extends MethodOperation {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user