Package org.activiti.engine.impl.persistence.entity

Examples of org.activiti.engine.impl.persistence.entity.ExecutionEntity


    Statement select = connection.createStatement();
    return select.executeQuery(sql);
  }
 
  public static ProcessDefinition getProcessDefinition(DelegateExecution delegateExecution) {
    ExecutionEntity executionEntity = (ExecutionEntity) delegateExecution;
    if (executionEntity.getProcessDefinition() != null) {
      return (ProcessDefinition) executionEntity.getProcessDefinition();
    } else {
      return ProcessEngines.getDefaultProcessEngine()
              .getRepositoryService()
              .createProcessDefinitionQuery()
              .processDefinitionId(delegateExecution.getProcessDefinitionId())
View Full Code Here


    assertTrue(listener.isCreateReceived());
    listener.reset();

    // Dispatch event for a execution, should NOT be received
    ActivitiEntityEventImpl createEventForExecution = new ActivitiEntityEventImpl(new ExecutionEntity(),
        ActivitiEventType.ENTITY_CREATED);

    dispatcher.dispatchEvent(createEventForExecution);
    assertFalse(listener.isCreateReceived());
  }
View Full Code Here

      (event instanceof ActivitiEntityEvent) &&
      ((ActivitiEntityEvent) event).getEntity() instanceof ProcessInstance &&
      ((ExecutionEntity) ((ActivitiEntityEvent) event).getEntity()).isProcessInstanceType()) {

      ProcessInstance processInstance = (ProcessInstance) ((ActivitiEntityEvent) event).getEntity();
      ExecutionEntity executionEntity = (ExecutionEntity) ((ActivitiEntityEvent) event).getEntity();

      Map<String, Object> simEventProperties = new HashMap<String, Object>();
      simEventProperties.put(processDefinitionIdKey, processInstance.getProcessDefinitionId());
      simEventProperties.put(businessKey, processInstance.getBusinessKey());
      simEventProperties.put(variablesKey, executionEntity.getVariables());
      simEventProperties.put(PROCESS_INSTANCE_ID, executionEntity.getProcessInstanceId());

      return new SimulationEvent.Builder(simulationEventType).
                  simulationTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime().getTime()).
                  properties(simEventProperties).
                  build();
View Full Code Here

    public List<String> execute(CommandContext commandContext) {
      if(executionId == null) {
        throw new ActivitiIllegalArgumentException("executionId is null");
      }
     
      ExecutionEntity execution = commandContext
        .getExecutionEntityManager()
        .findExecutionById(executionId);
     
      if (execution==null) {
        throw new ActivitiObjectNotFoundException("execution "+executionId+" doesn't exist", Execution.class);
      }

      List<String> executionVariables;
      if (isLocal) {
        executionVariables = new ArrayList<String>(execution.getVariableNamesLocal());
      } else {
        executionVariables = new ArrayList<String>(execution.getVariableNames());
      }
     
      return executionVariables;
    }
View Full Code Here

          assertNotNull(job);
          assertEquals(pi.getProcessInstanceId(), job.getProcessInstanceId());

          assertEquals(4, job.getRetries());

          ExecutionEntity execution = fetchExecutionEntity(pi.getProcessInstanceId());
          assertEquals("failingServiceTask", execution.getActivityId());

          waitForExecutedJobWithRetriesLeft(3);

          job = refreshJob(job.getId());
          assertEquals(3, job.getRetries());
          stillOneJobWithExceptionAndRetriesLeft();

          execution = refreshExecutionEntity(execution.getId());
          assertEquals("failingServiceTask", execution.getActivityId());

          waitForExecutedJobWithRetriesLeft(2);

          job = refreshJob(job.getId());
          assertEquals(2, job.getRetries());
          stillOneJobWithExceptionAndRetriesLeft();

          execution = refreshExecutionEntity(execution.getId());
          assertEquals("failingServiceTask", execution.getActivityId());

          waitForExecutedJobWithRetriesLeft(1);

          job = refreshJob(job.getId());
          assertEquals(1, job.getRetries());
          stillOneJobWithExceptionAndRetriesLeft();

          execution = refreshExecutionEntity(execution.getId());
          assertEquals("failingServiceTask", execution.getActivityId());

          waitForExecutedJobWithRetriesLeft(0);

          job = refreshJob(job.getId());
          assertEquals(0, job.getRetries());
          assertEquals(1, managementService.createJobQuery().withException().count());
          assertEquals(0, managementService.createJobQuery().withRetriesLeft().count());
          assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());

          execution = refreshExecutionEntity(execution.getId());
          assertEquals("failingServiceTask", execution.getActivityId());      
     
    }
View Full Code Here

    for (ExecutionEntity subExecution : execution.getExecutions()) {
      dispatchExecutionTimeOut(subExecution, commandContext);
    }

    // call activities
    ExecutionEntity subProcessInstance = commandContext.getExecutionEntityManager().findSubProcessInstanceBySuperExecutionId(execution.getId());
    if (subProcessInstance != null) {
      dispatchExecutionTimeOut(subProcessInstance, commandContext);
    }

    // activity with timer boundary event
View Full Code Here

    return null;
  }

 
  private static ActivityExecution getSuperExecution(ActivityExecution execution) {
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    ExecutionEntity superExecution = executionEntity.getProcessInstance().getSuperExecution();
    if (superExecution != null && !superExecution.isScope()) {
      return superExecution.getParent();
    }
    return superExecution;
  }
View Full Code Here

    this.activityId = activityId;
  }
 
  @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;
   
    if (interrupting) {
      if (executionEntity.getSubProcessInstance()!=null) {
        executionEntity.getSubProcessInstance().deleteCascade(executionEntity.getDeleteReason());
      }
     
      interruptedExecutions = new ArrayList<ExecutionEntity>(executionEntity.getExecutions());
      for (ExecutionEntity interruptedExecution: interruptedExecutions) {
        interruptedExecution.deleteCascade("interrupting boundary event '"+execution.getActivity().getId()+"' fired");
      }
     
      execution.takeAll(outgoingTransitions, (List) interruptedExecutions);
    }
    else {
      // non interrupting event, introduced with BPMN 2.0, we need to create a new execution in this case
     
      // create a new execution and move it out from the timer activity
      ExecutionEntity concurrentRoot = executionEntity.getParent().isConcurrent() ? executionEntity.getParent() : executionEntity;
      ExecutionEntity outgoingExecution = concurrentRoot.createExecution();
   
      outgoingExecution.setActive(true);
      outgoingExecution.setScope(false);
      outgoingExecution.setConcurrent(true);
     
      outgoingExecution.takeAll(outgoingTransitions, Collections.EMPTY_LIST);
      outgoingExecution.remove();
      // now we have to move the execution back to the real activity
      // since the execution stays there (non interrupting) and it was
      // set to the boundary event before
      executionEntity.setActivity(interruptedActivity);     
    }
View Full Code Here

    // See ACT-1586: ExecutionQuery returns wrong results when using multi instance on a receive task
    // The parent execution must be set to false, so it wouldn't show up in the execution query
    // when using .activityId(something). Do not we cannot nullify the activityId (that would
    // have been a better solution), as it would break boundary event behavior.
    if (!concurrentExecutions.isEmpty()) {
      ExecutionEntity executionEntity = (ExecutionEntity) execution;
      executionEntity.setActive(false);
    }
  }
View Full Code Here

    int nrOfCompletedInstances = getLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
    int nrOfActiveInstances = getLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES) - 1;
   
    if (isExtraScopeNeeded()) {
      // In case an extra scope was created, it must be destroyed first before going further
      ExecutionEntity extraScope = (ExecutionEntity) execution;
      execution = execution.getParent();
      extraScope.remove();
    }
   
    setLoopVariable(execution.getParent(), NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
    setLoopVariable(execution.getParent(), NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances);
    logLoopDetails(execution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);
   
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    executionEntity.inactivate();
    executionEntity.getParent().forceUpdate();
   
    List<ActivityExecution> joinedExecutions = executionEntity.findInactiveConcurrentExecutions(execution.getActivity());
    if (joinedExecutions.size() >= nrOfInstances || completionConditionSatisfied(execution)) {
     
      // Removing all active child executions (ie because completionCondition is true)
      List<ExecutionEntity> executionsToRemove = new ArrayList<ExecutionEntity>();
      for (ActivityExecution childExecution : executionEntity.getParent().getExecutions()) {
        if (childExecution.isActive()) {
          executionsToRemove.add((ExecutionEntity) childExecution);
        }
      }
      for (ExecutionEntity executionToRemove : executionsToRemove) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Execution {} still active, but multi-instance is completed. Removing this execution.", executionToRemove);
        }
        executionToRemove.inactivate();
        executionToRemove.deleteCascade("multi-instance completed");
      }
      executionEntity.takeAll(executionEntity.getActivity().getOutgoingTransitions(), joinedExecutions);
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.persistence.entity.ExecutionEntity

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.