@Override // 默认销售负责人负责的工单列表
 public String execute() throws Exception {
   List<Issue> dbIssues = new ArrayList<Issue>();
   HttpSession session = request.getSession();
   // 获取当前登录用户
   User sessionUser = (User) session.getAttribute(LicenseWorkFlowConstants.SESSION_USER);
   // 获取流程定义列表
   List<ProcessDefinition> pdList =
       issueService.getRepositoryService().createProcessDefinitionQuery().list();
   // 获取流程实例列表
   List<ProcessInstance> piList =
       issueService.getExecutionService().createProcessInstanceQuery().list();
   // 获取该用户组内的任务
   List<Task> taskList = issueService.getTaskService().findGroupTasks(sessionUser.getName());
   // 查询库中所有的工单
   dbIssues = issueService.getAllIssues();
   // 获取流程寮例历史记录列表
   List<HistoryProcessInstance> hplist =
       issueService.getHistoryService().createHistoryProcessInstanceQuery().list();
   String processDefinitionId = ""; // 流程定义标识
   if (pdList != null && pdList.size() > 0) {
     processDefinitionId = ((ProcessDefinition) (pdList.get(0))).getId();
   }
   // 遍历系统中的工单
   for (Issue issue : dbIssues) {
     // 设置工单的流程节点
     String activeName = issueService.getActiveName(issue.getProcessInstanceId());
     IssueVO issueVO = new IssueVO();
     issueVO.setWorkFlowNodeName(activeName);
     // 遍历当前登录用户的task列表
     for (Task task : taskList) {
       // 获取执行
       Execution execution =
           issueService.getExecutionService().findExecutionById(task.getExecutionId());
       ExecutionImpl execImpl = (ExecutionImpl) execution;
       // 获取执行的流程实例
       ProcessInstance processInstance = execImpl.getProcessInstance();
       if (issue.getProcessInstanceId().equals(processInstance.getId())) {
         // 显示审核链接
         issueVO.setShowAudit(true);
         // 当前工单要审核的task
         issueVO.setIssueTask(task);
         break;
       } else {
         issueVO.setShowAudit(false);
       }
     }
     LicenseWorkFlowConstants.issuePOTOVOCopier.copy(issue, issueVO, null);
     issues.add(issueVO);
   }
   return "index";
 }
Exemplo n.º 2
0
  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();
      }
    }
  }
 public Object set(String key, Object value) {
   if (CONTEXTNAME_EXECUTION.equals(key)) {
     throw new JbpmException("can't set execution");
   }
   execution.setVariable(key, value);
   return null;
 }
Exemplo n.º 4
0
  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters)
      throws Exception {
    Activity activity = execution.getActivity();

    if (parameters != null) {
      execution.setVariables(parameters);
    }

    execution.fire(signalName, activity);

    Transition transition = null;
    if ((signalName == null)
        && (activity.getOutgoingTransitions() != null)
        && (activity.getOutgoingTransitions().size() == 1)) {
      transition = activity.getOutgoingTransitions().get(0);
    } else {
      transition = activity.findOutgoingTransition(signalName);
    }

    if (transition != null) {
      execution.historyActivityEnd(signalName);
      execution.take(transition);
    } else {
      execution.waitForSignal();
    }
  }
Exemplo n.º 5
0
  public void execute(ExecutionImpl execution) {
    execution.historyActivityStart();

    execution.waitForSignal();
  }
 public Set<String> keys() {
   Set<String> keys = new HashSet<String>(execution.getVariableKeys());
   keys.add(CONTEXTNAME_EXECUTION);
   return keys;
 }
 public boolean has(String key) {
   if (CONTEXTNAME_EXECUTION.equals(key)) {
     return true;
   }
   return execution.hasVariable(key);
 }
 public Object get(String key) {
   if (CONTEXTNAME_EXECUTION.equals(key)) {
     return execution;
   }
   return execution.getVariable(key);
 }
Exemplo n.º 9
0
  public void execute(ExecutionImpl execution) {
    Activity activity = execution.getActivity();

    // evaluate the conditions and select the forking transitions
    List<Transition> forkingTransitions = new ArrayList<Transition>();
    for (Transition transition : activity.getOutgoingTransitions()) {
      Condition condition = ((TransitionImpl) transition).getCondition();
      if (condition == null || condition.evaluate(execution)) {
        forkingTransitions.add(transition);
      }
    }

    switch (forkingTransitions.size()) {
      case 0:
        // if no outgoing transitions should be forked, end this execution
        execution.end();
        break;
      case 1:
        // if there is exactly one transition to be taken, just use the incoming execution
        execution.take(forkingTransitions.get(0));
        break;
      default:
        // if there are more transitions, perform full fork
        ExecutionImpl concurrentRoot;
        if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
          concurrentRoot = execution;
          execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
          execution.setActivity(null);
        } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
          concurrentRoot = execution.getParent();
          execution.end();
        } else {
          throw new AssertionError(execution.getState());
        }

        Map<Transition, ExecutionImpl> concurrentExecutions =
            new HashMap<Transition, ExecutionImpl>();
        for (Transition transition : forkingTransitions) {
          ExecutionImpl concurrentExecution = concurrentRoot.createExecution(transition.getName());
          concurrentExecution.setActivity(activity);
          concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
          concurrentExecutions.put(transition, concurrentExecution);
        }

        for (Entry<Transition, ExecutionImpl> entry : concurrentExecutions.entrySet()) {
          entry.getValue().take(entry.getKey());
          if (concurrentRoot.isEnded()) break;
        }
    }
  }