Search in sources :

Example 1 with ASyncProcess

use of org.compiere.util.ASyncProcess in project adempiere by adempiere.

the class ProcessBuilder method processCtl.

/**
     * Create instancel for process control
     * @param className
     * @param parent
     * @param windowNo
     * @param processInfo
     * @param trx
     * @return
     * @throws RuntimeException
     */
private Runnable processCtl(String className, ASyncProcess parent, int windowNo, ProcessInfo processInfo, Trx trx) throws RuntimeException {
    Class<?> clazz;
    Runnable result = null;
    try {
        clazz = Class.forName(className);
        Constructor<?> constructor = null;
        if (windowNo == 0) {
            constructor = clazz.getDeclaredConstructor(ASyncProcess.class, ProcessInfo.class, Trx.class);
            result = (Runnable) constructor.newInstance(parent, processInfo, trx);
        } else {
            constructor = clazz.getDeclaredConstructor(ASyncProcess.class, Integer.class, ProcessInfo.class, Trx.class);
            result = (Runnable) constructor.newInstance(parent, windowNo, processInfo, trx);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return result;
}
Also used : TrxRunnable(org.compiere.util.TrxRunnable) ASyncProcess(org.compiere.util.ASyncProcess) ProcessInfo(org.compiere.process.ProcessInfo) Trx(org.compiere.util.Trx) AdempiereException(org.adempiere.exceptions.AdempiereException)

Aggregations

AdempiereException (org.adempiere.exceptions.AdempiereException)1 ProcessInfo (org.compiere.process.ProcessInfo)1 ASyncProcess (org.compiere.util.ASyncProcess)1 Trx (org.compiere.util.Trx)1 TrxRunnable (org.compiere.util.TrxRunnable)1