use of io.automatiko.engine.workflow.base.core.ParameterDefinition in project automatiko-engine by automatiko-io.
the class ParameterHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String name = attrs.getValue("name");
emptyAttributeCheck(localName, "name", name, parser);
Work work = (Work) parser.getParent();
ParameterDefinition parameterDefinition = new ParameterDefinitionImpl();
parameterDefinition.setName(name);
work.addParameterDefinition(parameterDefinition);
return new ParameterWrapper(parameterDefinition, work);
}
use of io.automatiko.engine.workflow.base.core.ParameterDefinition 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);
}
}
use of io.automatiko.engine.workflow.base.core.ParameterDefinition in project automatiko-engine by automatiko-io.
the class WorkItemNodeFactory method workParameterDefinition.
public WorkItemNodeFactory workParameterDefinition(String name, DataType dataType) {
Work work = getWorkItemNode().getWork();
if (work == null) {
work = new WorkImpl();
getWorkItemNode().setWork(work);
}
Set<ParameterDefinition> parameterDefinitions = work.getParameterDefinitions();
parameterDefinitions.add(new ParameterDefinitionImpl(name, dataType));
work.setParameterDefinitions(parameterDefinitions);
return this;
}
Aggregations