public Map<String, Object> execute(Environment environment) throws Exception {
    Map<String, Object> variables = new HashMap<String, Object>();

    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    for (String variableName : variableNames) {
      Object value = task.getVariable(variableName);
      variables.put(variableName, value);
    }

    return variables;
  }
Example #2
0
 /** 显示自定义的任务信息 */
 public List<TaskInfo> getTaskInfosByUserId(String userId, PagingBean pb) {
   List<TaskImpl> list = getTasksByUserId(userId, pb);
   List<TaskInfo> taskInfoList = new ArrayList<TaskInfo>();
   for (TaskImpl taskImpl : list) {
     TaskInfo taskInfo = new TaskInfo(taskImpl);
     if (taskImpl.getAssignee() != null) {
       AppUser user = appUserService.get(new Long(taskImpl.getAssignee()));
       taskInfo.setAssignee(user.getFullname());
     }
     ProcessRun processRun = processRunService.getByPiId(taskImpl.getExecutionId());
     if (processRun != null) {
       taskInfo.setActivityName(
           processRun.getProDefinition().getName() + "--" + taskImpl.getActivityName());
     }
     // 显示任务,需要加上流程的名称
     taskInfoList.add(taskInfo);
   }
   return taskInfoList;
 }
  public JbpmConstantsElResolver(ScopeInstanceImpl scopeInstance) {
    if (scopeInstance instanceof ExecutionImpl) {
      this.execution = (ExecutionImpl) scopeInstance;
      this.processInstance = execution.getProcessInstance();

    } else {
      this.task = (TaskImpl) scopeInstance;
      this.execution = task.getExecution();
      if (this.execution != null) {
        this.processInstance = execution.getProcessInstance();
      }
    }
  }