Search in sources :

Example 6 with HumanTaskNode

use of io.automatiko.engine.workflow.process.core.node.HumanTaskNode in project automatiko-engine by automatiko-io.

the class ProcessToExecModelGenerator method generateUserTaskModel.

public List<UserTaskModelMetaData> generateUserTaskModel(WorkflowProcess process, boolean templateSupported) {
    String packageName = process.getPackageName();
    List<UserTaskModelMetaData> usertaskModels = new ArrayList<>();
    VariableScope variableScope = (VariableScope) ((io.automatiko.engine.workflow.base.core.Process) process).getDefaultContext(VariableScope.VARIABLE_SCOPE);
    for (Node node : ((WorkflowProcessImpl) process).getNodesRecursively()) {
        if (node instanceof HumanTaskNode) {
            HumanTaskNode humanTaskNode = (HumanTaskNode) node;
            VariableScope nodeVariableScope = (VariableScope) ((ContextContainer) humanTaskNode.getParentContainer()).getDefaultContext(VariableScope.VARIABLE_SCOPE);
            if (nodeVariableScope == null) {
                nodeVariableScope = variableScope;
            }
            usertaskModels.add(new UserTaskModelMetaData(packageName, variableScope, nodeVariableScope, humanTaskNode, process.getId(), ModelMetaData.version(process.getVersion()), templateSupported));
        }
    }
    return usertaskModels;
}
Also used : Node(io.automatiko.engine.api.definition.process.Node) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode) ArrayList(java.util.ArrayList) WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode)

Example 7 with HumanTaskNode

use of io.automatiko.engine.workflow.process.core.node.HumanTaskNode in project automatiko-engine by automatiko-io.

the class HumanTaskNodeHandler method visitParameters.

protected void visitParameters(WorkItemNode workItemNode, StringBuilder xmlDump) {
    super.visitParameters(workItemNode, xmlDump);
    HumanTaskNode humanTaskNode = (HumanTaskNode) workItemNode;
    String swimlane = humanTaskNode.getSwimlane();
    if (swimlane != null) {
        xmlDump.append("swimlane=\"" + swimlane + "\" ");
    }
}
Also used : HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode)

Example 8 with HumanTaskNode

use of io.automatiko.engine.workflow.process.core.node.HumanTaskNode in project automatiko-engine by automatiko-io.

the class ProcessHandler method assignLanes.

private void assignLanes(NodeContainer nodeContainer, Map<String, String> laneMapping) {
    for (Node node : nodeContainer.getNodes()) {
        String lane = null;
        String uniqueId = (String) node.getMetaData().get("UniqueId");
        if (uniqueId != null) {
            lane = laneMapping.get(uniqueId);
        } else {
            lane = laneMapping.get(XmlBPMNProcessDumper.getUniqueNodeId(node));
        }
        if (lane != null) {
            ((NodeImpl) node).setMetaData("Lane", lane);
            if (node instanceof HumanTaskNode) {
                ((HumanTaskNode) node).setSwimlane(lane);
            }
        }
        if (node instanceof NodeContainer) {
            assignLanes((NodeContainer) node, laneMapping);
        }
    }
}
Also used : NodeImpl(io.automatiko.engine.workflow.process.core.impl.NodeImpl) ExtendedNodeImpl(io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl) StateBasedNode(io.automatiko.engine.workflow.process.core.node.StateBasedNode) CompositeContextNode(io.automatiko.engine.workflow.process.core.node.CompositeContextNode) ActionNode(io.automatiko.engine.workflow.process.core.node.ActionNode) FaultNode(io.automatiko.engine.workflow.process.core.node.FaultNode) EventSubProcessNode(io.automatiko.engine.workflow.process.core.node.EventSubProcessNode) StateNode(io.automatiko.engine.workflow.process.core.node.StateNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) SubProcessNode(io.automatiko.engine.workflow.process.core.node.SubProcessNode) RuleSetNode(io.automatiko.engine.workflow.process.core.node.RuleSetNode) CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) Node(io.automatiko.engine.api.definition.process.Node) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode) BoundaryEventNode(io.automatiko.engine.workflow.process.core.node.BoundaryEventNode) StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) EndNode(io.automatiko.engine.workflow.process.core.node.EndNode) EventNode(io.automatiko.engine.workflow.process.core.node.EventNode) NodeContainer(io.automatiko.engine.api.definition.process.NodeContainer) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode)

Example 9 with HumanTaskNode

use of io.automatiko.engine.workflow.process.core.node.HumanTaskNode in project automatiko-engine by automatiko-io.

the class UserTaskHandler 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);
    HumanTaskNode humanTaskNode = (HumanTaskNode) node;
    Work work = humanTaskNode.getWork();
    work.setName("Human Task");
    ProcessBuildData buildData = (ProcessBuildData) parser.getData();
    Map<String, Resource> resources = (Map<String, Resource>) buildData.getMetaData("Resources");
    Map<String, String> dataInputs = new HashMap<String, String>();
    Map<String, String> dataOutputs = new HashMap<String, String>();
    List<String> owners = new ArrayList<String>();
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        // ioSpec and data{Input,Output}Spec handled in super.handleNode(...)
        if ("potentialOwner".equals(nodeName)) {
            String owner = readPotentialOwner(xmlNode, humanTaskNode);
            if (owner != null) {
                owners.add(owner);
            }
        } else if ("performer".equals(nodeName)) {
            org.w3c.dom.Node resourceNode = xmlNode.getFirstChild();
            if (resourceNode != null) {
                String resourceId = resourceNode.getTextContent();
                if (resources.containsKey(resourceId)) {
                    owners.add(resources.get(resourceId).getName());
                }
            }
        }
        xmlNode = xmlNode.getNextSibling();
    }
    if (owners.size() > 0) {
        String owner = owners.get(0);
        for (int i = 1; i < owners.size(); i++) {
            owner += "," + owners.get(i);
        }
        humanTaskNode.getWork().setParameter("ActorId", owner);
    }
    humanTaskNode.getWork().setParameter("NodeName", humanTaskNode.getName());
}
Also used : HashMap(java.util.HashMap) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) Node(io.automatiko.engine.workflow.process.core.Node) Resource(io.automatiko.engine.workflow.bpmn2.core.Resource) ArrayList(java.util.ArrayList) ProcessBuildData(io.automatiko.engine.workflow.compiler.xml.ProcessBuildData) Work(io.automatiko.engine.workflow.base.core.Work) HashMap(java.util.HashMap) Map(java.util.Map) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode)

Aggregations

HumanTaskNode (io.automatiko.engine.workflow.process.core.node.HumanTaskNode)9 Node (io.automatiko.engine.api.definition.process.Node)4 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)4 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)3 BoundaryEventNode (io.automatiko.engine.workflow.process.core.node.BoundaryEventNode)3 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)3 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)3 EventNode (io.automatiko.engine.workflow.process.core.node.EventNode)3 EventSubProcessNode (io.automatiko.engine.workflow.process.core.node.EventSubProcessNode)3 FaultNode (io.automatiko.engine.workflow.process.core.node.FaultNode)3 RuleSetNode (io.automatiko.engine.workflow.process.core.node.RuleSetNode)3 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)3 StateNode (io.automatiko.engine.workflow.process.core.node.StateNode)3 SubProcessNode (io.automatiko.engine.workflow.process.core.node.SubProcessNode)3 ArrayList (java.util.ArrayList)3 Work (io.automatiko.engine.workflow.base.core.Work)2 ExtendedNodeImpl (io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl)2 NodeImpl (io.automatiko.engine.workflow.process.core.impl.NodeImpl)2 CompositeContextNode (io.automatiko.engine.workflow.process.core.node.CompositeContextNode)2 StateBasedNode (io.automatiko.engine.workflow.process.core.node.StateBasedNode)2