From bd2d32eabaa40bb064f9f4ccf296fb2ef4610ef3 Mon Sep 17 00:00:00 2001 From: "David E. Jones" Date: Tue, 10 Jun 2008 11:31:17 +0000 Subject: [PATCH] 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 --- .../ofbiz/example/example/ExampleServices.xml | 16 ++--- framework/minilang/dtd/simple-methods.xsd | 63 ++++--------------- .../minilang/method/ifops/IfCompare.java | 23 ++++--- .../minilang/method/ifops/IfCompareField.java | 32 ++++++---- .../ofbiz/minilang/method/ifops/IfEmpty.java | 7 ++- .../minilang/method/ifops/IfNotEmpty.java | 15 +++-- 6 files changed, 70 insertions(+), 86 deletions(-) diff --git a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml index 36b163b9e8..3f635838cb 100644 --- a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml +++ b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml @@ -36,15 +36,15 @@ under the License. - + - + - + @@ -72,7 +72,7 @@ under the License. - + @@ -120,10 +120,10 @@ under the License. - - - - + + + + diff --git a/framework/minilang/dtd/simple-methods.xsd b/framework/minilang/dtd/simple-methods.xsd index 2a941ff882..1fcd78802b 100644 --- a/framework/minilang/dtd/simple-methods.xsd +++ b/framework/minilang/dtd/simple-methods.xsd @@ -4161,18 +4161,10 @@ under the License. - + - 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 map field that will be compared. + The name of the field in the context (environment) that will be compared. @@ -4226,35 +4218,18 @@ under the License. - + - 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. - + - The name of the map field that will be compared. - - - - - - - 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 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. @@ -4353,18 +4328,10 @@ under the License. - + - 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 map field that will be compared. + The name of the context field that will be compared. @@ -4401,18 +4368,10 @@ under the License. - + - 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 map field that will be compared. + The name of the context field that will be compared. diff --git a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java index 94bf9e26dc..a29cacd17f 100644 --- a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java +++ b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java @@ -36,21 +36,26 @@ public class IfCompare extends MethodOperation { public static final String module = IfCompare.class.getName(); - List subOps = FastList.newInstance(); - List elseSubOps = null; + protected List subOps = FastList.newInstance(); + protected List 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"); diff --git a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java index 5755cb7ee6..d827898fab 100644 --- a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java +++ b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java @@ -36,26 +36,36 @@ public class IfCompareField extends MethodOperation { public static final String module = IfCompareField.class.getName(); - List subOps = FastList.newInstance(); - List elseSubOps = null; + protected List subOps = FastList.newInstance(); + protected List 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 diff --git a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java index fade883405..9e53140aac 100644 --- a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java +++ b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java @@ -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); diff --git a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java index a5249d470d..baaf7a8b96 100644 --- a/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java +++ b/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java @@ -34,16 +34,21 @@ public class IfNotEmpty extends MethodOperation { public static final String module = IfNotEmpty.class.getName(); - List subOps = FastList.newInstance(); - List elseSubOps = null; + protected List subOps = FastList.newInstance(); + protected List 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);