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

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


      String errorCode = bpmnParse.getBpmnModel().getErrors().get(modelErrorEvent.getErrorCode());
      modelErrorEvent.setErrorCode(errorCode);
    }
   
    ScopeImpl scope = bpmnParse.getCurrentScope();
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
   
      if (scope.getProperty(PROPERTYNAME_INITIAL) == null) {
        scope.setProperty(PROPERTYNAME_INITIAL, activity);
       
        // 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();
       
        createErrorStartEventDefinition(modelErrorEvent, activity, catchingScope);
      }
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
     
      BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
      boolean interrupting = true; // non-interrupting not yet supported
      activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
      ActivityImpl parentActivity = scope.findActivity(boundaryEvent.getAttachedToRefId());
      createBoundaryErrorEventDefinition(modelErrorEvent, interrupting, parentActivity, activity);
     
    }
  }
View Full Code Here


  }
 
  @SuppressWarnings("unchecked")
  public void execute(ActivityExecution execution) throws Exception {
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    ActivityImpl boundaryActivity = executionEntity.getProcessDefinition().findActivity(activityId);
    ActivityImpl interruptedActivity = executionEntity.getActivity();
   
    executionEntity.setActivity(boundaryActivity);
   
    List<PvmTransition> outgoingTransitions = boundaryActivity.getOutgoingTransitions();
    List<ExecutionEntity> interruptedExecutions = null;
View Full Code Here

    return EndEvent.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, EndEvent endEvent) {
   
    ActivityImpl endEventActivity = createActivityOnCurrentScope(bpmnParse, endEvent, BpmnXMLConstants.ELEMENT_EVENT_END);
    EventDefinition eventDefinition = null;
    if (!endEvent.getEventDefinitions().isEmpty()) {
      eventDefinition = endEvent.getEventDefinitions().get(0);
    }
   
    // Error end event
    if (eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition) {
      org.activiti.bpmn.model.ErrorEventDefinition errorDefinition = (org.activiti.bpmn.model.ErrorEventDefinition) eventDefinition;
      if (bpmnParse.getBpmnModel().containsErrorRef(errorDefinition.getErrorCode())) {
        String errorCode = bpmnParse.getBpmnModel().getErrors().get(errorDefinition.getErrorCode());
        if (StringUtils.isEmpty(errorCode)) {
          logger.warn("errorCode is required for an error event " + endEvent.getId());
        }
        endEventActivity.setProperty("type", "errorEndEvent");
        errorDefinition.setErrorCode(errorCode);
      }
      endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createErrorEndEventActivityBehavior(endEvent, errorDefinition));
     
    // Cancel end event     
    } else if (eventDefinition instanceof CancelEventDefinition) {
      ScopeImpl scope = bpmnParse.getCurrentScope();
      if (scope.getProperty("type")==null || !scope.getProperty("type").equals("transaction")) {
        logger.warn("end event with cancelEventDefinition only supported inside transaction subprocess (id=" + endEvent.getId() + ")");
      } else {
        endEventActivity.setProperty("type", "cancelEndEvent");
        endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createCancelEndEventActivityBehavior(endEvent));
      }
   
    // Terminate end event 
    } else if (eventDefinition instanceof TerminateEventDefinition) {
      endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTerminateEndEventActivityBehavior(endEvent));
     
    // None end event 
    } else if (eventDefinition == null) {
      endEventActivity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createNoneEndEventActivityBehavior(endEvent));
    }
  }
View Full Code Here

*/
public class SubProcessActivityBehavior extends AbstractBpmnActivityBehavior implements CompositeActivityBehavior {
 
  public void execute(ActivityExecution execution) throws Exception {
    PvmActivity activity = execution.getActivity();
    ActivityImpl initialActivity = (ActivityImpl) activity.getProperty(BpmnParse.PROPERTYNAME_INITIAL);
   
    if (initialActivity == null) {
      throw new ActivitiException("No initial activity found for subprocess "
              + execution.getActivity().getId());
    }
View Full Code Here

  public ActivityImpl createActivityOnScope(BpmnParse bpmnParse, FlowElement flowElement, String xmlLocalName, ScopeImpl scopeElement) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Parsing activity {}", flowElement.getId());
    }
   
    ActivityImpl activity = scopeElement.createActivity(flowElement.getId());
    bpmnParse.setCurrentActivity(activity);

    activity.setProperty("name", flowElement.getName());
    activity.setProperty("documentation", flowElement.getDocumentation());
    if (flowElement instanceof Activity) {
      Activity modelActivity = (Activity) flowElement;
      activity.setProperty("default", modelActivity.getDefaultFlow());
      if(modelActivity.isForCompensation()) {
        activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true);       
      }
    } else if (flowElement instanceof Gateway) {
      activity.setProperty("default", ((Gateway) flowElement).getDefaultFlow());
    }
    activity.setProperty("type", xmlLocalName);
   
    return activity;
  }
View Full Code Here

     
      // connected to a text annotation so skipping it
      return;
    }
   
    ActivityImpl sourceActivity = parentScope.findActivity(association.getSourceRef());
    ActivityImpl targetActivity = parentScope.findActivity(association.getTargetRef());
   
    // an association may reference elements that are not parsed as activities (like for instance
    // text annotations so do not throw an exception if sourceActivity or targetActivity are null)
    // However, we make sure they reference 'something':
    if (sourceActivity == null) {
      //bpmnModel.addProblem("Invalid reference sourceRef '" + association.getSourceRef() + "' of association element ", association.getId());
    } else if (targetActivity == null) {
      //bpmnModel.addProblem("Invalid reference targetRef '" + association.getTargetRef() + "' of association element ", association.getId());
    } else {     
      if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch")) {
        Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION);         
        if (isForCompensation == null || !(Boolean) isForCompensation) {
          logger.warn("compensation boundary catch must be connected to element with isForCompensation=true");
        } else {           
          ActivityImpl compensatedActivity = sourceActivity.getParentActivity();
          compensatedActivity.setProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId());           
        }
      }
    }
  }
View Full Code Here

  public Class< ? extends BaseElement> getHandledType() {
    return Task.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, Task task) {
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, task, BpmnXMLConstants.ELEMENT_TASK);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createTaskActivityBehavior(task));
   
    activity.setAsync(task.isAsynchronous());
    activity.setExclusive(!task.isNotExclusive());
  }
View Full Code Here

   
    if (signal == null) {
      return;
    }
   
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
   
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
      eventSubscriptionDeclaration.setStartEvent(true);
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, bpmnParse.getCurrentScope());
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent){
     
      activity.setProperty("type", "intermediateSignalCatch");  
     
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
     
      if (signal.getScope() != null) {
        eventSubscriptionDeclaration.setConfiguration(signal.getScope());
      }
     
      if (getPrecedingEventBasedGateway(bpmnParse, (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) != null) {
        eventSubscriptionDeclaration.setActivityId(activity.getId());
        addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());     
      } else {
        activity.setScope(true);
        addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity);  
      }
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof ThrowEvent) {
     
      ThrowEvent throwEvent = (ThrowEvent) bpmnParse.getCurrentFlowElement();
     
      activity.setProperty("type", "intermediateSignalThrow")
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setAsync(signalDefinition.isAsync());
     
      activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowSignalEventActivityBehavior(throwEvent, signal, eventSubscriptionDeclaration));
     
    } 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", "boundarySignal");
       
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
     
      if (signal.getScope() != null) {
        eventSubscriptionDeclaration.setConfiguration(signal.getScope());
      }
     
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());
       
      if (activity.getParent() instanceof ActivityImpl) {    
        ((ActivityImpl) activity.getParent()).setScope(true);
      }
       
    }
   
   
View Full Code Here

  public String getType() {
    return TYPE;
  }

  public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
    ActivityImpl intermediateEventActivity = execution.getProcessDefinition().findActivity(configuration);

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

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

      if(!execution.getActivity().getId().equals(intermediateEventActivity.getId())) {
        execution.setActivity(intermediateEventActivity);
      }
      execution.signal(null, null);
    } catch (RuntimeException e) {
      LogMDC.putMDCExecution(execution);
View Full Code Here

    if (scopeActivity instanceof PvmProcessDefinition) {
      return execution.getProcessInstance();
     
    } else {
     
      ActivityImpl currentActivity = execution.getActivity();     
      ExecutionEntity candiadateExecution = null;
      ExecutionEntity originalExecution = execution;
     
      while (execution != null) {
        currentActivity = execution.getActivity();
        if (scopeActivity.getActivities().contains(currentActivity) /* does not search rec*/
                || scopeActivity.equals(currentActivity)) {
          // found a candidate execution; lets still check whether we find an
          // execution which is also sitting in an activity part of this scope
          // higher up the hierarchy
          candiadateExecution = execution;       
        } else if (currentActivity!= null
                && currentActivity.contains((ActivityImpl)scopeActivity) /*searches rec*/) {
          // now we're too "high", the candidate execution is the one.
          break;
        }
         
        execution = execution.getParent();
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.