Exemple #1
0
  /**
   * Process the HTTP Get request - Initial Call. <br>
   * http://localhost/adempiere/WWorkflow?AD_Menu_ID=123 <br>
   * Find the AD_Workflow_ID Load workflow and initial session atribute Create output
   *
   * @param request
   * @param response
   * @throws ServletException
   * @throws IOException
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // Log.trace(Log.l1_User, "WWorkflow.doGet");
    // WUtil.debug(new String("In do get"),"");

    //  Get Session attributes
    HttpSession sess = request.getSession();
    MobileSessionCtx wsc = MobileSessionCtx.get(request);
    ctx = wsc.ctx;
    // String loginInfo = (String)sess.getAttribute(WebEnv.SA_LOGININFO);
    if (ctx == null) {
      MobileUtil.createTimeoutPage(request, response, this, null);
      return;
    }

    //  Get Parameter: Menu_ID
    int AD_Menu_ID = MobileUtil.getParameterAsInt(request, "AD_Menu_ID");

    //  Get Parameter: Menu_ID
    int AD_Window_ID = MobileUtil.getParameterAsInt(request, "AD_Window_ID");

    // set language
    AD_Language = Env.getAD_Language(ctx);

    // load AD_Workflow_ID
    int AD_Workflow_ID = getAD_Workflow_ID(AD_Menu_ID);

    // load workflow
    loadWorkflow(ctx, AD_Workflow_ID, sess);

    // get session attributes
    MWorkflow wf = (MWorkflow) sess.getAttribute(WORKFLOW);
    MWFNode[] nodes = (MWFNode[]) sess.getAttribute(NODES);
    ArrayList nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
    int[][] imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
    int activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();

    // create output
    MobileDoc doc = preparePage("loginInfo");
    doc = createLayout(doc, wf, activeNode, nodes, nodes_ID, imageMap);
    MobileUtil.createResponse(request, response, this, null, doc, false);
  } //  doGet
Exemple #2
0
  /**
   * Process the HTTP Post request - Initial Call.
   *
   * <p>Execute the received command Update session attributes Create output
   *
   * @param request
   * @param response
   * @throws ServletException
   * @throws IOException
   */
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // WUtil.debug(new String("In do Post"),"");
    HttpSession sess = request.getSession();

    MobileSessionCtx wsc = MobileSessionCtx.get(request);
    Properties ctx = wsc.ctx;
    if (ctx == null) {
      MobileUtil.createTimeoutPage(request, response, this, null);

      return;
    }
    // String loginInfo = (String)sess.getAttribute(WEnv.SA_LOGININFO);

    // get session attributes
    MWorkflow wf = (MWorkflow) sess.getAttribute(WORKFLOW);
    MWFNode[] nodes = (MWFNode[]) sess.getAttribute(NODES);
    ArrayList nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
    int[][] imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
    int activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();

    // execute commnad
    String m_command = request.getParameter(M_Command);
    int j_command = MobileUtil.getParameterAsInt(request, J_Command);
    // WUtil.debug(m_command,"m_command");
    // WUtil.debug(""+j_command,"j_command");

    executeCommand(m_command, j_command, wf, activeNode, nodes, nodes_ID, sess);

    // get updated session attributes
    wf = (MWorkflow) sess.getAttribute(WORKFLOW);
    nodes = (MWFNode[]) sess.getAttribute(NODES);
    nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
    imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
    activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();

    // create layout
    MobileDoc doc = preparePage("loginInfo");
    doc = createLayout(doc, wf, activeNode, nodes, nodes_ID, imageMap);
    MobileUtil.createResponse(request, response, this, null, doc, false);
  } //  doPost