// Validate existence of the referenced ToolId
if (!applicationIds.contains(toolId)
&& !(applicationIds.contains
(new PSK(processId, toolId)))) {
faultless = false;
eh.add (new PrioritizedMessage
(PrioritizedMessage.Priority.ERROR,
bundleBase + "#procdef.tool.notfound",
new Object[]{toolId, activityId, processId}));
}
}
}
Iterator toolsIterator = tools.keySet().iterator();
while (toolsIterator.hasNext()) {
String tid = (String)toolsIterator.next();
String[] actualParams = ((ToolInfo)tools.get(tid)).actualParams;
// reference to process local tool?
ApplicationDefinition applDef
= (ApplicationDefinition)applicationDefs
.get (new PSK(processId, tid));
// reference to package level tool?
if (applDef == null) {
applDef = (ApplicationDefinition)applicationDefs.get(tid);
}
// the referenced tool is invalid.
if (applDef == null) {
return false;
}
FormalParameter[] formalParams = applDef.formalParameters();
// check the match of formal parameters and actual parameters
if (actualParams.length != formalParams.length) {
eh.add (new PrioritizedMessage
(PrioritizedMessage.Priority.ERROR,
bundleBase + "#procdef.toolimpl.params.notmatched",
new Object[]{tid, activityId, processId}));
return false;
}
// verify the actual parameters have been defined in data fields.
for (int i = 0; i < actualParams.length; i++) {
String actParam = actualParams[i];
if (procdataMap.containsKey(actParam)) {
boolean compat = true;
if (formalParams[i].mode().equals(FormalParameter.Mode.IN)
|| formalParams[i].mode()
.equals(FormalParameter.Mode.INOUT)) {
compat = typeCompatible
(formalParams[i].type(), XPDLUtil.extractDataType
(((ProcData)procdataMap.get(actParam)).dataType));
}
if (formalParams[i].mode().equals(FormalParameter.Mode.OUT)
|| formalParams[i].mode()
.equals(FormalParameter.Mode.INOUT)) {
compat = typeCompatible
(XPDLUtil.extractDataType
(((ProcData)procdataMap.get(actParam)).dataType),
formalParams[i].type());
}
if (!compat) {
eh.add
(new PrioritizedMessage
(PrioritizedMessage.Priority.ERROR, bundleBase
+ "#procdef.toolimpl.paramsdatatype.notmatched",
new Object[]{tid, activityId, processId,
actParam}));
return false;
}
} else {
if (formalParams[i].mode() != FormalParameter.Mode.IN) {
eh.add (new PrioritizedMessage
(PrioritizedMessage.Priority.ERROR, bundleBase
+ "#procdef.toolimpl.params.datanotfound",
new Object[]{actParam, tid, activityId,
processId}));
return false;
}
if (XPDLUtil.isXMLType (formalParams[i].type())) {
String res = notXMLOrValid (actParam);
if (res != null) {
eh.add
(new PrioritizedMessage
(PrioritizedMessage.Priority.ERROR, bundleBase
+ "#procdef.toolimpl.params.invalidXML",
new Object[]{actParam, tid, activityId,
processId, res}));
return false;