예제 #1
0
 /**
  * ************************************************************************ Start Database Process
  *
  * @param ProcedureName PL/SQL procedure name
  * @return true if success
  */
 private boolean startDBProcess(String ProcedureName) {
   //  execute on this thread/connection
   log.fine(ProcedureName + "(" + m_pi.getAD_PInstance_ID() + ")");
   String sql = "{call " + ProcedureName + "(?)}";
   try {
     CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, null); // 	ro??
     cstmt.setInt(1, m_pi.getAD_PInstance_ID());
     cstmt.executeUpdate();
     cstmt.close();
   } catch (Exception e) {
     log.log(Level.SEVERE, sql, e);
     m_pi.setSummary(Msg.getMsg(m_wscctx, "ProcessRunError") + " " + e.getLocalizedMessage());
     m_pi.setError(true);
     return false;
   }
   //	log.fine(Log.l4_Data, "ProcessCtl.startProcess - done");
   return true;
 } //  startDBProcess
예제 #2
0
  /**
   * Async Process - Do it all. <code>
   * - Get Instance ID
   * - Get Parameters
   * - execute (lock - start process - unlock)
   *  </code> Creates a ProcessCtl instance, which calls lockUI and unlockUI if parent is a
   * ASyncProcess <br>
   * Called from ProcessCtl.startProcess, ProcessDialog.actionPerformed, APanel.cmd_print,
   * APanel.actionButton, VPaySelect.cmd_generate
   *
   * @param parent ASyncProcess & Container
   * @param WindowNo window no
   * @param pi ProcessInfo process info
   * @param trx Transaction
   * @return worker started ProcessCtl instance or null for workflow
   */
  public static WProcessCtl process(
      Object parent, int WindowNo, ProcessInfo pi, Trx trx, HttpServletRequest request) {
    log.fine("WindowNo=" + WindowNo + " - " + pi);
    WebSessionCtx wsc = WebSessionCtx.get(request);
    MPInstance instance = new MPInstance(wsc.ctx, pi.getAD_Process_ID(), pi.getRecord_ID());

    if (!instance.save()) {
      pi.setSummary(Msg.getMsg(wsc.ctx, "ProcessNoInstance"));
      pi.setError(true);
      return null;
    }
    pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());

    //	Get Parameters (Dialog)
    /**
     * ProcessParameter para = new ProcessParameter (Env.getFrame((Container)parent), WindowNo, pi);
     * if (para.initDialog()) { para.setVisible(true); if (!para.isOK()) { pi.setSummary
     * (Msg.getMsg(Env.getCtx(), "ProcessCancelled")); pi.setError (true); return null; } }
     */
    //	execute
    WProcessCtl worker = new WProcessCtl(parent, pi, trx, wsc.ctx);
    worker.start(); // 	MUST be start!
    return worker;
  } //	execute