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

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


        }

        // 操作historicProcessInstance表
        HistoricProcessInstanceEntityManager historicProcessInstanceEntityManager = commandContext
                .getHistoricProcessInstanceEntityManager();
        HistoricProcessInstanceEntity historicProcessInstance = historicProcessInstanceEntityManager
                .findHistoricProcessInstance(processInstanceId);
        historicProcessInstance.setProcessDefinitionId(processDefinitionId);
        dbSqlSession.update(historicProcessInstance);

        return null;
    }
View Full Code Here


    public ReOpenProcessCmd(String historicProcessInstanceId) {
        this.historicProcessInstanceId = historicProcessInstanceId;
    }

    public Void execute(CommandContext commandContext) {
        HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
                .getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(historicProcessInstanceId);
        historicProcessInstanceEntity.setEndActivityId(null);
        historicProcessInstanceEntity.setEndTime(null);

        String processDefinitionId = historicProcessInstanceEntity
                .getProcessDefinitionId();
        String initiator = historicProcessInstanceEntity.getStartUserId();
        String businessKey = historicProcessInstanceEntity.getBusinessKey();

        // Authentication.setAuthenticatedUserId(initiator);
        ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
                processDefinitionId).execute(commandContext);

        // ExecutionEntity processInstance = processDefinition
        // .createProcessInstance(businessKey);
        ExecutionEntity processInstance = this.createProcessInstance(
                historicProcessInstanceEntity.getId(), businessKey, initiator,
                processDefinition);

        // start
        processInstance.start();
View Full Code Here

    @Override
    public void onCreate(DelegateTask delegateTask) throws Exception {
        String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
        String processDefinitionId = delegateTask.getProcessDefinitionId();
        String processInstanceId = delegateTask.getProcessInstanceId();
        HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                .getCommandContext().getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(processInstanceId);

        List<BpmConfRule> bpmConfRules = ApplicationContextHelper
                .getBean(BpmConfRuleManager.class)
                .find("from BpmConfRule where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                        processDefinitionId, taskDefinitionKey);
        logger.debug("delegateTask.getId : {}", delegateTask.getId());
        logger.debug("taskDefinitionKey : {}", taskDefinitionKey);
        logger.debug("processDefinitionId : {}", processDefinitionId);
        logger.debug("processInstanceId : {}", processInstanceId);
        logger.debug("bpmConfRules : {}", bpmConfRules);

        UserConnector userConnector = ApplicationContextHelper
                .getBean(UserConnector.class);
        OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
                .getBean(OrgConnector.class);
        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();
        MapVariableScope mapVariableScope = new MapVariableScope();
        String initiator = historicProcessInstanceEntity.getStartUserId();
        mapVariableScope.setVariable("initiator",
                userConnector.findById(initiator));

        for (BpmConfRule bpmConfRule : bpmConfRules) {
            String value = bpmConfRule.getValue();
View Full Code Here

 
  @Override
  public ProcessInstanceHistoryLog execute(CommandContext commandContext) {
   
    // Fetch historic process instance
    HistoricProcessInstanceEntity historicProcessInstance = commandContext
        .getHistoricProcessInstanceEntityManager().findHistoricProcessInstance(processInstanceId);
   
    if (historicProcessInstance == null) {
      return null;
    }
View Full Code Here

*/
  @Override
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {
   
    if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
              .findHistoricProcessInstance(processInstanceId);
     
      if (historicProcessInstance!=null) {
        historicProcessInstance.markEnded(deleteReason);
        historicProcessInstance.setEndActivityId(activityId);
      }
    }
  }
View Full Code Here

  }
 
  @Override
  public void recordProcessInstanceNameChange(String processInstanceId, String newName) {
    if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
              .findHistoricProcessInstance(processInstanceId);
     
      if (historicProcessInstance!=null) {
        historicProcessInstance.setName(newName);
      }
    }
  }
View Full Code Here

* @see org.activiti.engine.impl.history.HistoryManagerInterface#recordProcessInstanceStart(org.activiti.engine.impl.persistence.entity.ExecutionEntity)
*/
  @Override
public void recordProcessInstanceStart(ExecutionEntity processInstance) {
    if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity(processInstance);
     
      // Insert historic process-instance
      getDbSqlSession().insert(historicProcessInstance);
 
      // Also record the start-event manually, as there is no "start" activity history listener for this
View Full Code Here

*/
  @Override
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);
     
     
View Full Code Here

* @see org.activiti.engine.impl.history.HistoryManagerInterface#recordProcessDefinitionChange(java.lang.String, java.lang.String)
*/
  @Override
public void recordProcessDefinitionChange(String processInstanceId, String processDefinitionId) {
    if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager().findHistoricProcessInstance(processInstanceId);
      if(historicProcessInstance != null) {
        historicProcessInstance.setProcessDefinitionId(processDefinitionId);
      }
    }
  }
View Full Code Here

    if (isHistoryEnabled()) {
      if(log.isDebugEnabled()) {
        log.debug("updateProcessBusinessKeyInHistory : {}", processInstance.getId());
      }
      if (processInstance != null) {
        HistoricProcessInstanceEntity historicProcessInstance = getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstance.getId());
        if (historicProcessInstance != null) {
          historicProcessInstance.setBusinessKey(processInstance.getProcessBusinessKey());
          getDbSqlSession().update(historicProcessInstance);
        }
      }
    }
  }
View Full Code Here

TOP

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

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.