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

The following examples show how to use org.activiti.engine.delegate.DelegateTask#setVariable() . 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: ComplaintUserListener.java    From MicroCommunity with Apache License 2.0 6 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {

    auditUserInnerServiceSMOImpl = ApplicationContextFactory.getBean("auditUserInnerServiceSMOImpl", IAuditUserInnerServiceSMO.class);
    AuditUserDto auditUserDto = new AuditUserDto();
    ComplaintDto complaintDto = (ComplaintDto) delegateTask.getVariable("complaintDto");
    auditUserDto.setStoreId(complaintDto.getStoreId());
    auditUserDto.setObjCode("complaint");
    auditUserDto.setAuditLink("809004");
    List<AuditUserDto> auditUserDtos = auditUserInnerServiceSMOImpl.queryAuditUsers(auditUserDto);


    for (AuditUserDto tmpAuditUser : auditUserDtos) {
        AuditUser auditUser = BeanConvertUtil.covertBean(tmpAuditUser, AuditUser.class);
        delegateTask.setVariable(auditUser.getUserId(), auditUser);
    }

    if (auditUserDtos == null || auditUserDtos.size() < 1) {
        return;
    }
    //delegateTask.addCandidateUser(auditUserDtos.get(0).getUserId());
    logger.info("开始设置投诉建议审核人员:"+auditUserDtos.get(0).getUserId());

    delegateTask.setAssignee(auditUserDtos.get(0).getUserId());
}
 
Example 2
Source File: LeaveCounterSignCompleteListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    String approved = (String) delegateTask.getVariable("approved");
    if (approved.equals("true")) {
        Long agreeCounter = (Long) delegateTask.getVariable("approvedCounter");
        delegateTask.setVariable("approvedCounter", agreeCounter + 1);
    }
}
 
Example 3
Source File: CreateTaskListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    System.out.println(task.getValue(delegateTask));
    delegateTask.setVariable("setInTaskCreate", delegateTask.getEventName() + ", " + content.getValue(delegateTask));
    System.out.println(delegateTask.getEventName() + ",任务分配给:" + delegateTask.getAssignee());
    delegateTask.setAssignee("jenny");
}
 
Example 4
Source File: CreateTaskListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    System.out.println(task.getValue(delegateTask));
    delegateTask.setVariable("setInTaskCreate", delegateTask.getEventName() + ", " + content.getValue(delegateTask));
    System.out.println(delegateTask.getEventName() + ",任务分配给:" + delegateTask.getAssignee());
    delegateTask.setAssignee("jenny");
}
 
Example 5
Source File: DelegateTaskTestTaskListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  Set<IdentityLink> candidates = delegateTask.getCandidates();
  Set<String> candidateUsers = new HashSet<String>();
  Set<String> candidateGroups = new HashSet<String>();
  for (IdentityLink candidate : candidates) {
    if (candidate.getUserId() != null) {
      candidateUsers.add(candidate.getUserId());
    } else if (candidate.getGroupId() != null) {
      candidateGroups.add(candidate.getGroupId());
    }
  }
  delegateTask.setVariable(VARNAME_CANDIDATE_USERS, candidateUsers);
  delegateTask.setVariable(VARNAME_CANDIDATE_GROUPS, candidateGroups);
}
 
Example 6
Source File: TaskCompletionListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  Integer counter = (Integer) delegateTask.getVariable("taskListenerCounter");
  if (counter == null) {
    counter = 0;
  }
  delegateTask.setVariable("taskListenerCounter", ++counter);
}
 
Example 7
Source File: LeaveCounterSignCompleteListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    String approved = (String) delegateTask.getVariable("approved");
    if (approved.equals("true")) {
        Long agreeCounter = (Long) delegateTask.getVariable("approvedCounter");
        delegateTask.setVariable("approvedCounter", agreeCounter + 1);
    }
}
 
Example 8
Source File: TransientVariablesTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  Map<String, Object> transientVariables = delegateTask.getTransientVariables();
  List<String> variableNames = new ArrayList(transientVariables.keySet());
  Collections.sort(variableNames);
  
  StringBuilder strb = new StringBuilder();
  for (String variableName : variableNames) {
    if (variableName.startsWith("transientResult")) {
      String result = (String) transientVariables.get(variableName);
     strb.append(result); 
    }
  }
  
  delegateTask.setVariable("mergedResult", strb.toString());
}
 
Example 9
Source File: TaskAllEventsListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  String events = (String) delegateTask.getVariable("events");
  if (events == null) {
    events = delegateTask.getEventName();
  } else {
    events = events + " - " + delegateTask.getEventName();
  }
  delegateTask.setVariable("events", events);
}
 
Example 10
Source File: ScriptTaskListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  validateParameters();

  ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
  Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), delegateTask, autoStoreVariables);

  if (resultVariable != null) {
    delegateTask.setVariable(resultVariable.getExpressionText(), result);
  }
}
 
Example 11
Source File: CreateTaskListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    System.out.println(task.getValue(delegateTask));
    delegateTask.setVariable("setInTaskCreate", delegateTask.getEventName() + ", " + content.getValue(delegateTask));
    System.out.println(delegateTask.getEventName() + ",任务分配给:" + delegateTask.getAssignee());
    delegateTask.setAssignee("jenny");
}
 
Example 12
Source File: LeaveCounterSignCompleteListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    String approved = (String) delegateTask.getVariable("approved");
    if (approved.equals("true")) {
        Long agreeCounter = (Long) delegateTask.getVariable("approvedCounter");
        delegateTask.setVariable("approvedCounter", agreeCounter + 1);
    }
}
 
Example 13
Source File: CreateTaskListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    System.out.println(task.getValue(delegateTask));
    delegateTask.setVariable("setInTaskCreate", delegateTask.getEventName() + ", " + content.getValue(delegateTask));
    System.out.println(delegateTask.getEventName() + ",任务分配给:" + delegateTask.getAssignee());
    delegateTask.setAssignee("jenny");
}
 
Example 14
Source File: MyBean.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
public void invokeTask(DelegateTask task) {
    task.setVariable("setByTask", "I'm setted by DelegateTask, " + task.getVariable("name"));
}
 
Example 15
Source File: MyTaskListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  delegateTask.setVariable("calledThroughNotify", delegateTask.getName() + "-notify");
}
 
Example 16
Source File: MyBean.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
public void invokeTask(DelegateTask task) {
    task.setVariable("setByTask", "I'm setted by DelegateTask, " + task.getVariable("name"));
}
 
Example 17
Source File: MyBean.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
public void invokeTask(DelegateTask task) {
    task.setVariable("setByTask", "I'm setted by DelegateTask, " + task.getVariable("name"));
}
 
Example 18
Source File: MyTaskListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateTask delegateTask) {
  delegateTask.setVariable("calledThroughNotify", delegateTask.getName() + "-notify");
}
 
Example 19
Source File: MyBean.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
public void invokeTask(DelegateTask task) {
    task.setVariable("setByTask", "I'm setted by DelegateTask, " + task.getVariable("name"));
}
 
Example 20
Source File: MyBean.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
public void invokeTask(DelegateTask task) {
    task.setVariable("setByTask", "I'm setted by DelegateTask, " + task.getVariable("name"));
}