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

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


      }
    }
  }
 
  public void createBPMNShape(String key, GraphicInfo graphicInfo, ProcessDefinitionEntity processDefinition) {
    ActivityImpl activity = processDefinition.findActivity(key);
    if (activity != null) {
      createDIBounds(graphicInfo, activity);

    } else {
      org.activiti.engine.impl.pvm.process.Lane lane = processDefinition.getLaneForId(key);
View Full Code Here


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

    return ThrowEvent.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, ThrowEvent intermediateEvent) {

    ActivityImpl nestedActivityImpl = createActivityOnCurrentScope(bpmnParse, intermediateEvent, BpmnXMLConstants.ELEMENT_EVENT_THROW);
   
    EventDefinition eventDefinition = null;
    if (!intermediateEvent.getEventDefinitions().isEmpty()) {
      eventDefinition = intermediateEvent.getEventDefinitions().get(0);
    }
   
    if (eventDefinition instanceof SignalEventDefinition) {
      bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    } else if (eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
      bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    } else if (eventDefinition == null) {
      nestedActivityImpl.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowNoneEventActivityBehavior(intermediateEvent));
    } else {
      logger.warn("Unsupported intermediate throw event type for throw event " + intermediateEvent.getId());
    }
  }
View Full Code Here

    return SubProcess.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, SubProcess subProcess) {
   
    ActivityImpl activity = createActivityOnScope(bpmnParse, subProcess, BpmnXMLConstants.ELEMENT_SUBPROCESS, bpmnParse.getCurrentScope());
   
    activity.setAsync(subProcess.isAsynchronous());
    activity.setExclusive(!subProcess.isNotExclusive());

    boolean triggeredByEvent = false;
    if (subProcess instanceof EventSubProcess) {
      triggeredByEvent = true;
    }
    activity.setProperty("triggeredByEvent", triggeredByEvent);
   
    // event subprocesses are not scopes
    activity.setScope(!triggeredByEvent);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createSubprocActivityBehavior(subProcess));
   
    bpmnParse.setCurrentScope(activity);
    bpmnParse.setCurrentSubProcess(subProcess);
   
    bpmnParse.processFlowElements(subProcess.getFlowElements());
    processArtifacts(bpmnParse, subProcess.getArtifacts(), activity);
   
    // no data objects for event subprocesses
    if (!(subProcess instanceof EventSubProcess)) {
      // parse out any data objects from the template in order to set up the necessary process variables
      Map<String, Object> variables = processDataObjects(bpmnParse, subProcess.getDataObjects(), activity);
      activity.setVariables(variables);
    }

    bpmnParse.removeCurrentScope();
    bpmnParse.removeCurrentSubProcess();
   
    if (subProcess.getIoSpecification() != null) {
      IOSpecification ioSpecification = createIOSpecification(bpmnParse, subProcess.getIoSpecification());
      activity.setIoSpecification(ioSpecification);
    }

  }
View Full Code Here

public void recordSubProcessInstanceStart(ExecutionEntity parentExecution, ExecutionEntity subProcessInstance) {
    if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
     
      HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity((ExecutionEntity) subProcessInstance);
    
      ActivityImpl initialActivity = subProcessInstance.getActivity();
      // Fix for ACT-1728: startActivityId not initialized with subprocess-instance
      if(historicProcessInstance.getStartActivityId() == null) {
        historicProcessInstance.setStartActivityId(subProcessInstance.getProcessDefinition().getInitial().getId());
        initialActivity = subProcessInstance.getProcessDefinition().getInitial();
      }
      getDbSqlSession().insert(historicProcessInstance);
     
     
      HistoricActivityInstanceEntity activitiyInstance = findActivityInstance(parentExecution);
      if (activitiyInstance != null) {
        activitiyInstance.setCalledProcessInstanceId(subProcessInstance.getProcessInstanceId());
      }
     
      // Fix for ACT-1728: start-event not recorded for subprocesses
      IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
     
      // Also record the start-event manually, as there is no "start" activity history listener for this
      HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
      historicActivityInstance.setId(idGenerator.getNextId());
      historicActivityInstance.setProcessDefinitionId(subProcessInstance.getProcessDefinitionId());
      historicActivityInstance.setProcessInstanceId(subProcessInstance.getProcessInstanceId());
      historicActivityInstance.setExecutionId(subProcessInstance.getId());
      historicActivityInstance.setActivityId(initialActivity.getId());
      historicActivityInstance.setActivityName((String) initialActivity.getProperty("name"));
      historicActivityInstance.setActivityType((String) initialActivity.getProperty("type"));
      Date now = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
      historicActivityInstance.setStartTime(now);
     
      getDbSqlSession()
        .insert(historicActivityInstance);
View Full Code Here

  public Set<Class< ? extends BaseElement>> getHandledTypes() {
    return supportedElementClasses;
  }

  public void parse(BpmnParse bpmnParse, BaseElement element) {
    ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(element.getId());
    if(element instanceof BoundaryEvent) {
      // A boundary-event never receives an activity start-event
      activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITY_INSTANCE_START_LISTENER, 0);
      activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITI_INSTANCE_END_LISTENER, 1);
    } else {
      activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START, ACTIVITY_INSTANCE_START_LISTENER, 0);
      activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITI_INSTANCE_END_LISTENER);
    }
  }
View Full Code Here

    JobEntity job = commandContext.getJobEntityManager().findJobById(jobId);
    if (job == null) {
      return null;
    }
    
    ActivityImpl activity = getCurrentActivity(commandContext, job);
    ProcessEngineConfiguration processEngineConfig = commandContext.getProcessEngineConfiguration();
  
    if (activity == null || activity.getFailedJobRetryTimeCycleValue() == null) {
      log.error("activitiy or FailedJobRetryTimerCycleValue is null in job " + jobId + "'. only decrementing retries.");
      job.setRetries(job.getRetries() - 1);
      job.setLockOwner(null);
      job.setLockExpirationTime(null);
      if (job.getDuedate() == null) {
        // add wait time for failed async job
        job.setDuedate(calculateDueDate(commandContext, processEngineConfig.getAsyncFailedJobWaitTime(), null));
      } else {
        // add default wait time for failed job
        job.setDuedate(calculateDueDate(commandContext, processEngineConfig.getDefaultFailedJobWaitTime(), job.getDuedate()));
      }
     
    } else {     
      String failedJobRetryTimeCycle = activity.getFailedJobRetryTimeCycleValue();
      try {
        DurationHelper durationHelper = new DurationHelper(failedJobRetryTimeCycle, processEngineConfig.getClock());
        job.setLockOwner(null);
        job.setLockExpirationTime(null);
        job.setDuedate(durationHelper.getDateAfter());
View Full Code Here

    return newDateCal.getTime();
  }

  private ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
    String type = job.getJobHandlerType();
    ActivityImpl activity = null;

    if (TimerExecuteNestedActivityJobHandler.TYPE.equals(type) ||
        TimerCatchIntermediateEventJobHandler.TYPE.equals(type)) {
      ExecutionEntity execution = fetchExecutionEntity(commandContext, job.getExecutionId());
      if (execution != null) {
View Full Code Here

    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class);
    }
 
    ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId());
    ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity);

    if (processVariables != null) {
      processInstance.setVariables(processVariables);
    }
View Full Code Here

      }
    });
   
    // Test that the process definition has been deployed
    assertNotNull(processDefinitionEntity);
    ActivityImpl activity = processDefinitionEntity.findActivity("ExclusiveGateway_1");
    assertNotNull(activity);
   
    // Test that the conditions has been resolved
    for (PvmTransition transition : activity.getOutgoingTransitions()) {
      if (transition.getDestination().getId().equals("Task_2")) {
        assertTrue(transition.getProperty("conditionText").equals("#{approved}"));
      } else if (transition.getDestination().getId().equals("Task_3")) {
        assertTrue(transition.getProperty("conditionText").equals("#{!approved}"));
      } 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.