示例#1
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
 public org.eevolution.model.I_WM_InOutBound getWM_InOutBound() throws RuntimeException {
   Class<?> clazz = MTable.getClass(org.eevolution.model.I_WM_InOutBound.Table_Name);
   org.eevolution.model.I_WM_InOutBound result = null;
   try {
     Constructor<?> constructor = null;
     constructor =
         clazz.getDeclaredConstructor(new Class[] {Properties.class, int.class, String.class});
     result =
         (org.eevolution.model.I_WM_InOutBound)
             constructor.newInstance(
                 new Object[] {getCtx(), new Integer(getWM_InOutBound_ID()), get_TrxName()});
   } catch (Exception e) {
     log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
     log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
     throw new RuntimeException(e);
   }
   return result;
 }
 public I_M_Warehouse getM_Warehouse() throws RuntimeException {
   Class<?> clazz = MTable.getClass(I_M_Warehouse.Table_Name);
   I_M_Warehouse result = null;
   try {
     Constructor<?> constructor = null;
     constructor =
         clazz.getDeclaredConstructor(new Class[] {Properties.class, int.class, String.class});
     result =
         (I_M_Warehouse)
             constructor.newInstance(
                 new Object[] {getCtx(), new Integer(getM_Warehouse_ID()), get_TrxName()});
   } catch (Exception e) {
     log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
     log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
     throw new RuntimeException(e);
   }
   return result;
 }