private String myInstanceByType(Long typeId, boolean isEnd) {
   StringBuilder subNodes = new StringBuilder();
   List<WorkflowDefinition> definitions =
       workflowDefinitionManager.getWfDefinitionsByType(getCompanyId(), typeId);
   for (WorkflowDefinition wfd : definitions) {
     if (isEnd) {
       subNodes
           .append(
               JsTreeUtils.generateJsTreeNodeDefault(
                   "END_WFD_" + wfd.getId(),
                   "",
                   wfd.getName() + "(" + getInstanceNumByDefinition(wfd, isEnd) + ")"))
           .append(",");
     } else {
       subNodes
           .append(
               JsTreeUtils.generateJsTreeNodeDefault(
                   "ING_WFD_" + wfd.getId(),
                   "",
                   wfd.getName() + "(" + getInstanceNumByDefinition(wfd, isEnd) + ")"))
           .append(",");
     }
   }
   JsTreeUtils.removeLastComma(subNodes);
   return subNodes.toString();
 }
 public String processDefs(Long typeId) {
   StringBuilder subNodes = new StringBuilder();
   List<WorkflowDefinition> definitions =
       workflowDefinitionManager.getWfDefinitionsByType(getCompanyId(), typeId);
   for (WorkflowDefinition wfd : definitions) {
     subNodes
         .append(JsTreeUtils.generateJsTreeNodeDefault("WFDID_" + wfd.getId(), "", wfd.getName()))
         .append(",");
   }
   JsTreeUtils.removeLastComma(subNodes);
   return subNodes.toString();
 }
Beispiel #3
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;
  }
 private void monitorHistoryTree(
     WorkflowType type, boolean isSuperWf, List<ZTreeNode> treeNodes, String parentId) {
   List<String> definitionCodes =
       workflowDefinitionManager.getWfDefinitionCodesByType(getCompanyId(), type.getId());
   for (String def : definitionCodes) {
     WorkflowDefinition wf =
         workflowDefinitionManager.getWorkflowDefinitionByCodeAndVersion(
             def, 1, ContextUtils.getCompanyId(), isSuperWf);
     if (wf != null) {
       ZTreeNode root =
           new ZTreeNode(
               "WFT_history_monitor_" + type.getId() + "_" + def,
               parentId,
               wf.getName(),
               "false",
               "false",
               "",
               "",
               "folder",
               "");
       treeNodes.add(root);
     }
   }
 }