Package org.jbpm.workflow.core.node

Examples of org.jbpm.workflow.core.node.HumanTaskNode


        process.addNode(new MilestoneNode());
        process.addNode(new RuleSetNode());
        process.addNode(new SubProcessNode());
        process.addNode(new WorkItemNode());
        process.addNode(new TimerNode());
        process.addNode(new HumanTaskNode());
        process.addNode(new ForEachNode());
        process.addNode(new CompositeContextNode());
        process.addNode(new EventNode());
        process.addNode(new FaultNode());
        process.addNode(new StateNode());
View Full Code Here


        workItemNode.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
        process.addNode(workItemNode);
        connection = new ConnectionImpl(subProcess, Node.CONNECTION_DEFAULT_TYPE, workItemNode, Node.CONNECTION_DEFAULT_TYPE);
        connection.setMetaData("bendpoints", "[]");
       
        HumanTaskNode humanTaskNode = new HumanTaskNode();
        humanTaskNode.setName("Human Task");
        work = humanTaskNode.getWork();
        parameterDefinitions = new HashSet<ParameterDefinition>();
        parameterDefinition = new ParameterDefinitionImpl("TaskName", new StringDataType());
        parameterDefinitions.add(parameterDefinition);
        parameterDefinition = new ParameterDefinitionImpl("ActorId", new StringDataType());
        parameterDefinitions.add(parameterDefinition);
        parameterDefinition = new ParameterDefinitionImpl("Priority", new StringDataType());
        parameterDefinitions.add(parameterDefinition);
        parameterDefinition = new ParameterDefinitionImpl("Comment", new StringDataType());
        parameterDefinitions.add(parameterDefinition);
        work.setParameterDefinitions(parameterDefinitions);
        work.setParameter("TaskName", "Do something");
        work.setParameter("ActorId", "John Doe");
        humanTaskNode.setWaitForCompletion(false);
        humanTaskNode.setActions(ExtendedNodeImpl.EVENT_NODE_ENTER, actions);
        humanTaskNode.setActions(ExtendedNodeImpl.EVENT_NODE_EXIT, actions);
        process.addNode(humanTaskNode);
        connection = new ConnectionImpl(workItemNode, Node.CONNECTION_DEFAULT_TYPE, humanTaskNode, Node.CONNECTION_DEFAULT_TYPE);
       
        TimerNode timerNode = new TimerNode();
        timerNode.setName("timer");
View Full Code Here

    public 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;
        final String swimlane = element.getAttribute("swimlane");
        if (swimlane != null && !"".equals(swimlane)) {
            humanTaskNode.setSwimlane(swimlane);
        }
    }
View Full Code Here

            humanTaskNode.setSwimlane(swimlane);
        }
    }

    protected Node createNode() {
        return new HumanTaskNode();
    }
View Full Code Here

        endNode("humanTask", xmlDump);
    }
   
  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 + "\" ");
      }
  }
View Full Code Here

import org.xml.sax.SAXException;

public class UserTaskHandler extends TaskHandler {
   
    protected Node createNode(Attributes attrs) {
        return new HumanTaskNode();
    }
View Full Code Here

    }

    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");
      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();
          if ("ioSpecification".equals(nodeName)) {
            readIoSpecification(xmlNode, dataInputs, dataOutputs);
//          } else if ("dataInputAssociation".equals(nodeName)) {
//           readDataInputAssociation(xmlNode, humanTaskNode, dataInputs);
  //        } else if ("dataOutputAssociation".equals(nodeName)) {
   //         readDataOutputAssociation(xmlNode, humanTaskNode, dataOutputs);
          } else if ("potentialOwner".equals(nodeName)) {
            owners.add(readPotentialOwner(xmlNode, humanTaskNode));
          }
        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);         
        }
    }
View Full Code Here

    protected String readPotentialOwner(org.w3c.dom.Node xmlNode, HumanTaskNode humanTaskNode) {
    return xmlNode.getFirstChild().getFirstChild().getFirstChild().getTextContent();
    }
   
  public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
    HumanTaskNode humanTaskNode = (HumanTaskNode) node;
    writeNode("userTask", humanTaskNode, xmlDump, metaDataType);
    xmlDump.append(">" + EOL);
    writeScripts(humanTaskNode, xmlDump);
    writeIO(humanTaskNode, xmlDump);
    String ownerString = (String) humanTaskNode.getWork().getParameter("ActorId");
    if (ownerString != null) {
      String[] owners = ownerString.split(",");
      for (String owner: owners) {
        xmlDump.append(
          "      <potentialOwner>" + EOL +
View Full Code Here

    public HumanTaskNodeFactory(RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) {
        super(nodeContainerFactory, nodeContainer, id);
    }

    protected Node createNode() {
        return new HumanTaskNode();
    }
View Full Code Here

        } else {
          ongoingCases.put(name, testCode);
          return false;
        }
      } else if (currentNode instanceof HumanTaskNode) {
        HumanTaskNode taskNode = (HumanTaskNode) currentNode;
        String actorId = (String) taskNode.getWork().getParameter("ActorId");
        if (actorId == null) {
          actorId = "";
        }
        String groupId = (String) taskNode.getWork().getParameter("GroupId");
        if (groupId == null) {
          groupId = "";
        }
        String[] actorIds = new String[0];
        if (actorId.trim().length() > 0) {
          actorIds = actorId.split(",");
        }
        String[] groupIds = new String[0];
        if (groupId.trim().length() > 0) {
          groupIds = groupId.split(",");
        }
        actorId = actorIds.length > 0 ? actorIds[0] : "";
        if (firstHumanTask) {
          testCode +=
            "        // execute task\n" +
            "        String actorId = \"" + actorId + "\";\n" +
            "        List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner(actorId, \"en-UK\");\n" +
            "        TaskSummary task = list.get(0);\n";
        } else {
          testCode +=
            "        // execute task\n" +
            "        actorId = \"" + actorId + "\";\n" +
            "        list = taskService.getTasksAssignedAsPotentialOwner(actorId, \"en-UK\");\n" +
            "        task = list.get(0);\n";
        }
        if (actorIds.length > 1 || groupIds.length > 0) {
          testCode +=
              "        taskService.claim(task.getId(), actorId);\n";
        }
        if (firstHumanTask) {
          testCode +=
            "        taskService.start(task.getId(), actorId);\n" +
          "        Map<String, Object> results = new HashMap<String, Object>();\n" +
          "        // add results here\n";
          firstHumanTask = false;
        } else {
          testCode +=
            "        taskService.start(task.getId(), actorId);\n" +
          "        results = new HashMap<String, Object>();\n" +
          "        // add results here\n";
        }
        for (Map.Entry<String, String> entry: taskNode.getOutMappings().entrySet()) {
          String type = null;
          VariableScope variableScope = (VariableScope) taskNode.resolveContext(VariableScope.VARIABLE_SCOPE, entry.getValue());
          if (variableScope != null) {
            type = variableScope.findVariable(entry.getValue()).getType().getStringType();
          }
          testCode +=
            "        // results.put(\"" + entry.getKey() + "\", value);" + (type == null ? "" : " // type " + type) + "\n";
        }
        testCode +=
          "        taskService.complete(task.getId(), actorId, results);\n" +
          "\n";
        return processNodes(name, ((NodeImpl) currentNode).getTo().getTo(), testCode, cases, ongoingCases);
      } else if (currentNode instanceof WorkItemNode) {
        WorkItemNode taskNode = (WorkItemNode) currentNode;
        testCode +=
          "        // if necessary, complete request for service task \"" + taskNode.getWork().getName() + "\"\n";
        return processNodes(name, ((NodeImpl) currentNode).getTo().getTo(), testCode, cases, ongoingCases);
      } else if (currentNode instanceof EventNode) {
        EventNode eventNode = (EventNode) currentNode;
        testCode +=
          "        ksession.signalEvent(\"" + eventNode.getType() + "\", null, processInstance.getId());\n";
View Full Code Here

TOP

Related Classes of org.jbpm.workflow.core.node.HumanTaskNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.