Author: adrianc
Date: Fri Apr 27 12:46:46 2012
New Revision: 1331394
URL:
http://svn.apache.org/viewvc?rev=1331394&view=revLog:
Added auto-correct to the Mini-language <script> element.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java?rev=1331394&r1=1331393&r2=1331394&view=diff==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java Fri Apr 27 12:46:46 2012
@@ -38,6 +38,16 @@ public final class CallScript extends Me
public static final String module = CallScript.class.getName();
+ // This method is needed only during the v1 to v2 transition
+ private static boolean autoCorrect(Element element) {
+ String errorListAttr = element.getAttribute("error-list-name");
+ if (errorListAttr.length() > 0) {
+ element.removeAttribute("error-list-name");
+ return true;
+ }
+ return false;
+ }
+
private final String location;
private final String method;
private final Scriptlet scriptlet;
@@ -51,6 +61,10 @@ public final class CallScript extends Me
MiniLangValidate.scriptAttributes(simpleMethod, element, "script");
MiniLangValidate.noChildElements(simpleMethod, element);
}
+ boolean elementModified = autoCorrect(element);
+ if (elementModified && MiniLangUtil.autoCorrectOn()) {
+ MiniLangUtil.flagDocumentAsCorrected(element);
+ }
String scriptAttribute = element.getAttribute("script");
if (MiniLangUtil.containsScript(scriptAttribute)) {
this.scriptlet = new Scriptlet(StringUtil.convertOperatorSubstitutions(scriptAttribute));