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 2007/07/18 02:46:18 UTC
svn commit: r557102 - in /ofbiz/trunk/framework/minilang:
dtd/simple-methods.xsd
src/org/ofbiz/minilang/method/callops/SetServiceFields.java
Author: jonesde
Date: Tue Jul 17 17:46:17 2007
New Revision: 557102
URL: http://svn.apache.org/viewvc?view=rev&rev=557102
Log:
Changed set-service-fields to add validation errors to a list instead of quiting, then calling method can control what to do with them
Modified:
ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java
Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd?view=diff&rev=557102&r1=557101&r2=557102
==============================================================================
--- ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd (original)
+++ ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd Tue Jul 17 17:46:17 2007
@@ -471,6 +471,15 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute type="xs:string" name="error-list-name" default="error_list">
+ <xs:annotation>
+ <xs:documentation>
+ The name of a list in the method environment that the error messages will be added to.
+ Will be created if it does not exist.
+ Defaults to "error_list".
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
<xs:element name="call-service" substitutionGroup="CallOperations">
<xs:annotation>
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java?view=diff&rev=557102&r1=557101&r2=557102
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java Tue Jul 17 17:46:17 2007
@@ -20,6 +20,8 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import org.ofbiz.base.util.Debug;
@@ -46,15 +48,23 @@
String serviceName;
ContextAccessor mapAcsr;
ContextAccessor toMapAcsr;
+ ContextAccessor errorListAcsr;
public SetServiceFields(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
serviceName = element.getAttribute("service-name");
mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name"));
+ errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list");
}
public boolean exec(MethodContext methodContext) {
+ List messages = (List) errorListAcsr.get(methodContext);
+ if (messages == null) {
+ messages = new LinkedList();
+ errorListAcsr.put(methodContext, messages);
+ }
+
String serviceName = methodContext.expandString(this.serviceName);
Map fromMap = (Map) mapAcsr.get(methodContext);
@@ -92,7 +102,7 @@
} catch (GeneralException e) {
String errMsg = "Could not convert field value for the parameter/attribute: [" + modelParam.name + "] on the [" + serviceName + "] service to the [" + modelParam.type + "] type for the value [" + value + "]: " + e.toString();
Debug.logError(e, errMsg, module);
- throw new IllegalArgumentException(errMsg);
+ messages.add(errMsg);
}
}