YParameter inputParam = (YParameter) inputParams.get(i);
if (null != inputParam.getElementName()) {
String elementName = inputParam.getElementName();
ElementReuseInstruction instruction = new ElementReuseInstruction(elementName);
instructions.add(instruction);
} else if (null != inputParam.getDataTypeName()) {
String elementName = inputParam.getName();
String typeName = inputParam.getDataTypeName();
boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
ElementCreationInstruction instruction = new ElementCreationInstruction(
elementName, typeName, isPrimitiveType);
instructions.add(instruction);
}
// currently we convert untyped parameters into creation parameters, due to a bug in YAWL
else if (inputParam.isUntyped()) {
//UntypedElementInstruction instruction = new UntypedElementInstruction();
//instructions.add(instruction);
String elementName = inputParam.getName();
//String typeName = inputParam.getDataTypeName();
String typeName = "boolean";
boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
ElementCreationInstruction instruction = new ElementCreationInstruction(
elementName, typeName, isPrimitiveType);
instructions.add(instruction);
}
}
//for each output param build an instruction
List outputParams = paramsSignature.getOutputParams();
for (int i = 0; i < outputParams.size(); i++) {
YParameter outputParam = (YParameter) outputParams.get(i);
if (null != outputParam.getElementName()) {
String elementName = outputParam.getElementName();
ElementReuseInstruction instruction = new ElementReuseInstruction(elementName);
// if an instruction with the same name already exists in the instruction list
// remove it and add the instruction for this parameter
if (instructions.contains(instruction) == true) {
// Matching element REUSE instruction found.
Instruction tempInstruction;
int position = instructions.indexOf(instruction);
tempInstruction = (Instruction) instructions.get(position);
if (tempInstruction.getElementName().compareTo(instruction.getElementName()) == 0) {
instructions.remove(position);
}
}
else {
logger.debug("No matching element REUSE instruction found: " + elementName);