• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HistoricProcessInstanceEntity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceEntity类的具体用法?Java HistoricProcessInstanceEntity怎么用?Java HistoricProcessInstanceEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HistoricProcessInstanceEntity类属于org.activiti.engine.impl.persistence.entity包,在下文中一共展示了HistoricProcessInstanceEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processPosition

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void processPosition(DelegateTask delegateTask, String value) {
    String processInstanceId = delegateTask.getProcessInstanceId();
    HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
            .getCommandContext().getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    String initiator = historicProcessInstanceEntity.getStartUserId();
    OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
            .getBean(OrgConnector.class);

    // 获得发起人的职位
    int initiatorLevel = orgConnector.getJobLevelByUserId(initiator);

    // 获得审批人的职位
    int assigneeLevel = orgConnector.getJobLevelByUserId(delegateTask
            .getAssignee());

    // 比较
    if (initiatorLevel >= assigneeLevel) {
        logger.info("skip task : {}", delegateTask.getId());
        logger.info("initiatorLevel : {}, assigneeLevel : {}",
                initiatorLevel, assigneeLevel);
        new CompleteTaskWithCommentCmd(delegateTask.getId(),
                Collections.<String, Object> emptyMap(), "高级职位自动跳过")
                .execute(Context.getCommandContext());
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:27,代码来源:SkipTaskListener.java


示例2: recordProcessInstanceEnd

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@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);

            // Fire event
            ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
            if (config != null && config.getEventDispatcher().isEnabled()) {
                config.getEventDispatcher().dispatchEvent(
                        ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_ENDED, historicProcessInstance));
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:21,代码来源:DefaultHistoryManager.java


示例3: getVariableFromRequest

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public RestVariable getVariableFromRequest(boolean includeBinary, String processInstanceId, String variableName) {

        HistoryService historyService = BPMNOSGIService.getHistoryService();
        HistoricProcessInstance processObject = historyService.createHistoricProcessInstanceQuery()
                .processInstanceId(processInstanceId).includeProcessVariables().singleResult();

        if (processObject == null) {
            throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' couldn't be found.", HistoricProcessInstanceEntity.class);
        }

        Object value = processObject.getProcessVariables().get(variableName);

        if (value == null) {
            throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' variable value for " + variableName + " couldn't be found.", VariableInstanceEntity.class);
        } else {
            return new RestResponseFactory().createRestVariable(variableName, value, null, processInstanceId,
                    RestResponseFactory.VARIABLE_HISTORY_PROCESS, includeBinary, uriInfo.getBaseUri().toString());
        }
    }
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:20,代码来源:HistoricProcessInstanceService.java


示例4: onCreate

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@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);

    for (BpmConfRule bpmConfRule : bpmConfRules) {
        String value = bpmConfRule.getValue();

        if ("职位".equals(value) || "高级职位自动跳过".equals(value)) {
            this.processPosition(delegateTask, value);
        } else if ("相邻相同人员自动跳过".equals(value)) {
            this.processNeighbor(delegateTask, value);
        } else {
            this.processExpression(delegateTask, value);
        }
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:32,代码来源:SkipTaskListener.java


示例5: processExpression

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void processExpression(DelegateTask delegateTask, String value) {
    UserConnector userConnector = ApplicationContextHelper
            .getBean(UserConnector.class);
    ExpressionManager expressionManager = Context
            .getProcessEngineConfiguration().getExpressionManager();
    String processInstanceId = delegateTask.getProcessInstanceId();
    HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
            .getCommandContext().getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    String initiator = historicProcessInstanceEntity.getStartUserId();
    MapVariableScope mapVariableScope = new MapVariableScope();
    mapVariableScope.setVariable("initiator",
            userConnector.findById(initiator));

    Object objectResult = expressionManager.createExpression(value)
            .getValue(mapVariableScope);

    if ((objectResult == null) || (!(objectResult instanceof Boolean))) {
        logger.error("{} is not Boolean, just return", objectResult);

        return;
    }

    Boolean result = (Boolean) objectResult;

    logger.info("value : {}, result : {}", value, result);

    if (result) {
        logger.info("skip task : {}", delegateTask.getId());
        new CompleteTaskWithCommentCmd(delegateTask.getId(),
                Collections.<String, Object> emptyMap(), "跳过")
                .execute(Context.getCommandContext());
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:35,代码来源:SkipTaskListener.java


示例6: onCreate

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
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);

    for (BpmConfRule bpmConfRule : bpmConfRules) {
        String value = bpmConfRule.getValue();

        if ("职位".equals(value) || "高级职位自动跳过".equals(value)) {
            this.processPosition(delegateTask, value);
        } else if ("相邻相同人员自动跳过".equals(value)) {
            this.processNeighbor(delegateTask, value);
        } else {
            this.processExpression(delegateTask, value);
        }
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:31,代码来源:SkipEventListener.java


示例7: processPosition

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void processPosition(DelegateTask delegateTask, String value) {
    String processInstanceId = delegateTask.getProcessInstanceId();
    HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
            .getCommandContext().getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    String initiator = historicProcessInstanceEntity.getStartUserId();
    OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
            .getBean(OrgConnector.class);

    // 获得发起人的职位
    int initiatorLevel = orgConnector.getJobLevelByUserId(initiator);

    // 获得审批人的职位
    int assigneeLevel = orgConnector.getJobLevelByUserId(delegateTask
            .getAssignee());

    // 比较
    if (initiatorLevel >= assigneeLevel) {
        logger.info("skip task : {}", delegateTask.getId());
        logger.info("initiatorLevel : {}, assigneeLevel : {}",
                initiatorLevel, assigneeLevel);
        // new CompleteTaskWithCommentCmd(delegateTask.getId(),
        // Collections.<String, Object> emptyMap(), "高级职位自动跳过")
        // .execute(Context.getCommandContext());
        this.doSkip(delegateTask);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:28,代码来源:SkipEventListener.java


示例8: processExpression

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void processExpression(DelegateTask delegateTask, String value) {
    UserConnector userConnector = ApplicationContextHelper
            .getBean(UserConnector.class);
    ExpressionManager expressionManager = Context
            .getProcessEngineConfiguration().getExpressionManager();
    String processInstanceId = delegateTask.getProcessInstanceId();
    HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
            .getCommandContext().getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    String initiator = historicProcessInstanceEntity.getStartUserId();
    MapVariableScope mapVariableScope = new MapVariableScope();
    mapVariableScope.setVariable("initiator",
            userConnector.findById(initiator));

    Object objectResult = expressionManager.createExpression(value)
            .getValue(mapVariableScope);

    if ((objectResult == null) || (!(objectResult instanceof Boolean))) {
        logger.error("{} is not Boolean, just return", objectResult);

        return;
    }

    Boolean result = (Boolean) objectResult;

    logger.info("value : {}, result : {}", value, result);

    if (result) {
        logger.info("skip task : {}", delegateTask.getId());
        // new CompleteTaskWithCommentCmd(delegateTask.getId(),
        // Collections.<String, Object> emptyMap(), "跳过")
        // .execute(Context.getCommandContext());
        this.doSkip(delegateTask);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:36,代码来源:SkipEventListener.java


示例9: execute

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
    HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(historicProcessInstanceId);

    if (historicProcessInstanceEntity.getEndTime() == null) {
        logger.info("historicProcessInstanceId is running");

        return null;
    }

    historicProcessInstanceEntity.setEndActivityId(null);
    historicProcessInstanceEntity.setEndTime(null);

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

    ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId).execute(commandContext);

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

    try {
        Authentication.setAuthenticatedUserId(initiator);
        // start
        processInstance.start();
    } finally {
        Authentication.setAuthenticatedUserId(null);
    }

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:39,代码来源:ReOpenProcessCmd.java


示例10: recordProcessInstanceNameChange

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void recordProcessInstanceNameChange(String processInstanceId, String newName) {
    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
                .findHistoricProcessInstance(processInstanceId);

        if (historicProcessInstance != null) {
            historicProcessInstance.setName(newName);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:DefaultHistoryManager.java


示例11: recordProcessDefinitionChange

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void recordProcessDefinitionChange(String processInstanceId, String processDefinitionId) {
    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager().findHistoricProcessInstance(processInstanceId);
        if (historicProcessInstance != null) {
            historicProcessInstance.setProcessDefinitionId(processDefinitionId);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:10,代码来源:DefaultHistoryManager.java


示例12: updateProcessBusinessKeyInHistory

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void updateProcessBusinessKeyInHistory(ExecutionEntity processInstance) {
    if (isHistoryEnabled()) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.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);
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:16,代码来源:DefaultHistoryManager.java


示例13: notify

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void notify(DelegateExecution execution) {
  HistoricProcessInstanceEntity historicProcessInstance = Context
    .getCommandContext()
    .getHistoricProcessInstanceManager()
    .findHistoricProcessInstance(execution.getProcessInstanceId());
  
  if (historicProcessInstance!=null) {
    String deleteReason = ((ExecutionEntity) execution).getDeleteReason();
    historicProcessInstance.markEnded(deleteReason);
    historicProcessInstance.setEndActivityId(((ExecutionEntity) execution).getActivityId());
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:ProcessInstanceEndHandler.java


示例14: recordProcessInstanceEnd

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
 * Record a process-instance ended. Updates the historic process instance if activity history is enabled.
 */
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);
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:16,代码来源:HistoryManager.java


示例15: recordProcessInstanceStart

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
 * Record a process-instance started and record start-event if activity history is enabled.
 */
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
    IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
    
    String processDefinitionId = processInstance.getProcessDefinitionId();
    String processInstanceId = processInstance.getProcessInstanceId();
    String executionId = processInstance.getId();

    HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
    historicActivityInstance.setId(idGenerator.getNextId());
    historicActivityInstance.setProcessDefinitionId(processDefinitionId);
    historicActivityInstance.setProcessInstanceId(processInstanceId);
    historicActivityInstance.setExecutionId(executionId);
    historicActivityInstance.setActivityId(processInstance.getActivityId());
    historicActivityInstance.setActivityName((String) processInstance.getActivity().getProperty("name"));
    historicActivityInstance.setActivityType((String) processInstance.getActivity().getProperty("type"));
    Date now = ClockUtil.getCurrentTime();
    historicActivityInstance.setStartTime(now);
    
    getDbSqlSession()
      .insert(historicActivityInstance);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:33,代码来源:HistoryManager.java


示例16: recordSubProcessInstanceStart

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
 * Record a sub-process-instance started and alters the calledProcessinstanceId
 * on the current active activity's historic counterpart. Only effective when activity history is enabled.
 */
public void recordSubProcessInstanceStart(ExecutionEntity parentExecution, ExecutionEntity subProcessInstance) {
  if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
    
    HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity((ExecutionEntity) subProcessInstance);
    getDbSqlSession().insert(historicProcessInstance);
    
    HistoricActivityInstanceEntity activitiyInstance = findActivityInstance(parentExecution);
    if (activitiyInstance != null) {
      activitiyInstance.setCalledProcessInstanceId(subProcessInstance.getProcessInstanceId());
    }
    
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:18,代码来源:HistoryManager.java


示例17: recordProcessDefinitionChange

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
 * Record a change of the process-definition id of a process instance, if activity history is enabled.
 */
public void recordProcessDefinitionChange(String processInstanceId, String processDefinitionId) {
  if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
    HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager().findHistoricProcessInstance(processInstanceId);
    if(historicProcessInstance != null) {
      historicProcessInstance.setProcessDefinitionId(processDefinitionId);
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:12,代码来源:HistoryManager.java


示例18: testHistoricProcessInstanceQueryByProcessDefinitionKey

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml",
    "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml" })
public void testHistoricProcessInstanceQueryByProcessDefinitionKey() {

  String processDefinitionKey = "oneTaskProcess";
  runtimeService.startProcessInstanceByKey(processDefinitionKey);
  runtimeService.startProcessInstanceByKey("orderProcess");
  HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processDefinitionKey(processDefinitionKey)
          .singleResult();
  assertNotNull(historicProcessInstance);
  assertTrue(historicProcessInstance.getProcessDefinitionId().startsWith(processDefinitionKey));
  assertEquals("theStart", historicProcessInstance.getStartActivityId());

  // now complete the task to end the process instance
  Task task = taskService.createTaskQuery().processDefinitionKey("checkCreditProcess").singleResult();
  Map<String, Object> map = new HashMap<String, Object>();
  map.put("creditApproved", true);
  taskService.complete(task.getId(), map);

  // and make sure the super process instance is set correctly on the
  // HistoricProcessInstance
  HistoricProcessInstance historicProcessInstanceSub = historyService.createHistoricProcessInstanceQuery().processDefinitionKey("checkCreditProcess")
          .singleResult();
  HistoricProcessInstance historicProcessInstanceSuper = historyService.createHistoricProcessInstanceQuery().processDefinitionKey("orderProcess")
          .singleResult();
  assertEquals(historicProcessInstanceSuper.getId(), ((HistoricProcessInstanceEntity) historicProcessInstanceSub).getSuperProcessInstanceId());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:28,代码来源:HistoryServiceTest.java


示例19: onInitialized

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
protected void onInitialized(ActivitiEvent event) {
    if (!(event instanceof ActivitiEntityEventImpl)) {
        return;
    }

    ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
    Object entity = activitiEntityEventImpl.getEntity();

    if (!(entity instanceof ExecutionEntity)) {
        return;
    }

    ExecutionEntity executionEntity = (ExecutionEntity) entity;

    if (!executionEntity.isProcessInstanceType()) {
        return;
    }

    String processInstanceId = executionEntity.getId();
    String processDefinitionId = executionEntity.getProcessDefinitionId();
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId).execute(commandContext);

    // {流程标题:title}-{发起人:startUser}-{发起时间:startTime}
    String processDefinitionName = processDefinition.getName();

    if (processDefinitionName == null) {
        processDefinitionName = processDefinition.getKey();
    }

    String userId = Authentication.getAuthenticatedUserId();
    String displayName = userConnector.findById(userId).getDisplayName();
    String processInstanceName = processDefinitionName + "-" + displayName
            + "-"
            + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
    // runtime
    executionEntity.setName(processInstanceName);

    // history
    HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    historicProcessInstanceEntity.setName(processInstanceName);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:46,代码来源:UpdateProcessInstanceNameEventListener.java


示例20: processComplete

import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void processComplete(DelegateTask delegateTask,
        BpmConfNotice bpmConfNotice) {
    UserConnector userConnector = ApplicationContextHelper
            .getBean(UserConnector.class);
    NotificationConnector notificationConnector = ApplicationContextHelper
            .getBean(NotificationConnector.class);

    //
    Map<String, Object> data = new HashMap<String, Object>();
    TaskEntity taskEntity = new TaskEntity();
    taskEntity.setId(delegateTask.getId());
    taskEntity.setName(delegateTask.getName());
    taskEntity.setAssigneeWithoutCascade(userConnector.findById(
            delegateTask.getAssignee()).getDisplayName());
    taskEntity.setVariableLocal("initiator",
            getInitiator(userConnector, delegateTask));

    //
    data.put("task", taskEntity);
    data.put("initiator", this.getInitiator(userConnector, delegateTask));

    String receiver = bpmConfNotice.getReceiver();

    /*
     * BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate(); ExpressionManager expressionManager =
     * Context .getProcessEngineConfiguration().getExpressionManager();
     */
    UserDTO userDto = null;

    if ("任务接收人".equals(receiver)) {
        userDto = userConnector.findById(delegateTask.getAssignee());
    } else if ("流程发起人".equals(receiver)) {
        userDto = userConnector.findById((String) delegateTask
                .getVariables().get("initiator"));
    } else {
        HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                .getCommandContext()
                .getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(
                        delegateTask.getProcessInstanceId());
        userDto = userConnector.findById(historicProcessInstanceEntity
                .getStartUserId());
    }

    /*
     * String subject = expressionManager .createExpression(bpmMailTemplate.getSubject())
     * .getValue(taskEntity).toString();
     * 
     * String content = expressionManager .createExpression(bpmMailTemplate.getContent())
     * .getValue(taskEntity).toString(); this.sendMail(userDto, subject, content); this.sendSiteMessage(userDto,
     * subject, content);
     */
    NotificationDTO notificationDto = new NotificationDTO();
    notificationDto.setReceiver(userDto.getId());
    notificationDto.setReceiverType("userid");
    notificationDto.setTypes(Arrays.asList(bpmConfNotice
            .getNotificationType().split(",")));
    notificationDto.setData(data);
    notificationDto.setTemplate(bpmConfNotice.getTemplateCode());
    notificationConnector.send(notificationDto, delegateTask.getTenantId());
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:62,代码来源:CompleteNotice.java



注:本文中的org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CreatePlatformEndpointResult类代码示例发布时间:2022-05-23
下一篇:
Java ParsedNameClass类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap