package zr.zrpower.flowengine.web.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import zr.zrpower.web.bean.MessageBox;
import zr.zrpower.flowengine.service.FlowControl;

/**
* <p>Title:流程设计</p>
*/
public class FlowDesign
    extends MessageBox {
  //Initialize global variables
  public void init() throws ServletException {
  }
  //Process the HTTP Get request
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws
      ServletException, IOException {
      request.setCharacterEncoding("GBK");
      response.setContentType("text/html; charset=GBK");

      //得到流程的基础属性
      String str_FlowCss = request.getParameter("tmp_save");
      String strObjectFile = request.getParameter("ObjectFile");
      String strWorkflow_No = request.getParameter("Workflow_No");

      this.isOk = true;
      this.Msg = "非法调用，操作不被接受，你的操作已被记录！";

      try {
      FlowControl Control = new FlowControl();
            //保存流程配置
            Control.SaveFlowConfig(strWorkflow_No,str_FlowCss);

            Control = null;
            response.sendRedirect(strObjectFile);
      }
      catch (Exception ex){
      this.Msg = "连接中间件服务器失败，请稍后再试！";
      }

  }

  //Process the HTTP Post request
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws
      ServletException, IOException {
    doGet(request, response);
  }

  //Clean up resources
  public void destroy() {
  }
}
