public static String getOperUser(String params, HttpServletRequest request) throws Exception {
    String[] p = params.split("\\|");
    String opertyp = p[0];
    String operidx = p[1];
    String objectno = p[2];
    String userid = p[3];

    String sql =
        "select PRKEY,DICTTBL_ID from WFTESTMST where CLIENTIP = '" + request.getRemoteAddr() + "'";
    Rowset rs = WorkFlowExecSql.wf_getRs(sql);
    String prkey = "";
    String dicttblid = "";
    if (rs.next()) {
      prkey = rs.getString(1);
      dicttblid = rs.getString(2);
    }
    sql =
        "select instance_no,model_no from wfinstrn where dicttbl_id = '"
            + dicttblid
            + "' and prkey='"
            + prkey
            + "'";
    rs = WorkFlowExecSql.wf_getRs(sql);
    String instanceno = "";
    String mdltypno = "";
    if (rs.next()) {
      instanceno = rs.getString(1);
      mdltypno = WorkFlowUnification.wf_getwftyp(rs.getString(2));
    }
    String rtn =
        WorkflowUtil.WorkFlowGetNextUserGoOn(
            instanceno, objectno, opertyp, operidx, userid, prkey, mdltypno, dicttblid);
    return rtn;
  }
  public static void Wf_createFstNodeS(String params, HttpServletRequest request) throws Exception {
    String[] p = params.split("\\;");
    String userid = p[0];
    String progid = p[1];
    String dicttblid = p[2];
    String seq = p[3];
    String mdltypno = p[4];
    String org_no = p[5];
    Database db = null;
    Rowset rs = null;
    Rowset rsin = null;
    Rowset obrs = null;
    Rowset currrs = null;
    String sql = null;
    String startobj = null;
    StringBuffer rtn = new StringBuffer();
    sql = "SELECT user_id  FROM WFSTRIGMST WHERE MDLTYP_NO='" + mdltypno + "' and USER_FLG='1'";
    try {
      rs = WorkFlowExecSql.wf_getRs(sql);
      int i = 0;
      while (rs.next()) {
        if (i < rs.getRowCount()) {
          rtn.append(rs.getString(1) + ";");
        } else {
          rtn.append(rs.getString(1));
        }
        i++;
      }
      String version = WorkFlowUtilExt.getWorkFlowCurrVerison(mdltypno);
      sql =
          "select object_no from wfobjmst t where t.model_no='"
              + version
              + "' and t.object_typ='01'";
      obrs = WorkFlowExecSql.wf_getRs(sql);
      if (obrs.next()) {
        startobj = obrs.getString(1);
      }
      sql = "select object_no from vw_wfobjrelmst where head='" + startobj + "'";

      currrs = WorkFlowExecSql.wf_getRs(sql);
      if (currrs.next()) {
        rtn = new StringBuffer(currrs.getString(1) + "|").append(rtn);
      }
      sql = "select WFAPP_ID from WFMDLTYPMST where MDLTYP_NO = " + mdltypno;
      rsin = WorkFlowExecSql.wf_getRs(sql);
      String appid = "";
      if (rs.next()) {
        appid = rsin.getString(1);
      }
      WorkflowUtil.creatFstNode(
          dicttblid, progid, appid, seq, mdltypno, userid, "0", "1", rtn.toString(), "", org_no);
    } catch (Exception se) {
      se.printStackTrace();
    } finally {
      if (db != null) {
        db.cleanup();
      }
    }
  }
  public static void Wf_createFstNode(String params, HttpServletRequest request) throws Exception {
    String[] p = params.split("\\;");
    String userid = p[0];
    String progid = p[1];
    String dicttblid = p[2];
    String seq = p[3];
    String mdltypno = p[4];
    String org_no = p[5];

    Database db = null;
    Rowset rs = null;
    String sql = null;
    try {
      sql = "select WFAPP_ID from WFMDLTYPMST where MDLTYP_NO = " + mdltypno;
      rs = WorkFlowExecSql.wf_getRs(sql);
      String appid = "";
      if (rs.next()) {
        appid = rs.getString(1);
      }
      WorkflowUtil.creatFstNode(
          dicttblid, progid, appid, seq, mdltypno, userid, "0", "2", null, "", org_no);
    } catch (Exception se) {
      se.printStackTrace();
    } finally {
      if (db != null) {
        db.cleanup();
      }
    }
  }
  public static String getProgInfo(String params, HttpServletRequest request) throws Exception {
    StringBuffer rtn = new StringBuffer("");

    String sql = "select PROGID from WFPRGMST where MDLTYP_NO=" + params + " and ISCHIEF='1'";
    Rowset rs = WorkFlowExecSql.wf_getRs(sql);
    if (rs.next()) {
      rtn.append(rs.getString(1));
    }
    sql =
        "select DICTTBL_ID,PKFLD_ID from WFDICMST where MDLTYP_NO="
            + params
            + " and DICTTBL_STA='1'";
    rs = WorkFlowExecSql.wf_getRs(sql);
    if (rs.next()) {
      rtn.append(";" + rs.getString(1) + ";" + rs.getString(2));
    }
    return rtn.toString();
  }
 public static String getWorkFlowList(String params, HttpServletRequest request) throws Exception {
   String sql = "select MDLTYP_NO,MDLTYP_SHT from WFMDLTYPMST";
   Rowset rs = WorkFlowExecSql.wf_getRs(sql);
   StringBuffer rtn = new StringBuffer("");
   while (rs.next()) {
     rtn.append(rs.getString(1) + ";" + rs.getString(2) + "|");
   }
   return rtn.toString();
 }
  public String createWfButton(String params, HttpServletRequest request) throws LiemsException {
    String returnValue = "";
    String operstatus = "W";
    String startup = "N";
    try {
      Document wfOperInfoOutput = null;
      String[] p = params.split("\\;");
      String userid = p[0];
      String instNo = "";
      String nodeId = "";
      String workflowId = "";
      String objNo = "";
      String nodeName = "";
      String actObjNo = "";
      String instSta = "";
      String parentinstNo = "";
      String isactive = "";
      String isaccept = "";
      String programno = p[1];
      String stacd = "";
      String isExec = "";
      String pkval = p[5];
      String dicttblid = p[2];
      String instanceno = "";
      String appId = "";
      String modelId = "";
      String OrgNo = "";

      String sql =
          "select MODEL_NO,APP_ID,INSTANCE_NO from wfinstrn where dicttbl_id = '"
              + dicttblid
              + "' and prkey='"
              + pkval
              + "'";
      Rowset trs = WorkFlowExecSql.wf_getRs(sql);
      if (trs.next()) {
        modelId = trs.getString(1);
        appId = trs.getString(2);
        instanceno = trs.getString(3);
      }
      if (pkval != null) {
        wfOperInfoOutput = new ejbflowBean().wf_getnodeinfo(dicttblid, pkval, userid, programno);
      }
      if (wfOperInfoOutput != null) {
        Element commRoot = wfOperInfoOutput.getRootElement();

        instNo = commRoot.getChildText("InstNo");
        nodeId = commRoot.getChildText("ObjID");
        workflowId = commRoot.getChildText("WfID");
        objNo = commRoot.getChildText("ObjNo");
        nodeName = commRoot.getChildText("ObjNam");
        actObjNo = commRoot.getChildText("ActObjNo");
        instSta = commRoot.getChildText("inSta");
        parentinstNo = commRoot.getChildText("parentinstno");
        isactive = commRoot.getChildText("isactive");
        isaccept = commRoot.getChildText("isaccept");
        programno = commRoot.getChildText("programno");
        stacd = commRoot.getChildText("stacd");
        isExec = commRoot.getChildText("isexec");
        OrgNo = commRoot.getChildText("OrgNo");

        returnValue =
            instNo
                + "|"
                + nodeId
                + "|"
                + workflowId
                + "|"
                + objNo
                + "|"
                + nodeName
                + "|"
                + actObjNo
                + "|"
                + instSta
                + "|"
                + parentinstNo
                + "|"
                + isactive
                + "|"
                + isaccept
                + "|"
                + programno
                + "|"
                + stacd
                + "|"
                + isExec;
        returnValue = returnValue + "|" + pkval + "|" + dicttblid;
        returnValue =
            returnValue + "|" + instanceno + "|" + appId + "|" + modelId + "|" + OrgNo + "|";

        Iterator it = commRoot.getChildren("UserOper").iterator();
        if (it.hasNext()) {
          operstatus = "Y";
        } else {
          operstatus = "W";
        }
        request.setAttribute("hastask", operstatus);
        String OperID = "";
        String OperNam = "";
        String OperSht = "";
        String OperTyp = "";
        String Operidx = "";
        String Hascomm = "";
        String jsqsta = "";
        String jsqname = "";
        String jshsta = "";
        String jshname = "";
        returnValue = returnValue + "*";
        while (it.hasNext()) {
          Element e = (Element) it.next();

          OperID = e.getChildText("OperID");
          OperNam = e.getChildText("OperNam");
          OperSht = e.getChildText("OperSht");
          OperTyp = e.getChildText("OperTyp");
          Operidx = e.getChildText("Operidx");
          Hascomm = e.getChildText("Hascomm");
          jsqsta = e.getChildText("jsqsta");
          jsqname = e.getChildText("jsqname");
          jshsta = e.getChildText("jshsta");
          jshname = e.getChildText("jshname");

          returnValue =
              returnValue
                  + OperID
                  + "|"
                  + OperNam
                  + "|"
                  + OperSht
                  + "|"
                  + OperTyp
                  + "|"
                  + Operidx
                  + "|"
                  + Hascomm
                  + "|"
                  + jsqsta
                  + "|"
                  + jsqname
                  + "|"
                  + jshsta
                  + "|"
                  + jshname
                  + "|";
          returnValue = returnValue + "@";
        }
        if (startup.equalsIgnoreCase("Y")) {
          returnValue = returnValue + "|10";
        }
      }
    } catch (Exception e) {
      Log.error(e);
    }
    return returnValue;
  }