⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 workflow_stepmain.java

📁 用java实现的工作流
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      db_conn.stmt.executeUpdate
          ("update flow_manager set flow_status = 0  where  graph_id = '" +
           graphid +
           "' ");
      status = true;
    }
    catch (Exception e) {
      System.out.println(e);
    }
    return status;
  }

  public void restart_flow(String graphid) {}

/////////////////////////////////////////////////////////////////////////////////
//将该点活动状态设置为0

  public void reset_active_step(String step_id, String graph_id) {
    try {

      db_conn.stmt.executeUpdate
          ("update step_main set is_active = 0 where  graph_id = '" + graph_id +
           "' and step_id = '" + step_id + "' ");
    }

    catch (Exception e) {
      System.out.println(e);

    }

  }

//将该点状态设置为活动1
  public void set_active_step(String step_id, String graph_id) {
    try {

      db_conn.stmt.executeUpdate
          ("update step_main set is_active = 1  where  graph_id = '" + graph_id +
           "' and step_id = '" + step_id + "' ");
    }

    catch (Exception e) {
      System.out.println(e);

    }

  }

/////////////////////////////////////////////////////////////////////////////////
  public boolean active_step(String step_id, String graph_id) { //返回该点状态值
    boolean active_step = false;
    int active_re = 0;
    try {

      db_conn.rs = db_conn.stmt.executeQuery
          (
          "select count(*) from step_main where is_active = 1 and graph_id = '" +
          graph_id + "' and step_id = '" + step_id + "' ");

      if (db_conn.rs.next()) {
        active_re = db_conn.rs.getInt(1);

      }
      if (active_re == 1) {
        active_step = true;
      }
    }
    catch (Exception e) {
    }

    return active_step;
  }

  public String return_FristStep(String graph_id) { //返回该图第一个节点
    String step_id = "";

    try {
      db_conn.rs2 = db_conn.stmt2.executeQuery
          (
          "select step_id from step_main where step_name = '工作开始' and graph_id = '" +
          graph_id + "' ");
      if (db_conn.rs2.next()) {
        step_id = db_conn.rs2.getString("step_id");
      }

      db_conn.stmt2.close();
      db_conn.rs2.close();

    }
    catch (Exception e) {
      System.out.println("返回第一个节点错");
    }

    return step_id;
  }

  public String return_FirstStepName(String graph_id) { //返回第一个点的名称
    String step_name = "";

    return step_name;
  }

  public String return_LastStep(String graph_id) { //返回该图最后一个节点
    String step_id = "";
    try {
      db_conn.rs = db_conn.stmt.executeQuery
          (
          "select step_id from step_main where step_name = '工作结束' and graph_id = '" +
          graph_id + "'");
      if (db_conn.rs.next()) {
        step_id = db_conn.rs.getString("step_id");
        //    db_conn.stmt.close();
        //    db_conn.rs.close();
      }
    }
    catch (Exception e) {
      System.out.println(e);
    }

    return step_id;
  }

  public String return_nextStep(String step_id, String graph_id) { //返回该点的下一个节点ID
    String Step_id_next = "";

    try {

      db_conn.rs = db_conn.stmt.executeQuery
          ("select to_step from edge_control where from_step = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      if (db_conn.rs.next()) {
        Step_id_next = db_conn.rs.getString("to_step");
        //   System.out.println(Step_id_next);
        //  db_conn.stmt.close();
        //  db_conn.rs.close();

      }
    }

    catch (Exception e) {

      System.out.println("next");

    }

    return Step_id_next;
  }

  public String return_preStep(String step_id, String graph_id) { //返回该点的上一个节点ID
    String Step_id_pre = "";

    try {

      db_conn.rs = db_conn.stmt.executeQuery
          ("select from_step from edge_control where to_step = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      if (db_conn.rs.next()) {
        Step_id_pre = db_conn.rs.getString("step_id");
        db_conn.stmt.close();
        db_conn.rs.close();

      }
    }

    catch (Exception e) {
      System.out.println("返回上一个节点错");
    }

    return Step_id_pre;
  }

  public java.util.ArrayList return_nextSteps(String graph_id, String step_id) {
    //返回该点的下N个节点ID
    java.util.ArrayList al = new java.util.ArrayList();

    try {

      db_conn.rs = db_conn.stmt.executeQuery
          ("select to_step from edge_control where from_step = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      while (db_conn.rs.next()) {
        al.add( (String) db_conn.rs.getString("to_step"));
      }
    }

    catch (Exception e) {
      System.out.println(e);
    }

    return al;
  }

  public java.util.ArrayList return_preSteps(String graph_id, String step_id) {
    //返回该点的上N个节点ID
    java.util.ArrayList all = new java.util.ArrayList();

    int i = 0;
    try {

      db_conn.rs = db_conn.stmt.executeQuery
          ("select from_step from edge_control where to_step = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      while (db_conn.rs.next()) {
        all.add( (String) db_conn.rs.getString("from_step"));

      }
      //   db_conn.stmt.close();
      //   db_conn.rs.close();

    }

    catch (Exception e) {
      System.out.println("返回上N个节点错");
    }

    return all;
  }

  public String Result_Return_NextStep(String Step_id, String graph_id,
                                       int status) { //根据条件返回该点的下一个节点ID
    String Step_id_nextbystatus = "";
    return Step_id_nextbystatus;
  }

// 根据STEPID获得STEP的名称
  public String get_stepname(String stepid, String graphid) {
    String name = "";
    try {
      db_conn.rs = db_conn.stmt.executeQuery
          ("select step_name from step_main where graph_id = '" + graphid +
           "' and step_id = '" + stepid + "' ");
      if (db_conn.rs.next()) {
        name = db_conn.rs.getString("step_name");
      }

    }

    catch (Exception e) {
      System.out.println(e);
    }

    return name;
  }

  public String get_stepid(String stepname, String graphid) {
    String name = "";
    try {
      db_conn.rs = db_conn.stmt.executeQuery
          ("select step_id from step_main where graph_id = '" + graphid +
           "' and step_name = '" + stepname + "' ");
      if (db_conn.rs.next()) {
        name = db_conn.rs.getString("step_id");
      }
      db_conn.rs.close();
      //   db_conn.stmt.close();
    }

    catch (Exception e) {
      System.out.println(e);
    }

    return name;
  }

  public String is_step_active(String graph_id) {
    //获得该点其他状态............
    //  boolean status = false;
    String id = "";
    try {

      db_conn.rs = db_conn.stmt.executeQuery
          ("select step_id from step_main where graph_id = '" + graph_id +
           "' and is_active = 1 ");
      if (db_conn.rs.next()) {
        id = db_conn.rs.getString("step_id");

      }
      //   db_conn.stmt.close();
      //    db_conn.rs.close();
    }
    catch (Exception e) {
      System.out.println(e);
    }
    return id;
  }

  public void Set_Active(String Step_id, String graph_id) { //将该点设置为活动

  }

  public void Set_Actioned(String Step_id, String graph_id) { //将该点设置为已经处理

  }

  public void Reset_visited(String graph_id) { //将该图访问状态恢复为初始状态
    try {

      db_conn.stmt.executeUpdate
          ("update step_main set visited =0 where  graph_id = '" + graph_id +
           "' ");

    }

    catch (Exception e) {

      System.out.println(e);

    }

  }

  public void Reset_lastStep(int Step, String graph_id) { //将该点状态恢复到上一次的状态
  }

  public void set_visited_time(String step_id, String graph_id, int j) { //将该点访问状态设置为1

    try {

      db_conn.stmt.executeUpdate
          ("update step_main set visited ='" + j + "' where step_id = '" +
           step_id +
           "' and graph_id = '" + graph_id + "' ");

    }

    catch (Exception e) {

      System.out.println(e);

    }

  }

  public void set_visited(String step_id, String graph_id) { //将该点访问状态设置为1

    try {

      db_conn.stmt.executeUpdate
          ("update step_main set visited = '1' where step_id = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");

    }

    catch (Exception e) {

      System.out.println(e);

    }

  }

  public void Reset_visited(String Step, String graph_id) { //将该点访问状态设置为0
  }

  public boolean get_visited(String step_id, String graph_id) { // 返回该点访问状态
    boolean vi = false;
    String vis = "";
    try {
      db_conn.rs = db_conn.stmt.executeQuery
          ("select visited from step_main where step_id = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      if (db_conn.rs.next()) {
        vis = db_conn.rs.getString("visited");
        if (vis.equals("1")) {
          vi = true;
          //   System.out.println("visited");
        }
        else {
          vi = false;
          //   System.out.println("not visited");
        }
        //  db_conn.stmt.close();
        //  db_conn.rs.close();

      }

    }

    catch (Exception e) {

      System.out.println(e);

    }

    return vi;
  }

  public int get_visited_times(String step_id, String graph_id) { // 返回该点被访问次数
    int vi = 0;

    try {
      db_conn.rs = db_conn.stmt.executeQuery
          ("select visited from step_main where step_id = '" + step_id +
           "' and graph_id = '" + graph_id + "' ");
      if (db_conn.rs.next()) {
        vi = db_conn.rs.getInt("visited");

      }

    }

    catch (Exception e) {

      System.out.println(e);

    }

    return vi;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -