Search in sources :

Example 6 with ParameterDefinition

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);
}
Also used : Work(io.automatiko.engine.workflow.base.core.Work) ParameterDefinitionImpl(io.automatiko.engine.workflow.base.core.impl.ParameterDefinitionImpl) ParameterDefinition(io.automatiko.engine.workflow.base.core.ParameterDefinition)

Example 7 with ParameterDefinition

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);
    }
}
Also used : ItemDefinition(io.automatiko.engine.workflow.bpmn2.core.ItemDefinition) ObjectDataType(io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType) ParameterDefinitionImpl(io.automatiko.engine.workflow.base.core.impl.ParameterDefinitionImpl) ProcessBuildData(io.automatiko.engine.workflow.compiler.xml.ProcessBuildData) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) Work(io.automatiko.engine.workflow.base.core.Work) WorkImpl(io.automatiko.engine.workflow.base.core.impl.WorkImpl) ParameterDefinition(io.automatiko.engine.workflow.base.core.ParameterDefinition)

Example 8 with 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;
}
Also used : Work(io.automatiko.engine.workflow.base.core.Work) WorkImpl(io.automatiko.engine.workflow.base.core.impl.WorkImpl) ParameterDefinitionImpl(io.automatiko.engine.workflow.base.core.impl.ParameterDefinitionImpl) ParameterDefinition(io.automatiko.engine.workflow.base.core.ParameterDefinition)

Aggregations

ParameterDefinition (io.automatiko.engine.workflow.base.core.ParameterDefinition)8 Work (io.automatiko.engine.workflow.base.core.Work)4 ParameterDefinitionImpl (io.automatiko.engine.workflow.base.core.impl.ParameterDefinitionImpl)4 WorkImpl (io.automatiko.engine.workflow.base.core.impl.WorkImpl)4 ArrayList (java.util.ArrayList)4 ObjectDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType)2 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)2 HumanTaskWorkItem (io.automatiko.engine.api.runtime.process.HumanTaskWorkItem)1 GroupedNamedDataType (io.automatiko.engine.api.workflow.GroupedNamedDataType)1 IOEventDescription (io.automatiko.engine.api.workflow.IOEventDescription)1 NamedDataType (io.automatiko.engine.api.workflow.NamedDataType)1 DataType (io.automatiko.engine.api.workflow.datatype.DataType)1 Variable (io.automatiko.engine.workflow.base.core.context.variable.Variable)1 IntegerDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.IntegerDataType)1 StringDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.StringDataType)1 ItemDefinition (io.automatiko.engine.workflow.bpmn2.core.ItemDefinition)1 ProcessBuildData (io.automatiko.engine.workflow.compiler.xml.ProcessBuildData)1 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)1 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)1 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)1