Java Code Examples for org.activiti.engine.delegate.DelegateTask#getProcessDefinitionId()
The following examples show how to use
org.activiti.engine.delegate.DelegateTask#getProcessDefinitionId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrivalNotice.java From lemon with Apache License 2.0 | 6 votes |
public void process(DelegateTask delegateTask) { if (delegateTask.getAssignee() == null) { return; } String taskDefinitionKey = delegateTask.getTaskDefinitionKey(); String processDefinitionId = delegateTask.getProcessDefinitionId(); List<BpmConfNotice> bpmConfNotices = ApplicationContextHelper .getBean(BpmConfNoticeManager.class) .find("from BpmConfNotice where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?", processDefinitionId, taskDefinitionKey); for (BpmConfNotice bpmConfNotice : bpmConfNotices) { if (TYPE_ARRIVAL == bpmConfNotice.getType()) { processArrival(delegateTask, bpmConfNotice); } } }
Example 2
Source File: SkipTaskListener.java From lemon with Apache License 2.0 | 5 votes |
@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); } } }
Example 3
Source File: SkipEventListener.java From lemon with Apache License 2.0 | 5 votes |
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); } } }
Example 4
Source File: CompleteNotice.java From lemon with Apache License 2.0 | 5 votes |
public void process(DelegateTask delegateTask) { String taskDefinitionKey = delegateTask.getTaskDefinitionKey(); String processDefinitionId = delegateTask.getProcessDefinitionId(); List<BpmConfNotice> bpmConfNotices = ApplicationContextHelper .getBean(BpmConfNoticeManager.class) .find("from BpmConfNotice where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?", processDefinitionId, taskDefinitionKey); for (BpmConfNotice bpmConfNotice : bpmConfNotices) { if (TYPE_COMPLETE == bpmConfNotice.getType()) { processComplete(delegateTask, bpmConfNotice); } } }
Example 5
Source File: TimeoutNotice.java From lemon with Apache License 2.0 | 5 votes |
public void process(DelegateTask delegateTask) { String taskDefinitionKey = delegateTask.getTaskDefinitionKey(); String processDefinitionId = delegateTask.getProcessDefinitionId(); List<BpmConfNotice> bpmConfNotices = ApplicationContextHelper .getBean(BpmConfNoticeManager.class) .find("from BpmConfNotice where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?", processDefinitionId, taskDefinitionKey); for (BpmConfNotice bpmConfNotice : bpmConfNotices) { if (TYPE_TIMEOUT == bpmConfNotice.getType()) { processTimeout(delegateTask, bpmConfNotice); } } }
Example 6
Source File: SkipTaskListener.java From lemon with Apache License 2.0 | 4 votes |
public void processNeighbor(DelegateTask delegateTask, String value) { String processDefinitionId = delegateTask.getProcessDefinitionId(); ProcessDefinitionEntity processDefinitionEntity = Context .getProcessEngineConfiguration().getProcessDefinitionCache() .get(processDefinitionId); ActivityImpl activityImpl = processDefinitionEntity .findActivity(delegateTask.getTaskDefinitionKey()); PvmTransition pvmTransition = activityImpl.getIncomingTransitions() .iterator().next(); PvmActivity pvmActivity = pvmTransition.getSource(); if (!"userTask".equals(pvmActivity.getProperty("type"))) { logger.info("previous {} {} not userTask, just skip", pvmActivity.getId(), pvmActivity.getProperty("type")); return; } String targetActivityId = pvmActivity.getId(); /* * JdbcTemplate jdbcTemplate = ApplicationContextHelper .getBean(JdbcTemplate.class); String previousAssignee = * jdbcTemplate .queryForObject( * "select ASSIGNEE_ from ACT_HI_TASKINST where ACT_ID_=? order by END_TIME_ desc", String.class, * targetActivityId); */ List<HistoricTaskInstanceEntity> historicTaskInstanceEntities = Context .getCommandContext().getDbSqlSession() .findInCache(HistoricTaskInstanceEntity.class); logger.info("{}", historicTaskInstanceEntities); String previousAssignee = null; for (HistoricTaskInstanceEntity historicTaskInstanceEntity : historicTaskInstanceEntities) { if (targetActivityId.equals(historicTaskInstanceEntity .getTaskDefinitionKey())) { previousAssignee = historicTaskInstanceEntity.getAssignee(); break; } } if (previousAssignee == null) { logger.info("cannot previous assignee, skip"); return; } logger.info("previousAssignee : {}", previousAssignee); logger.info("delegateTask.getAssignee() : {}", delegateTask.getAssignee()); if (previousAssignee.equals(delegateTask.getAssignee())) { logger.info("skip"); new CompleteTaskWithCommentCmd(delegateTask.getId(), Collections.<String, Object> emptyMap(), "相邻相同人员自动跳过") .execute(Context.getCommandContext()); } }
Example 7
Source File: SkipEventListener.java From lemon with Apache License 2.0 | 4 votes |
public void processNeighbor(DelegateTask delegateTask, String value) { String processDefinitionId = delegateTask.getProcessDefinitionId(); ProcessDefinitionEntity processDefinitionEntity = Context .getProcessEngineConfiguration().getProcessDefinitionCache() .get(processDefinitionId); ActivityImpl activityImpl = processDefinitionEntity .findActivity(delegateTask.getTaskDefinitionKey()); PvmTransition pvmTransition = activityImpl.getIncomingTransitions() .iterator().next(); PvmActivity pvmActivity = pvmTransition.getSource(); if (!"userTask".equals(pvmActivity.getProperty("type"))) { logger.info("previous {} {} not userTask, just skip", pvmActivity.getId(), pvmActivity.getProperty("type")); return; } String targetActivityId = pvmActivity.getId(); /* * JdbcTemplate jdbcTemplate = ApplicationContextHelper .getBean(JdbcTemplate.class); String previousAssignee = * jdbcTemplate .queryForObject( * "select ASSIGNEE_ from ACT_HI_TASKINST where ACT_ID_=? order by END_TIME_ desc", String.class, * targetActivityId); */ List<HistoricTaskInstanceEntity> historicTaskInstanceEntities = Context .getCommandContext().getDbSqlSession() .findInCache(HistoricTaskInstanceEntity.class); logger.info("{}", historicTaskInstanceEntities); String previousAssignee = null; for (HistoricTaskInstanceEntity historicTaskInstanceEntity : historicTaskInstanceEntities) { if (targetActivityId.equals(historicTaskInstanceEntity .getTaskDefinitionKey())) { previousAssignee = historicTaskInstanceEntity.getAssignee(); break; } } if (previousAssignee == null) { logger.info("cannot previous assignee, skip"); return; } logger.info("previousAssignee : {}", previousAssignee); logger.info("delegateTask.getAssignee() : {}", delegateTask.getAssignee()); if (previousAssignee.equals(delegateTask.getAssignee())) { logger.info("skip"); // new CompleteTaskWithCommentCmd(delegateTask.getId(), // Collections.<String, Object> emptyMap(), "相邻相同人员自动跳过") // .execute(Context.getCommandContext()); this.doSkip(delegateTask); } }
Example 8
Source File: HumanTaskUserTaskListener.java From lemon with Apache License 2.0 | 4 votes |
@Override public void onCreate(DelegateTask delegateTask) throws Exception { String processDefinitionId = delegateTask.getProcessDefinitionId(); String businessKey = delegateTask.getExecution() .getProcessBusinessKey(); String taskDefinitionKey = delegateTask.getExecution() .getCurrentActivityId(); ProcessTaskDefinition processTaskDefinition = internalProcessConnector .findTaskDefinition(processDefinitionId, businessKey, taskDefinitionKey); ExpressionManager expressionManager = Context .getProcessEngineConfiguration().getExpressionManager(); for (ParticipantDefinition participantDefinition : processTaskDefinition .getParticipantDefinitions()) { if ("user".equals(participantDefinition.getType())) { if ("add".equals(participantDefinition.getStatus())) { delegateTask.addCandidateUser(participantDefinition .getValue()); } else { delegateTask.deleteCandidateUser(participantDefinition .getValue()); } } else { if ("add".equals(participantDefinition.getStatus())) { delegateTask.addCandidateGroup(participantDefinition .getValue()); } else { delegateTask.deleteCandidateGroup(participantDefinition .getValue()); } } } String assignee = null; if (processTaskDefinition.getAssignee() != null) { assignee = expressionManager .createExpression(processTaskDefinition.getAssignee()) .getValue(delegateTask).toString(); } if (assignee == null) { delegateTask.setAssignee(null); } else if ((assignee.indexOf("&&") != -1) || (assignee.indexOf("||") != -1)) { logger.debug("assignee : {}", assignee); List<String> candidateUsers = new Expr().evaluate(assignee, this); logger.debug("candidateUsers : {}", candidateUsers); delegateTask.addCandidateUsers(candidateUsers); } else { delegateTask.setAssignee(assignee); } }