Package org.activiti.engine.impl.bpmn.behavior

Examples of org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior


                }
            }
        }

        if ("callActivity".equals(properties.get("type"))) {
            CallActivityBehavior callActivityBehavior = null;

            if (activityBehavior instanceof CallActivityBehavior) {
                callActivityBehavior = (CallActivityBehavior) activityBehavior;
            }

            if (callActivityBehavior != null) {
                propertiesJSON.put("processDefinitonKey",
                        callActivityBehavior.getProcessDefinitonKey());

                // get processDefinitonId from execution or get last processDefinitonId
                // by key
                ArrayNode processInstanceArray = new ObjectMapper()
                        .createArrayNode();

                if (processInstance != null) {
                    List<Execution> executionList = runtimeService
                            .createExecutionQuery()
                            .processInstanceId(processInstanceId)
                            .activityId(activity.getId()).list();

                    if (executionList.size() > 0) {
                        for (Execution execution : executionList) {
                            ObjectNode processInstanceJSON = subProcessInstanceMap
                                    .get(execution.getId());
                            processInstanceArray.add(processInstanceJSON);
                        }
                    }
                }

                // If active activities nas no instance of this callActivity then add
                // last definition
                if (processInstanceArray.size() == 0) {
                    // Get last definition by key
                    ProcessDefinition lastProcessDefinition = repositoryService
                            .createProcessDefinitionQuery()
                            .processDefinitionKey(
                                    callActivityBehavior
                                            .getProcessDefinitonKey())
                            .latestVersion().singleResult();

                    // TODO: unuseful fields there are processDefinitionName,
                    // processDefinitionKey
View Full Code Here


      }

    }

    if ("callActivity".equals(properties.get("type"))) {
      CallActivityBehavior callActivityBehavior = null;

      if (activityBehavior instanceof CallActivityBehavior) {
        callActivityBehavior = (CallActivityBehavior) activityBehavior;
      }

      if (callActivityBehavior != null) {
        propertiesJSON.put("processDefinitonKey", callActivityBehavior.getProcessDefinitonKey());

        // get processDefinitonId from execution or get last processDefinitonId
        // by key
        ArrayNode processInstanceArray = new ObjectMapper().createArrayNode();
        if (processInstance != null) {
          List<Execution> executionList = runtimeService.createExecutionQuery()
              .processInstanceId(processInstanceId)
              .activityId(activity.getId()).list();
          if (!executionList.isEmpty()) {
            for (Execution execution : executionList) {
              ObjectNode processInstanceJSON = subProcessInstanceMap.get(execution.getId());
              processInstanceArray.add(processInstanceJSON);
            }
          }
        }

        // If active activities nas no instance of this callActivity then add
        // last definition
        if (processInstanceArray.size() == 0) {
          // Get last definition by key
          ProcessDefinition lastProcessDefinition = repositoryService
              .createProcessDefinitionQuery()
              .processDefinitionKey(callActivityBehavior.getProcessDefinitonKey())
              .latestVersion().singleResult();

          // TODO: unuseful fields there are processDefinitionName,
          // processDefinitionKey
          ObjectNode processInstanceJSON = new ObjectMapper().createObjectNode();
View Full Code Here

  // Call activity
 
  public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) {
    String expressionRegex = "\\$+\\{+.+\\}";
   
    CallActivityBehavior callActivityBehaviour = null;
    if (StringUtils.isNotEmpty(callActivity.getCalledElement()) && callActivity.getCalledElement().matches(expressionRegex)) {
      callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(callActivity.getCalledElement()));
    } else {
      callActivityBehaviour = new CallActivityBehavior(callActivity.getCalledElement());
    }

    for (IOParameter ioParameter : callActivity.getInParameters()) {
      if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) {
        Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim());
        callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(expression, ioParameter.getTarget()));
      } else {
        callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(ioParameter.getSource(), ioParameter.getTarget()));
      }
    }
   
    for (IOParameter ioParameter : callActivity.getOutParameters()) {
      if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) {
        Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim());
        callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(ioParameter.getTarget(), expression));
      } else {
        callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(ioParameter.getTarget(), ioParameter.getSource()));
      }
    }
   
    return callActivityBehaviour;
  }
View Full Code Here

    String calledElement = callActivityElement.attribute("calledElement");
    if (calledElement == null) {
      addError("Missing attribute 'calledElement'", callActivityElement);
    }

    CallActivityBehavior callActivityBehaviour = null;
    String expressionRegex = "\\$+\\{+.+\\}";
    if (calledElement != null && calledElement.matches(expressionRegex)) {
      callActivityBehaviour = new CallActivityBehavior(expressionManager.createExpression(calledElement));
    } else {
      callActivityBehaviour = new CallActivityBehavior(calledElement);
    }

    Element extentionsElement = callActivityElement.element("extensionElements");
    if (extentionsElement != null) {
      // input data elements
      for (Element listenerElement : extentionsElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "in")) {
        String sourceExpression = listenerElement.attribute("sourceExpression");
        String target = listenerElement.attribute("target");
        if (sourceExpression != null) {
          Expression expression = expressionManager.createExpression(sourceExpression.trim());
          callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(expression, target));
        } else {
          String source = listenerElement.attribute("source");
          callActivityBehaviour.addDataInputAssociation(new SimpleDataInputAssociation(source, target));
        }
      }
      // output data elements
      for (Element listenerElement : extentionsElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "out")) {
        String sourceExpression = listenerElement.attribute("sourceExpression");
        String target = listenerElement.attribute("target");
        if (sourceExpression != null) {
          Expression expression = expressionManager.createExpression(sourceExpression.trim());
          callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(target, expression));
        } else {
          String source = listenerElement.attribute("source");
          callActivityBehaviour.addDataOutputAssociation(new MessageImplicitDataOutputAssociation(target, source));
        }
      }
    }

    // // parse data input and output
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior

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.