Package org.camunda.bpm.engine.impl.interceptor

Examples of org.camunda.bpm.engine.impl.interceptor.CommandContext


  }

  public void replace(PvmExecutionImpl execution) {
    ExecutionEntity replacedExecution = (ExecutionEntity) execution;

    CommandContext commandContext = Context.getCommandContext();

    // update the related tasks
    for (TaskEntity task: replacedExecution.getTasksInternal()) {
      task.setExecutionId(getId());
      task.setExecution(this);

      // update the related local task variables
      List<VariableInstanceEntity> variables = commandContext
        .getVariableInstanceManager()
        .findVariableInstancesByTaskId(task.getId());

      for (VariableInstanceEntity variable : variables) {
        variable.setExecution(this);
View Full Code Here


    }
  }

  public void addTransactionListener(TransactionState transactionState, final TransactionListener transactionListener) {
    Transaction transaction = getTransaction();
    CommandContext commandContext = Context.getCommandContext();   
    try {
      transaction.registerSynchronization(new TransactionStateSynchronization(transactionState, transactionListener, commandContext));
    } catch (IllegalStateException e) {
      throw new ProcessEngineException("IllegalStateException while registering synchronization ", e);
    } catch (RollbackException e) {
View Full Code Here

    }
  }

  public void deleteHistoricProcessInstanceById(String historicProcessInstanceId) {
    if (isHistoryEnabled()) {
      CommandContext commandContext = Context.getCommandContext();

      commandContext
        .getHistoricDetailManager()
        .deleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricVariableInstanceManager()
        .deleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricActivityInstanceManager()
        .deleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricTaskInstanceManager()
        .deleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext
          .getOperationLogManager()
          .deleteOperationLogEntriesByProcessInstanceId(historicProcessInstanceId);

      commandContext
          .getHistoricIncidentManager()
          .deleteHistoricIncidentsByProcessInstanceId(historicProcessInstanceId);

      commandContext.getDbEntityManager().delete(HistoricProcessInstanceEntity.class, "deleteHistoricProcessInstance", historicProcessInstanceId);

    }
  }
View Full Code Here

  private static boolean isDependentScoped(Bean<?> bean) {
    return Dependent.class.equals(bean.getScope());
  }

  private static void releaseOnContextClose(CreationalContext<?> creationalContext, Bean<?> bean) {
    CommandContext commandContext = Context.getCommandContext();
    if(commandContext != null) {
      commandContext.registerCommandContextListener(new CreationalContextReleaseListener(creationalContext));

    } else {
      LOG.warning("Obtained instance of @Dependent scoped bean "+bean +" outside of process engine command context. "
          + "Bean instance will not be destroyed. This is likely to create a memory leak. Please use a normal scope like @ApplicationScoped for this bean.");
View Full Code Here

  public void deleteHistoricTaskInstanceById(final String taskId) {
    if (isHistoryEnabled()) {
      HistoricTaskInstanceEntity historicTaskInstance = findHistoricTaskInstanceById(taskId);
      if (historicTaskInstance != null) {
        CommandContext commandContext = Context.getCommandContext();

        commandContext
          .getHistoricDetailManager()
          .deleteHistoricDetailsByTaskId(taskId);

        commandContext
          .getHistoricVariableInstanceManager()
          .deleteHistoricVariableInstancesByTaskId(taskId);

        commandContext
          .getCommentManager()
          .deleteCommentsByTaskId(taskId);

        commandContext
          .getAttachmentManager()
          .deleteAttachmentsByTaskId(taskId);

        commandContext
          .getOperationLogManager()
          .deleteOperationLogEntriesByTaskId(taskId);

        getDbEntityManager().delete(historicTaskInstance);
      }
View Full Code Here

    int historyLevel = Context
      .getProcessEngineConfiguration()
      .getHistoryLevel();

    if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      CommandContext commandContext = Context.getCommandContext();

      commandContext
        .getHistoricTaskInstanceManager()
        .deleteHistoricTaskInstancesByCaseDefinitionId(caseDefinitionId);

      commandContext
        .getOperationLogManager()
        .deleteOperationLogEntriesByCaseDefinitionId(caseDefinitionId);
    }

  }
View Full Code Here

    if(execution == null) {
      throw new BadUserRequestException("No case instance found for id '" + caseInstanceId + "'");
    }

    CommandContext commandContext = Context.getCommandContext();
    commandContext
      .getTaskManager()
      .deleteTasksByCaseInstanceId(caseInstanceId, deleteReason, cascade);

    execution.deleteCascade();

    // TODO: move this later to HistoricCaseInstance
    int historyLevel = Context
      .getProcessEngineConfiguration()
      .getHistoryLevel();

    if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {

      commandContext
        .getHistoricTaskInstanceManager()
        .deleteHistoricTaskInstancesByCaseInstanceId(caseInstanceId);

      commandContext
        .getOperationLogManager()
        .deleteOperationLogEntriesByCaseInstanceId(caseInstanceId);
    }
  }
View Full Code Here

  public void remove() {
    super.remove();

    variableStore.removeVariablesWithoutFiringEvents();

    CommandContext commandContext = Context.getCommandContext();

    for (CaseSentryPartEntity sentryPart : getCaseSentryParts()) {
      commandContext
        .getCaseSentryPartManager()
        .deleteSentryPart(sentryPart);
    }

    // finally delete this execution
    commandContext
      .getCaseExecutionManager()
      .deleteCaseExecution(this);
  }
View Full Code Here

    }
  }

  public void deleteHistoricProcessInstanceById(String historicProcessInstanceId) {
    if (isHistoryEnabled()) {
      CommandContext commandContext = Context.getCommandContext();

      commandContext
        .getHistoricDetailManager()
        .deleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricVariableInstanceManager()
        .deleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricActivityInstanceManager()
        .deleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricTaskInstanceManager()
        .deleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext
          .getOperationLogManager()
          .deleteOperationLogEntriesByProcessInstanceId(historicProcessInstanceId);

      commandContext
          .getHistoricIncidentManager()
          .deleteHistoricIncidentsByProcessInstanceId(historicProcessInstanceId);

      commandContext.getDbEntityManager().delete(HistoricProcessInstanceEntity.class, "deleteHistoricProcessInstance", historicProcessInstanceId);

    }
  }
View Full Code Here

  }

  public void setReplacedBy(PvmExecutionImpl replacedBy) {
    this.replacedBy = (ExecutionEntity) replacedBy;

    CommandContext commandContext = Context.getCommandContext();
    DbEntityManager dbEntityManger = commandContext.getDbEntityManager();

    // update the related tasks
    for (TaskEntity task: getTasks()) {
      task.setExecutionId(replacedBy.getId());
      task.setExecution(this.replacedBy);

      // update the related local task variables
      List<VariableInstanceEntity> variables = commandContext
        .getVariableInstanceManager()
        .findVariableInstancesByTaskId(task.getId());

      for (VariableInstanceEntity variable : variables) {
        variable.setExecution(this.replacedBy);
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.interceptor.CommandContext

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.