IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning - Drop deprecated class AsyncProcess.

This commit is contained in:
Heng Sin Low 2012-12-23 15:16:09 +08:00
parent 7fcd2cba58
commit 84af8c3d6a
9 changed files with 14 additions and 83 deletions

View File

@ -632,7 +632,7 @@ public class MInOut extends X_M_InOut implements DocAction
pi.setRecord_ID ( getM_InOut_ID() ); pi.setRecord_ID ( getM_InOut_ID() );
pi.setIsBatch(true); pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null); ServerProcessCtl.process(pi, null);
return pi.getPDFReport(); return pi.getPDFReport();
} }

View File

@ -1291,7 +1291,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
pi.setRecord_ID ( getC_Invoice_ID() ); pi.setRecord_ID ( getC_Invoice_ID() );
pi.setIsBatch(true); pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null); ServerProcessCtl.process(pi, null);
return pi.getPDFReport(); return pi.getPDFReport();
} }

View File

@ -628,7 +628,7 @@ public class MOrder extends X_C_Order implements DocAction
pi.setRecord_ID ( getC_Order_ID() ); pi.setRecord_ID ( getC_Order_ID() );
pi.setIsBatch(true); pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null); ServerProcessCtl.process(pi, null);
return pi.getPDFReport(); return pi.getPDFReport();
} }

View File

@ -299,7 +299,7 @@ public class MRfQResponse extends X_C_RfQResponse
pi.setRecord_ID ( getC_RfQResponse_ID() ); pi.setRecord_ID ( getC_RfQResponse_ID() );
pi.setIsBatch(true); pi.setIsBatch(true);
ServerProcessCtl.process(null, pi, null); ServerProcessCtl.process(pi, null);
return pi.getPDFReport(); return pi.getPDFReport();
} }

View File

@ -11,7 +11,6 @@ import org.compiere.model.PrintInfo;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoParameter; import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.ServerProcessCtl; import org.compiere.process.ServerProcessCtl;
import org.compiere.util.ASyncProcess;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -104,9 +103,7 @@ public class ServerReportCtl {
pi.setParameter(jasperPrintParams.toArray(new ProcessInfoParameter[]{})); pi.setParameter(jasperPrintParams.toArray(new ProcessInfoParameter[]{}));
ServerProcessCtl.process(null, // Parent set to null for synchronous processing, see bugtracker 3010932 ServerProcessCtl.process(pi, null);
pi,
null);
boolean result = true; boolean result = true;
return(result); return(result);
@ -132,13 +129,10 @@ public class ServerReportCtl {
* Called from ProcessCtl. * Called from ProcessCtl.
* - Check special reports first, if not, create standard Report * - Check special reports first, if not, create standard Report
* *
* @param parent The window which invoked the printing
* @param WindowNo The windows number which invoked the printing
* @param pi process info * @param pi process info
* @param IsDirectPrint if true, prints directly - otherwise View
* @return true if created * @return true if created
*/ */
static public boolean start (ASyncProcess parent, ProcessInfo pi) static public boolean start (ProcessInfo pi)
{ {
/** /**

View File

@ -11,7 +11,6 @@ import org.compiere.interfaces.Server;
import org.compiere.model.MPInstance; import org.compiere.model.MPInstance;
import org.compiere.model.MRule; import org.compiere.model.MRule;
import org.compiere.print.ServerReportCtl; import org.compiere.print.ServerReportCtl;
import org.compiere.util.ASyncProcess;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -24,8 +23,6 @@ public class ServerProcessCtl implements Runnable {
/** Static Logger */ /** Static Logger */
private static CLogger log = CLogger.getCLogger (ServerProcessCtl.class); private static CLogger log = CLogger.getCLogger (ServerProcessCtl.class);
/** Parent */
ASyncProcess m_parent;
/** Process Info */ /** Process Info */
ProcessInfo m_pi; ProcessInfo m_pi;
private Trx m_trx; private Trx m_trx;
@ -33,13 +30,11 @@ public class ServerProcessCtl implements Runnable {
/************************************************************************** /**************************************************************************
* Constructor * Constructor
* @param parent Container & ASyncProcess
* @param pi Process info * @param pi Process info
* @param trx Transaction * @param trx Transaction
*/ */
public ServerProcessCtl (ASyncProcess parent, ProcessInfo pi, Trx trx) public ServerProcessCtl (ProcessInfo pi, Trx trx)
{ {
m_parent = parent;
m_pi = pi; m_pi = pi;
m_trx = trx; // handled correctly m_trx = trx; // handled correctly
} // ProcessCtl } // ProcessCtl
@ -57,12 +52,11 @@ public class ServerProcessCtl implements Runnable {
* Called from APanel.cmd_print, APanel.actionButton and * Called from APanel.cmd_print, APanel.actionButton and
* VPaySelect.cmd_generate * VPaySelect.cmd_generate
* *
* @param parent ASyncProcess & Container
* @param pi ProcessInfo process info * @param pi ProcessInfo process info
* @param trx Transaction * @param trx Transaction
* @return worker started ProcessCtl instance or null for workflow * @return worker started ProcessCtl instance or null for workflow
*/ */
public static ServerProcessCtl process (ASyncProcess parent, ProcessInfo pi, Trx trx) public static ServerProcessCtl process (ProcessInfo pi, Trx trx)
{ {
log.fine("ServerProcess - " + pi); log.fine("ServerProcess - " + pi);
@ -94,17 +88,9 @@ public class ServerProcessCtl implements Runnable {
pi.setAD_PInstance_ID (instance.getAD_PInstance_ID()); pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
// execute // execute
ServerProcessCtl worker = new ServerProcessCtl(parent, pi, trx); ServerProcessCtl worker = new ServerProcessCtl(pi, trx);
if (parent != null)
{
//asynchrous
worker.start();
}
else
{
//synchrous
worker.run(); worker.run();
}
return worker; return worker;
} // execute } // execute
@ -284,7 +270,7 @@ public class ServerProcessCtl implements Runnable {
{ {
m_pi.setReportingProcess(true); m_pi.setReportingProcess(true);
// Start Report ----------------------------------------------- // Start Report -----------------------------------------------
boolean ok = ServerReportCtl.start(m_parent, m_pi); boolean ok = ServerReportCtl.start(m_pi);
m_pi.setSummary("Report", !ok); m_pi.setSummary("Report", !ok);
} }
/********************************************************************** /**********************************************************************

View File

@ -1,49 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.util;
import org.adempiere.util.IProcessUI;
import org.compiere.process.ProcessInfo;
/**
* Async Process Interface.
* <p>
* The Process implements the methods.
* The Worker is started like
* <code> MyWorker.start()</code>
* <p>
* The worker's run method basically executes
* <pre>
* process.lockUI(pi);
* process.executeAsync(pi);
* process.unlockUI(pi);
* </pre>
* The isUILocked() method is used internally (not called by worker).
*
* @author Jorg Janke
* @version $Id: ASyncProcess.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
* @deprecated
*/
public interface ASyncProcess extends IProcessUI
{
/**
* Method to be executed async.
* Called from the Worker
* @param pi ProcessInfo
*/
public void executeASync (ProcessInfo pi);
} // ASyncProcess

View File

@ -221,7 +221,7 @@ public class Scheduler extends AdempiereServer
// ============================== // ==============================
ProcessInfo jasperpi = new ProcessInfo ("", process.getAD_Process_ID()); ProcessInfo jasperpi = new ProcessInfo ("", process.getAD_Process_ID());
jasperpi.setIsBatch(true); jasperpi.setIsBatch(true);
ServerProcessCtl.process(null, jasperpi, null); ServerProcessCtl.process(jasperpi, null);
report = jasperpi.getPDFReport(); report = jasperpi.getPDFReport();
} }
else else

View File

@ -263,7 +263,7 @@ public class ReportAction implements EventListener<Event>
pi.setExport(true); pi.setExport(true);
winReport.onClose(); winReport.onClose();
ServerProcessCtl.process(null, pi, null); ServerProcessCtl.process(pi, null);
try try
{ {