Java Code Examples for org.activiti.engine.delegate.DelegateTask#getTaskDefinitionKey()

The following examples show how to use org.activiti.engine.delegate.DelegateTask#getTaskDefinitionKey() . 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: BxlcTaskListeningImpl.java    From gem with MIT License 6 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
	String name = delegateTask.getTaskDefinitionKey();
	name=name.trim().replaceAll(" ","");
	if(GemFrameStringUtlis.isBlank(name) || name.equalsIgnoreCase("null") && name.length()==0) {
		throw new GemFrameException(GemFrameErrorStatus.PARAMETER_ERROR);
	}
	if (name.equalsIgnoreCase("submit")) {
		delegateTask.setAssignee("1");
	}
	if (name.equalsIgnoreCase("project")) {
		delegateTask.setAssignee("2");
	}
	if (name.equalsIgnoreCase("department")) {
		delegateTask.setAssignee("3");
	}
}
 
Example 2
Source File: ArrivalNotice.java    From lemon with Apache License 2.0 6 votes vote down vote up
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 3
Source File: UserTaskExecutionListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
private SimulationEvent findUserTaskCompleteEvent(DelegateTask delegateTask) {
  if (delegateTask.hasVariable(StartReplayProcessEventHandler.PROCESS_INSTANCE_ID)) {
    String toSimulateProcessInstanceId = (String) delegateTask.getVariable(StartReplayProcessEventHandler.PROCESS_INSTANCE_ID);
    String toSimulateTaskDefinitionKey = delegateTask.getTaskDefinitionKey();
    for (SimulationEvent e : events) {
      if (typeToFind.equals(e.getType()) && toSimulateProcessInstanceId.equals(e.getProperty(UserTaskCompleteTransformer.PROCESS_INSTANCE_ID))
          && toSimulateTaskDefinitionKey.equals(e.getProperty(UserTaskCompleteTransformer.TASK_DEFINITION_KEY)))
        return e;
    }
  }
  return null;
}
 
Example 4
Source File: SkipTaskListener.java    From lemon with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: TaskConfTaskListener.java    From lemon with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
    String businessKey = delegateTask.getExecution()
            .getProcessBusinessKey();
    String taskDefinitionKey = delegateTask.getTaskDefinitionKey();

    ExpressionManager expressionManager = Context
            .getProcessEngineConfiguration().getExpressionManager();

    try {
        String sql = "select ASSIGNEE from BPM_TASK_CONF where BUSINESS_KEY=? and TASK_DEFINITION_KEY=?";
        String assignee = jdbcTemplate.queryForObject(sql, String.class,
                businessKey, taskDefinitionKey);

        if ((assignee == null) || "".equals(assignee)) {
            return;
        }

        if ((assignee.indexOf("&&") != -1)
                || (assignee.indexOf("||") != -1)) {
            logger.info("assignee : {}", assignee);

            List<String> candidateUsers = new Expr().evaluate(assignee,
                    this);
            logger.info("candidateUsers : {}", candidateUsers);
            delegateTask.addCandidateUsers(candidateUsers);
        } else {
            String value = expressionManager.createExpression(assignee)
                    .getValue(delegateTask).toString();
            delegateTask.setAssignee(value);
        }
    } catch (Exception ex) {
        logger.debug(ex.getMessage(), ex);
    }
}
 
Example 6
Source File: SkipEventListener.java    From lemon with Apache License 2.0 5 votes vote down vote up
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 7
Source File: CompleteNotice.java    From lemon with Apache License 2.0 5 votes vote down vote up
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 8
Source File: TimeoutNotice.java    From lemon with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}