示例#1
0
  @SuppressWarnings("unchecked")
  public String start() throws Exception {
    log.debug("*** start 方法开始");
    log.debug(
        new StringBuilder("*** Received parameter:[")
            .append("processId:")
            .append(processId)
            .append("]")
            .toString());

    WorkflowDefinition wdf = workflowDefinitionManager.getWorkflowDefinitionByProcessId(processId);
    String wfdName = wdf.getName();
    String url =
        Struts2Utils.getRequest()
            .getRequestURL()
            .toString()
            .replaceFirst("task!start", "task!input");
    Map<String, String> urlMap = new HashMap<String, String>();
    urlMap.put(wfdName, url);
    Integer priority = 6;
    Map<String, String[]> parameterMap = Struts2Utils.getRequest().getParameterMap();
    String[] urgency = parameterMap.get(URGENCY);
    if (urgency != null && urgency.length > 0 && StringUtils.isNotEmpty(urgency[0]))
      priority = Integer.valueOf(urgency[0]);
    String to = "";
    CompleteTaskTipType result =
        workflowInstanceManager.startAndSubmitWorkflow(processId, urlMap, priority, null);
    switch (result) {
      case OK:
        this.addSuccessMessage(result.getContent());
        to = null;
        break;
      case MESSAGE:
        this.addErrorMessage(result.getContent());
        to = null;
        break;
      case RETURN_URL:
        to = assignTransactor();
        break;
    }
    ApiFactory.getBussinessLogService().log("工作流管理", "发起流程", ContextUtils.getSystemId("wf"));
    return to;
  }