use of io.automatiko.engine.workflow.bpmn2.core.ItemDefinition in project automatiko-engine by automatiko-io.
the class TaskHandler method handleNode.
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
super.handleNode(node, element, uri, localName, parser);
itemDefinitions = (Map<String, ItemDefinition>) ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
dataTypeInputs.clear();
dataTypeOutputs.clear();
WorkItemNode workItemNode = (WorkItemNode) node;
String name = getTaskName(element);
Work work = new WorkImpl();
work.setName(name);
workItemNode.setWork(work);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("ioSpecification".equals(nodeName)) {
readIoSpecification(xmlNode, dataInputs, dataOutputs, dataInputTypes);
} else if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, workItemNode, dataInputs);
} else if ("dataOutputAssociation".equals(nodeName)) {
readDataOutputAssociation(xmlNode, workItemNode, dataOutputs);
}
xmlNode = xmlNode.getNextSibling();
}
workItemNode.setMetaData("DataInputs", new LinkedHashMap<String, String>(dataTypeInputs));
workItemNode.setMetaData("DataOutputs", new LinkedHashMap<String, String>(dataTypeOutputs));
handleScript(workItemNode, element, "onEntry");
handleScript(workItemNode, element, "onExit");
String compensation = element.getAttribute("isForCompensation");
if (compensation != null) {
boolean isForCompensation = Boolean.parseBoolean(compensation);
if (isForCompensation) {
workItemNode.setMetaData("isForCompensation", isForCompensation);
}
}
for (Entry<String, String> entryInputTypes : dataTypeInputs.entrySet()) {
ParameterDefinition parameterDefinition = new ParameterDefinitionImpl();
parameterDefinition.setName(entryInputTypes.getKey());
parameterDefinition.setType(new ObjectDataType(constructClass(entryInputTypes.getValue()), entryInputTypes.getValue()));
work.addParameterDefinition(parameterDefinition);
}
}
Aggregations