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

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


    return SendTask.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, SendTask sendTask) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, sendTask, BpmnXMLConstants.ELEMENT_TASK_SEND);
   
    activity.setAsync(sendTask.isAsynchronous());
    activity.setExclusive(!sendTask.isNotExclusive());

    if (StringUtils.isNotEmpty(sendTask.getType())) {
      if (sendTask.getType().equalsIgnoreCase("mail")) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMailActivityBehavior(sendTask));
      } else if (sendTask.getType().equalsIgnoreCase("mule")) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createMuleActivityBehavior(sendTask, bpmnParse.getBpmnModel()));
      } else if (sendTask.getType().equalsIgnoreCase("camel")) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCamelActivityBehavior(sendTask, bpmnParse.getBpmnModel()));
      }

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

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

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

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

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


    return TimerEventDefinition.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, TimerEventDefinition timerEventDefinition) {
   
    ActivityImpl timerActivity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
     
      ProcessDefinitionEntity processDefinition = bpmnParse.getCurrentProcessDefinition();
      timerActivity.setProperty("type", "startTimerEvent");
      TimerDeclarationImpl timerDeclaration = createTimer(bpmnParse, timerEventDefinition, timerActivity, TimerStartEventJobHandler.TYPE);
      timerDeclaration.setJobHandlerConfiguration(processDefinition.getKey());   
 
      List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) processDefinition.getProperty(PROPERTYNAME_START_TIMER);
      if (timerDeclarations == null) {
        timerDeclarations = new ArrayList<TimerDeclarationImpl>();
        processDefinition.setProperty(PROPERTYNAME_START_TIMER, timerDeclarations);
      }
      timerDeclarations.add(timerDeclaration);
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent) {
     
      timerActivity.setProperty("type", "intermediateTimer");
      TimerDeclarationImpl timerDeclaration = createTimer(bpmnParse, timerEventDefinition, timerActivity, TimerCatchIntermediateEventJobHandler.TYPE);
      if (getPrecedingEventBasedGateway(bpmnParse, (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) != null) {
        addTimerDeclaration(timerActivity.getParent(), timerDeclaration);
      } else {
        addTimerDeclaration(timerActivity, timerDeclaration);
        timerActivity.setScope(true);
      }
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
     
      timerActivity.setProperty("type", "boundaryTimer");
      TimerDeclarationImpl timerDeclaration = createTimer(bpmnParse, timerEventDefinition, timerActivity, TimerExecuteNestedActivityJobHandler.TYPE);
     
      // ACT-1427
      BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
      boolean interrupting = boundaryEvent.isCancelActivity();
      if (interrupting) {
        timerDeclaration.setInterruptingTimer(true);
      }
     
      addTimerDeclaration(timerActivity.getParent(), timerDeclaration);

      if (timerActivity.getParent() instanceof ActivityImpl) {
        ((ActivityImpl) timerActivity.getParent()).setScope(true);
      }

      timerActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory()
              .createBoundaryEventActivityBehavior((BoundaryEvent) bpmnParse.getCurrentFlowElement(), interrupting, timerActivity));
     
    }
  }
View Full Code Here

  }
 
  @Override
  protected void executeParse(BpmnParse bpmnParse, BusinessRuleTask businessRuleTask) {
   
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, businessRuleTask, BpmnXMLConstants.ELEMENT_TASK_BUSINESSRULE);
    activity.setAsync(businessRuleTask.isAsynchronous());
    activity.setExclusive(!businessRuleTask.isNotExclusive());
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBusinessRuleTaskActivityBehavior(businessRuleTask));
  }
View Full Code Here

  public Class< ? extends BaseElement> getHandledType() {
    return UserTask.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, userTask, BpmnXMLConstants.ELEMENT_TASK_USER);
   
    activity.setAsync(userTask.isAsynchronous());
    activity.setExclusive(!userTask.isNotExclusive());
   
    TaskDefinition taskDefinition = parseTaskDefinition(bpmnParse, userTask, userTask.getId(), (ProcessDefinitionEntity) bpmnParse.getCurrentScope().getProcessDefinition());
    activity.setProperty(PROPERTY_TASK_DEFINITION, taskDefinition);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createUserTaskActivityBehavior(userTask, taskDefinition));
  }
View Full Code Here

  public String getType() {
    return TYPE;
  }
 
  public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
    ActivityImpl borderEventActivity = execution.getProcessDefinition().findActivity(configuration);

    if (borderEventActivity == null) {
      throw new ActivitiException("Error while firing timer: border event activity " + configuration + " not found");
    }

    try {
      if (commandContext.getEventDispatcher().isEnabled()) {
        commandContext.getEventDispatcher().dispatchEvent(
          ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TIMER_FIRED, job));
        dispatchActivityTimeoutIfNeeded(job, execution, commandContext);
      }

      borderEventActivity
        .getActivityBehavior()
        .execute(execution);
    } catch (RuntimeException e) {
      log.error("exception during timer execution", e);
      throw e;
View Full Code Here

      throw new ActivitiException("exception during timer execution: "+e.getMessage(), e);
    }
  }

  protected void dispatchActivityTimeoutIfNeeded(JobEntity timerEntity, ExecutionEntity execution, CommandContext commandContext) {
    ActivityImpl boundaryEventActivity = execution.getProcessDefinition().findActivity(timerEntity.getJobHandlerConfiguration());
    ActivityBehavior boundaryActivityBehavior = boundaryEventActivity.getActivityBehavior();
    if (boundaryActivityBehavior instanceof BoundaryEventActivityBehavior) {
      BoundaryEventActivityBehavior boundaryEventActivityBehavior = (BoundaryEventActivityBehavior) boundaryActivityBehavior;
      if (boundaryEventActivityBehavior.isInterrupting()) {
        dispatchExecutionTimeOut(execution, commandContext);
      }
View Full Code Here

    if (subProcessInstance != null) {
      dispatchExecutionTimeOut(subProcessInstance, commandContext);
    }

    // activity with timer boundary event
    ActivityImpl activity = execution.getActivity();
    if (activity != null && activity.getActivityBehavior() != null) {
      dispatchActivityTimeOut(activity, execution, commandContext);
    }
  }
View Full Code Here

      throw new ActivitiIllegalArgumentException("Found event definition of unknown type: "+eventType);
    }
   
    eventSubscriptionEntity.setEventName(eventName);
    if(activityId != null) {
      ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
      eventSubscriptionEntity.setActivity(activity);
    }
   
    if (configuration != null) {
      eventSubscriptionEntity.setConfiguration(configuration);
View Full Code Here

    return superExecution;
  }
 
  private static void executeCatch(String errorHandlerId, ActivityExecution execution, String errorCode) {
    ProcessDefinitionImpl processDefinition = ((ExecutionEntity) execution).getProcessDefinition();
    ActivityImpl errorHandler = processDefinition.findActivity(errorHandlerId);
    if (errorHandler == null) {
      throw new ActivitiException(errorHandlerId + " not found in process definition");
    }
   
    boolean matchingParentFound = false;
    ActivityExecution leavingExecution = execution;
    ActivityImpl currentActivity = (ActivityImpl) execution.getActivity();   
   
    ScopeImpl catchingScope = errorHandler.getParent();
    if(catchingScope instanceof ActivityImpl) {
      ActivityImpl catchingScopeActivity = (ActivityImpl) catchingScope;
      if(!catchingScopeActivity.isScope()) { // event subprocesses
        catchingScope = catchingScopeActivity.getParent();
      }
    }
   
    if(catchingScope instanceof PvmProcessDefinition) {
      executeEventHandler(errorHandler, ((ExecutionEntity)execution).getProcessInstance(), errorCode);
View Full Code Here

   * true (or which doesn't have a condition), is selected for continuation of
   * the process instance. If multiple sequencer flow are selected, multiple,
   * parallel paths of executions are created.
   */
  public void performDefaultOutgoingBehavior(ActivityExecution activityExecution) {
    ActivityImpl activity = (ActivityImpl) activityExecution.getActivity();
    if (!(activity.getActivityBehavior() instanceof IntermediateCatchEventActivityBehavior)) {
      dispatchJobCanceledEvents(activityExecution);
    }
    performOutgoingBehavior(activityExecution, true, false, null);
  }
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.