changed which implement other services to specifiy if the parameters should be optional or default to the inherited service; rather than always being optional.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@492815 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -145,6 +145,15 @@ under the License.
|
||||
</xs:element>
|
||||
<xs:attributeGroup name="attlist.implements">
|
||||
<xs:attribute type="xs:string" name="service" use="required"/>
|
||||
<xs:attribute type="xs:string" name="optional" default="true">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:enumeration value="true"/>
|
||||
<xs:enumeration value="false"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
</xs:attribute>
|
||||
</xs:attributeGroup>
|
||||
<xs:element name="auto-attributes">
|
||||
<xs:complexType>
|
||||
|
||||
@@ -824,7 +824,10 @@ public class ModelService implements Serializable {
|
||||
if (implServices != null && implServices.size() > 0 && dctx != null) {
|
||||
Iterator implIter = implServices.iterator();
|
||||
while (implIter.hasNext()) {
|
||||
String serviceName = (String) implIter.next();
|
||||
ModelServiceIface iface = (ModelServiceIface) implIter.next();
|
||||
String serviceName = iface.getService();
|
||||
boolean optional = iface.isOptional();
|
||||
|
||||
ModelService model = dctx.getModelService(serviceName);
|
||||
if (model != null) {
|
||||
Iterator contextParamIter = model.contextParamList.iterator();
|
||||
@@ -836,12 +839,17 @@ public class ModelService implements Serializable {
|
||||
// TODO: this is another case where having different optional/required settings for IN and OUT would be quite valuable...
|
||||
if (!"INOUT".equals(existingParam.mode) && !existingParam.mode.equals(newParam.mode)) {
|
||||
existingParam.mode = "INOUT";
|
||||
existingParam.optional = true;
|
||||
}
|
||||
if (existingParam.optional || newParam.optional) {
|
||||
existingParam.optional = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// instead of calling: addParamClone(param), do it here because we want to make the inputs optional and such because earlier services in a group may create the parameters for later
|
||||
ModelParam newParamClone = new ModelParam(newParam);
|
||||
newParamClone.optional = true;
|
||||
if (optional) {
|
||||
// default option is to make this optional, however the service can override and
|
||||
// force the clone to use the parents setting.
|
||||
newParamClone.optional = true;
|
||||
}
|
||||
this.addParam(newParamClone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,8 +402,10 @@ public class ModelServiceReader implements Serializable {
|
||||
while (implIter.hasNext()) {
|
||||
Element implement = (Element) implIter.next();
|
||||
String serviceName = UtilXml.checkEmpty(implement.getAttribute("service"));
|
||||
boolean optional = UtilXml.checkBoolean(implement.getAttribute("optional"), false);
|
||||
if (serviceName.length() > 0)
|
||||
service.implServices.add(serviceName);
|
||||
service.implServices.add(new ModelServiceIface(serviceName, optional));
|
||||
//service.implServices.add(serviceName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user