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

The following examples show how to use org.activiti.engine.delegate.DelegateTask#getExecution() . 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: AssigneeOverwriteFromVariable.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void notify(DelegateTask delegateTask) {
  // get mapping table from variable
  DelegateExecution execution = delegateTask.getExecution();
  Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable");

  // get assignee from process
  String assigneeFromProcessDefinition = delegateTask.getAssignee();

  // overwrite assignee if there is an entry in the mapping table
  if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) {
    String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition);
    delegateTask.setAssignee(assigneeFromMappingTable);
  }
}
 
Example 2
Source File: AssigneeOverwriteFromVariable.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void notify(DelegateTask delegateTask) {
  // get mapping table from variable
  DelegateExecution execution = delegateTask.getExecution();
  Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable");
  
  // get assignee from process
  String assigneeFromProcessDefinition = delegateTask.getAssignee();
  
  // overwrite assignee if there is an entry in the mapping table
  if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) {
    String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition);
    delegateTask.setAssignee(assigneeFromMappingTable);
  }
}
 
Example 3
Source File: HumanTaskEventListener.java    From lemon with Apache License 2.0 5 votes vote down vote up
/**
 * 是否会签任务.
 */
public boolean isVote(DelegateTask delegateTask) {
    ExecutionEntity executionEntity = (ExecutionEntity) delegateTask
            .getExecution();
    ActivityImpl activityImpl = executionEntity.getActivity();

    return activityImpl.getProperty("multiInstance") != null;
}
 
Example 4
Source File: HumanTaskTaskListener.java    From lemon with Apache License 2.0 5 votes vote down vote up
/**
 * 是否会签任务.
 */
public boolean isVote(DelegateTask delegateTask) {
    ExecutionEntity executionEntity = (ExecutionEntity) delegateTask
            .getExecution();
    ActivityImpl activityImpl = executionEntity.getActivity();

    return activityImpl.getProperty("multiInstance") != null;
}
 
Example 5
Source File: HumanTaskBuilder.java    From lemon with Apache License 2.0 5 votes vote down vote up
public HumanTaskBuilder setDelegateTask(DelegateTask delegateTask) {
    humanTaskDto.setBusinessKey(delegateTask.getExecution()
            .getProcessBusinessKey());
    humanTaskDto.setName(delegateTask.getName());
    humanTaskDto.setDescription(delegateTask.getDescription());

    humanTaskDto.setCode(delegateTask.getTaskDefinitionKey());
    humanTaskDto.setAssignee(delegateTask.getAssignee());
    humanTaskDto.setOwner(delegateTask.getOwner());
    humanTaskDto.setDelegateStatus("none");
    humanTaskDto.setPriority(delegateTask.getPriority());
    humanTaskDto.setCreateTime(new Date());
    humanTaskDto.setDuration(delegateTask.getDueDate() + "");
    humanTaskDto.setSuspendStatus("none");
    humanTaskDto.setCategory(delegateTask.getCategory());
    humanTaskDto.setForm(delegateTask.getFormKey());
    humanTaskDto.setTaskId(delegateTask.getId());
    humanTaskDto.setExecutionId(delegateTask.getExecutionId());
    humanTaskDto.setProcessInstanceId(delegateTask.getProcessInstanceId());
    humanTaskDto.setProcessDefinitionId(delegateTask
            .getProcessDefinitionId());
    humanTaskDto.setTenantId(delegateTask.getTenantId());
    humanTaskDto.setStatus("active");
    humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_NORMAL);

    ExecutionEntity executionEntity = (ExecutionEntity) delegateTask
            .getExecution();
    ExecutionEntity processInstance = executionEntity.getProcessInstance();
    humanTaskDto.setPresentationSubject(processInstance.getName());

    String userId = Authentication.getAuthenticatedUserId();
    humanTaskDto.setProcessStarter(userId);

    return this;
}