Beispiel #1
0
 /**
  * ************************************************************************ Start Workflow.
  *
  * @param AD_Workflow_ID workflow
  * @return true if started
  */
 private boolean startWorkflow(int AD_Workflow_ID) {
   log.fine(AD_Workflow_ID + " - " + m_pi);
   boolean started = false;
   if (DB.isRemoteProcess()) {
     log.info("trying to running on the server");
     Server server = CConnection.get().getServer();
     try {
       if (server != null) { // 	See ServerBean
         log.info("running on the server");
         m_pi = server.workflow(m_wscctx, m_pi, AD_Workflow_ID);
         log.finest("server => " + m_pi);
         started = true;
       }
     } catch (Exception ex) {
       log.log(Level.SEVERE, "AppsServer error", ex);
       started = false;
     }
   }
   //	Run locally
   if (!started && !m_IsServerProcess) {
     log.info("running locally");
     MWorkflow wf = MWorkflow.get(m_wscctx, AD_Workflow_ID);
     MWFProcess wfProcess = null;
     if (m_pi.isBatch()) wfProcess = wf.start(m_pi); // 	may return null
     else wfProcess = wf.startWait(m_pi); // 	may return null
     started = wfProcess != null;
   }
   return started;
 } //  startWorkflow
Beispiel #2
0
 /**
  * ************************************************************************ Start Java Process
  * Class. instanciate the class implementing the interface ProcessCall. The class can be a
  * Server/Client class (when in Package org compiere.process or org.compiere.model) or a client
  * only class (e.g. in org.compiere.report)
  *
  * @return true if success
  */
 private boolean startProcess() {
   log.fine(m_pi.toString());
   boolean started = false;
   if (DB.isRemoteProcess()) {
     Server server = CConnection.get().getServer();
     try {
       if (server != null) { // 	See ServerBean
         m_pi = server.process(m_wscctx, m_pi);
         log.finest("server => " + m_pi);
         started = true;
       }
     } catch (UndeclaredThrowableException ex) {
       Throwable cause = ex.getCause();
       if (cause != null) {
         if (cause instanceof InvalidClassException)
           log.log(
               Level.SEVERE, "Version Server <> Client: " + cause.toString() + " - " + m_pi, ex);
         else
           log.log(Level.SEVERE, "AppsServer error(1b): " + cause.toString() + " - " + m_pi, ex);
       } else log.log(Level.SEVERE, " AppsServer error(1) - " + m_pi, ex);
       started = false;
     } catch (Exception ex) {
       Throwable cause = ex.getCause();
       if (cause == null) cause = ex;
       log.log(Level.SEVERE, "AppsServer error - " + m_pi, cause);
       started = false;
     }
   }
   //	Run locally
   if (!started && !m_IsServerProcess) {
     ProcessCall myObject = null;
     try {
       Class myClass = Class.forName(m_pi.getClassName());
       myObject = (ProcessCall) myClass.newInstance();
       if (myObject == null) m_pi.setSummary("No Instance for " + m_pi.getClassName(), true);
       else myObject.startProcess(m_wscctx, m_pi, m_trx);
       if (m_trx != null) {
         m_trx.commit();
         m_trx.close();
       }
     } catch (Exception e) {
       if (m_trx != null) {
         m_trx.rollback();
         m_trx.close();
       }
       m_pi.setSummary("Error starting Class " + m_pi.getClassName(), true);
       log.log(Level.SEVERE, m_pi.getClassName(), e);
     }
   }
   return !m_pi.isError();
 } //  startProcess