Package org.activiti.engine.impl.pvm.process

Examples of org.activiti.engine.impl.pvm.process.ActivityImpl


  public void parse(BpmnParse bpmnParse, BaseElement element) {
    if (element instanceof SequenceFlow) {
      TransitionImpl transition = bpmnParse.getSequenceFlows().get(element.getId());
      transition.addExecutionListener(new CdiExecutionListener(transition.getId()));
    } else {
      ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(element.getId());
      if (element instanceof UserTask) {
        addCreateListener(activity);
        addAssignListener(activity);
        addCompleteListener(activity);
        addDeleteListener(activity);
View Full Code Here


          .endActivity()
        .endActivity()
      .endActivity()
    .buildProcessDefinition();
   
    ActivityImpl alternativeInitial = (ActivityImpl) processDefinition.findActivity("waitInFirst");
    PvmProcessInstance processInstance = ((ProcessDefinitionImpl)processDefinition).createProcessInstanceForInitial(alternativeInitial);
    processInstance.start();
   
    List<String> expectedEvents = new ArrayList<String>();
    expectedEvents.add("start on ProcessDefinition(scopes and events)");
View Full Code Here

      CustomSetConditionsExecutionListener customFlowListener = new CustomSetConditionsExecutionListener();
      customFlowListener.setFlowId(flow.getId());
      for (ExtensionElement conditionElement : conditionsElements) {
        customFlowListener.addCondition(conditionElement.getElementText());
      }
      ActivityImpl activity = findActivity(bpmnParse, flow.getSourceRef());
      activity.addExecutionListener("start", customFlowListener);
    }
  }
View Full Code Here

      }
    }
     
    while (!hisActInstList.isEmpty()) {
      HistoricActivityInstance histActInst = hisActInstList.removeFirst();
      ActivityImpl activity = activityMap.get(histActInst.getActivityId());
      if (activity != null) {
        boolean isParallel = false;
        String type = histActInst.getActivityType();
        if ("parallelGateway".equals(type) || "inclusiveGateway".equals(type)){
          isParallel = true;
        } else if ("subProcess".equals(histActInst.getActivityType())){
          getHighlightedFlows(activity.getActivities(), hisActInstList, highLightedFlows);
        }
       
        List<PvmTransition> allOutgoingTrans = new ArrayList<PvmTransition>();
        allOutgoingTrans.addAll(activity.getOutgoingTransitions());
        allOutgoingTrans.addAll(getBoundaryEventOutgoingTransitions(activity));
        List<String> activityHighLightedFlowIds = getHighlightedFlows(allOutgoingTrans, hisActInstList, isParallel);
        highLightedFlows.addAll(activityHighLightedFlowIds);
      }
    }
View Full Code Here

      else if (prop instanceof Integer)
        propertiesJSON.put(key, (Integer) properties.get(key));
      else if (prop instanceof Boolean)
        propertiesJSON.put(key, (Boolean) properties.get(key));
      else if ("initial".equals(key)) {
        ActivityImpl act = (ActivityImpl) properties.get(key);
        propertiesJSON.put(key, act.getId());
      } else if ("timerDeclarations".equals(key)) {
        ArrayList<TimerDeclarationImpl> timerDeclarations = (ArrayList<TimerDeclarationImpl>) properties.get(key);
        ArrayNode timerDeclarationArray = new ObjectMapper().createArrayNode();

        if (timerDeclarations != null)
View Full Code Here

   
    // Do the regular stuff
    super.executeParse(bpmnParse, userTask);
   
    // Make user tasks always async
    ActivityImpl activity = findActivity(bpmnParse, userTask.getId());
    activity.setAsync(true);
  }
View Full Code Here

    return ServiceTask.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, ServiceTask serviceTask) {
   
      ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, serviceTask, BpmnXMLConstants.ELEMENT_TASK_SERVICE);
      activity.setAsync(serviceTask.isAsynchronous());
      activity.setFailedJobRetryTimeCycleValue(serviceTask.getFailedJobRetryTimeCycleValue());
      activity.setExclusive(!serviceTask.isNotExclusive());

      // Email, Mule and Shell service tasks
      if (StringUtils.isNotEmpty(serviceTask.getType())) {
       
        if (serviceTask.getType().equalsIgnoreCase("mail")) {
          activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMailActivityBehavior(serviceTask));
         
        } else if (serviceTask.getType().equalsIgnoreCase("mule")) {
          activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMuleActivityBehavior(serviceTask, bpmnParse.getBpmnModel()));
         
        } else if (serviceTask.getType().equalsIgnoreCase("camel")) {
          activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCamelActivityBehavior(serviceTask, bpmnParse.getBpmnModel()));
         
        } else if (serviceTask.getType().equalsIgnoreCase("shell")) {
          activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createShellActivityBehavior(serviceTask));
         
        } else {
          logger.warn("Invalid service task type: '" + serviceTask.getType() + "' " + " for service task " + serviceTask.getId());
        }

      // activiti:class
      } else if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equalsIgnoreCase(serviceTask.getImplementationType())) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createClassDelegateServiceTask(serviceTask));
       
      // activiti:delegateExpression
      } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equalsIgnoreCase(serviceTask.getImplementationType())) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createServiceTaskDelegateExpressionActivityBehavior(serviceTask));

      // activiti:expression     
      } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equalsIgnoreCase(serviceTask.getImplementationType())) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createServiceTaskExpressionActivityBehavior(serviceTask));

      // Webservice  
      } else if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(serviceTask.getImplementationType()) &&
          StringUtils.isNotEmpty(serviceTask.getOperationRef())) {
       
        if (!bpmnParse.getOperations().containsKey(serviceTask.getOperationRef())) {
          logger.warn(serviceTask.getOperationRef() + " does not exist for service task " + serviceTask.getId());
        } else {
         
          WebServiceActivityBehavior webServiceActivityBehavior = bpmnParse.getActivityBehaviorFactory().createWebServiceActivityBehavior(serviceTask);
          webServiceActivityBehavior.setOperation(bpmnParse.getOperations().get(serviceTask.getOperationRef()));

          if (serviceTask.getIoSpecification() != null) {
            IOSpecification ioSpecification = createIOSpecification(bpmnParse, serviceTask.getIoSpecification());
            webServiceActivityBehavior.setIoSpecification(ioSpecification);
          }

          for (DataAssociation dataAssociationElement : serviceTask.getDataInputAssociations()) {
            AbstractDataAssociation dataAssociation = createDataInputAssociation(bpmnParse, dataAssociationElement);
            webServiceActivityBehavior.addDataInputAssociation(dataAssociation);
          }

          for (DataAssociation dataAssociationElement : serviceTask.getDataOutputAssociations()) {
            AbstractDataAssociation dataAssociation = createDataOutputAssociation(bpmnParse, dataAssociationElement);
            webServiceActivityBehavior.addDataOutputAssociation(dataAssociation);
          }

          activity.setActivityBehavior(webServiceActivityBehavior);
        }
      } else {
        logger.warn("One of the attributes 'class', 'delegateExpression', 'type', 'operation', or 'expression' is mandatory on serviceTask " + serviceTask.getId());
      }
View Full Code Here

   
    MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
   
    // Activity Behavior
    MultiInstanceActivityBehavior miActivityBehavior = null;
    ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId());
    if (activity == null) {
      throw new ActivitiException("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found");
    }
           
    if (loopCharacteristics.isSequential()) {
      miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior());
    } else {
      miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior(
              activity, (AbstractBpmnActivityBehavior) activity.getActivityBehavior());
    }
   
    // ActivityImpl settings
    activity.setScope(true);
    activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel");
    activity.setActivityBehavior(miActivityBehavior);
   
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
    BpmnModel bpmnModel = bpmnParse.getBpmnModel();
   
    // loopcardinality
View Full Code Here

    return StartEvent.class;
  }
 
  @Override
  protected void executeParse(BpmnParse bpmnParse, StartEvent startEvent) {
    ActivityImpl startEventActivity = createActivityOnCurrentScope(bpmnParse, startEvent, BpmnXMLConstants.ELEMENT_EVENT_START);

    ScopeImpl scope = bpmnParse.getCurrentScope();
    if (scope instanceof ProcessDefinitionEntity) {
      createProcessDefinitionStartEvent(bpmnParse, startEventActivity, startEvent, (ProcessDefinitionEntity) scope);
      selectInitial(bpmnParse, startEventActivity, startEvent, (ProcessDefinitionEntity) scope);
View Full Code Here

    }
   
    EventSubscriptionDeclaration eventSubscription = new EventSubscriptionDeclaration(messageDefinition.getMessageRef(), "message");

    ScopeImpl scope = bpmnParse.getCurrentScope();
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent && bpmnParse.getCurrentSubProcess() != null) {
     
      // the scope of the event subscription is the parent of the event
      // subprocess (subscription must be created when parent is initialized)
      ScopeImpl catchingScope = ((ActivityImpl) scope).getParent();
     
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(messageDefinition.getMessageRef(), "message");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
      eventSubscriptionDeclaration.setStartEvent(false);
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, messageDefinition, catchingScope);
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
     
      activity.setProperty("type", "messageStartEvent");
      eventSubscription.setStartEvent(true);
      eventSubscription.setActivityId(activity.getId());
      addEventSubscriptionDeclaration(bpmnParse, eventSubscription, messageDefinition, bpmnParse.getCurrentProcessDefinition());
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent) {
     
      activity.setProperty("type", "intermediateMessageCatch");  
     
      if(getPrecedingEventBasedGateway(bpmnParse, (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) != null) {
        eventSubscription.setActivityId(activity.getId());
        addEventSubscriptionDeclaration(bpmnParse, eventSubscription, messageDefinition, activity.getParent());     
      } else {
        activity.setScope(true);
        addEventSubscriptionDeclaration(bpmnParse, eventSubscription, messageDefinition, activity);  
      }
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
     
      BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
      boolean interrupting = boundaryEvent.isCancelActivity();
      activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
     
      activity.setProperty("type", "boundaryMessage");
     
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(messageDefinition.getMessageRef(), "message");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, messageDefinition, activity.getParent());
     
      if (activity.getParent() instanceof ActivityImpl) {    
        ((ActivityImpl) activity.getParent()).setScope(true);
      }
    }
   
   
    else {
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.pvm.process.ActivityImpl

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.