diff --git a/framework/minilang/dtd/simple-methods-v2.xsd b/framework/minilang/dtd/simple-methods-v2.xsd
index e92aba24e2..8105ff91d9 100644
--- a/framework/minilang/dtd/simple-methods-v2.xsd
+++ b/framework/minilang/dtd/simple-methods-v2.xsd
@@ -3415,19 +3415,19 @@ under the License.
-
+
- The name of the environment field that will contain each entry in the list.
+ The name of the environment field that contains the list to iterate over.
<br/><br/>
Required. Attribute type: expression.
-
+
- The name of the environment field that contains the list to iterate over.
+ The name of the environment field that will contain each entry in the list.
<br/><br/>
Required. Attribute type: expression.
@@ -3438,77 +3438,84 @@ under the License.
- The operations contained by the iterate-map tag will be executed for each of the entries in the map.
- It will run all of the operations underneath the iterate-map-element for each of the entries in the given map,
- setting the key for that entry and the key name variable, and the value for that entry and the value variable.
-
- This tag can contain any of the simple-method operations, including the conditional/if operations.
-
- Any simple-method operation can be nested under the iterate-map tag.
+ The operations contained in the iterate-map element will be executed for each of the entries in the list,
+ and will make the current entry key/value pair available in the environment by the names specified.
-
-
+
+
+
+
+ The name of the environment field that contains the map to iterate over.
+ <br/><br/>
+ Required. Attribute type: expression.
+
+
+
+
+
+
+ The name of the environment field that will contain the map entry key.
+ <br/><br/>
+ Required. Attribute type: expression.
+
+
+
+
+
+
+ The name of the environment field that will contain the map entry value.
+ <br/><br/>
+ Required. Attribute type: expression.
+
+
+
-
-
-
-
- Name of the variable to put the key.
-
-
-
-
-
-
- Name of the variable to put the value in.
-
-
-
-
-
-
- Name of the map to use.
-
-
-
-
- Loop, rather than iterating over some sort of a structure,
- will simply loop a certain number of times. The
- number of times to loop is specified in the count attribute,
- and it will put the current count in the field attribute,
- or in the variable named by the field attribute. So if you
- want to loop ten times you say count=ten, and
- field=count for example. First time through count will
- be zero; last time through count will be nine.
+ The operations contained in the loop element will be executed repeatedly until the specified count is reached.
+ The current count value is available in the environment by the name specified.
-
-
+
+
+
+
+ The number of times to loop.
+ <br/><br/>
+ Required. Attribute types: constant, expression.
+
+
+
+
+
+
+ The name of the environment field that will contain the current count.
+ <br/><br/>
+ Optional. Attribute type: expression.
+
+
+
+
+
+
+
+
+ The operations contained in the while element will be executed as long as its condition element
+ evaluates to true.
+
+
+
+
+
+
+
-
-
-
-
- Number of times to loop.
-
-
-
-
-
-
- Current count is put in the field attribute.
-
-
-
-
@@ -3682,34 +3689,6 @@ under the License.
-
-
-
- While loop operation, uses the same condition element as the if operation.
-
-
-
-
-
-
-
- A simple element with no attributes that contains the condition that will be evaluated to determine which sub-operations to execute.
- To combine the other if operations documented below the and, or, xor, and notelements can be used.
- The and, or, and xor elements can contain as many general if operations and modifier/combination elements (ie and, or, xor, and not).
-
-
-
-
-
-
- The then element is used to contain operations that will run if the condition evaluate to true.
- A then tag must be included, but can be empty.
-
-
-
-
-
-
diff --git a/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java b/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java
index 487351df5a..2b265c7a3b 100644
--- a/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java
+++ b/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
import org.ofbiz.minilang.SimpleMethod;
import org.ofbiz.minilang.method.MethodContext;
import org.ofbiz.minilang.method.MethodOperation;
@@ -33,13 +34,17 @@ import org.w3c.dom.Element;
/**
* Continually processes sub-ops while the condition remains true
*/
-public class While extends MethodOperation {
+public final class While extends MethodOperation {
- Conditional condition;
- List thenSubOps;
+ private final Conditional condition;
+ private final List thenSubOps;
public While(Element element, SimpleMethod simpleMethod) throws MiniLangException {
super(element, simpleMethod);
+ if (MiniLangValidate.validationOn()) {
+ MiniLangValidate.childElements(simpleMethod, element, "condition", "then");
+ MiniLangValidate.requiredChildElements(simpleMethod, element, "condition", "then");
+ }
Element conditionElement = UtilXml.firstChildElement(element, "condition");
Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
@@ -49,9 +54,6 @@ public class While extends MethodOperation {
@Override
public boolean exec(MethodContext methodContext) throws MiniLangException {
- // if conditions fails, always return true;
- // if a sub-op returns false return false and stop, otherwise drop though loop and
- // return true
while (condition.checkCondition(methodContext)) {
try {
for (MethodOperation methodOperation : thenSubOps) {
diff --git a/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java b/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java
index dc5cca8e85..bdb3f0d59b 100644
--- a/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java
+++ b/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java
@@ -23,9 +23,12 @@ import java.util.List;
import java.util.Map;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
import org.ofbiz.minilang.method.MethodContext;
import org.ofbiz.minilang.method.MethodOperation;
import org.ofbiz.minilang.method.envops.Break.BreakElementException;
@@ -35,51 +38,57 @@ import org.w3c.dom.Element;
/**
* Process sub-operations for each entry in the map
*/
-public class IterateMap extends MethodOperation {
+public final class IterateMap extends MethodOperation {
public static final String module = IterateMap.class.getName();
- ContextAccessor