IDEMPIERE-959 Missing get*_UU methods / based on patch from Nicolas Micoud (nmicoud)

This commit is contained in:
Carlos Ruiz 2018-05-29 13:53:22 +02:00
parent cd298bf31f
commit a0dcf36f4e
12 changed files with 81 additions and 23 deletions

View File

@ -111,7 +111,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = -2946624717834888117L; private static final long serialVersionUID = -3115353522698098211L;
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
@ -3301,6 +3301,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return isOpen() && getCurrentRow() >= 0 && getCurrentRow() == m_mTable.getNewRow(); return isOpen() && getCurrentRow() >= 0 && getCurrentRow() == m_mTable.getNewRow();
} }
public String getAD_Tab_UU() {
return m_vo.AD_Tab_UU;
}
public String getAD_Process_UU()
{
return m_vo.AD_Process_UU;
}
public boolean isUpdateWindowContext() public boolean isUpdateWindowContext()
{ {
return m_updateWindowContext ; return m_updateWindowContext ;

View File

@ -41,7 +41,7 @@ public class GridTabVO implements Evaluatee, Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = -7973388282943436222L; private static final long serialVersionUID = -1353087123788176368L;
/************************************************************************** /**************************************************************************
* Create MTab VO * Create MTab VO
@ -458,7 +458,9 @@ public class GridTabVO implements Evaluatee, Serializable
public boolean IsHighVolume = false; public boolean IsHighVolume = false;
/** Process */ /** Process */
public int AD_Process_ID = 0; public int AD_Process_ID = 0;
/** Commot Warning */ /** Process UUID */
public String AD_Process_UU;
/** Commit Warning */
public String CommitWarning; public String CommitWarning;
/** Where */ /** Where */
public String WhereClause; public String WhereClause;

View File

@ -26,6 +26,7 @@ import org.compiere.process.ProcessInfo;
import org.compiere.util.CCache; import org.compiere.util.CCache;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Trx; import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.compiere.wf.MWFNode; import org.compiere.wf.MWFNode;
/** /**
@ -43,8 +44,7 @@ public class MProcess extends X_AD_Process
/** /**
* *
*/ */
private static final long serialVersionUID = 6665942554198058466L; private static final long serialVersionUID = -7234986583327689692L;
/** /**
* Get MProcess from Cache * Get MProcess from Cache
@ -64,6 +64,24 @@ public class MProcess extends X_AD_Process
return retValue; return retValue;
} // get } // get
/**
* Get MProcess from Cache based on UUID
* @param ctx context
* @param AD_Process_UU UUID
* @return MProcess
*/
public static MProcess get (Properties ctx, String AD_Process_UU)
{
MProcess retValue = s_cacheUU.get(AD_Process_UU);
if (retValue != null)
return retValue;
int id = DB.getSQLValueEx(null, "SELECT AD_Process_ID FROM AD_Process WHERE AD_Process_UU = ? ", AD_Process_UU);
retValue = new MProcess (ctx, id, null);
if (!Util.isEmpty(retValue.getAD_Process_UU()))
s_cacheUU.put (retValue.getAD_Process_UU(), retValue);
return retValue;
} // get
/** /**
* Get MProcess from Menu * Get MProcess from Menu
* @param ctx context * @param ctx context
@ -85,8 +103,10 @@ public class MProcess extends X_AD_Process
} // getFromMenu } // getFromMenu
/** Cache */ /** Cache ID */
private static CCache<Integer,MProcess> s_cache = new CCache<Integer,MProcess>(Table_Name, 20); private static CCache<Integer,MProcess> s_cache = new CCache<Integer,MProcess>(Table_Name, 20);
/** Cache UUID */
private static CCache<String,MProcess> s_cacheUU = new CCache<String,MProcess>(Table_Name, 20);
/************************************************************************** /**************************************************************************

View File

@ -40,11 +40,10 @@ import org.compiere.util.Util;
*/ */
public class ProcessInfo implements Serializable public class ProcessInfo implements Serializable
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -7810177110347837681L; private static final long serialVersionUID = 2167823616151648814L;
/** /**
* Constructor * Constructor
@ -65,6 +64,9 @@ public class ProcessInfo implements Serializable
m_printPreview = false; m_printPreview = false;
} // ProcessInfo } // ProcessInfo
/** Process UUID */
private String m_AD_Process_UU;
/** /**
* Constructor * Constructor
* @param Title Title * @param Title Title
@ -694,6 +696,15 @@ public class ProcessInfo implements Serializable
return m_transactionName; return m_transactionName;
} }
public String getAD_Process_UU()
{
return m_AD_Process_UU;
}
public void setAD_Process_UU(String AD_Process_UU)
{
m_AD_Process_UU = AD_Process_UU;
}
/** /**
* Set transaction name from this process * Set transaction name from this process
* @param trxName * @param trxName

View File

@ -139,8 +139,8 @@ public class ServerProcessCtl implements Runnable {
// //
String sql = "SELECT p.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4 String sql = "SELECT p.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport,p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8 + " p.isReport,p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
+ " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ " p.IsServerProcess, p.JasperReport " + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p" + "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) " + " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ "WHERE p.IsActive='Y'" + "WHERE p.IsActive='Y'"
@ -148,8 +148,8 @@ public class ServerProcessCtl implements Runnable {
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process"))
sql = "SELECT t.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4 sql = "SELECT t.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport, p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8 + " p.isReport, p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
+ " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ " p.IsServerProcess, p.JasperReport " + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p" + "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) " + " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ " INNER JOIN AD_Process_Trl t ON (p.AD_Process_ID=t.AD_Process_ID" + " INNER JOIN AD_Process_Trl t ON (p.AD_Process_ID=t.AD_Process_ID"
@ -171,6 +171,7 @@ public class ServerProcessCtl implements Runnable {
ProcedureName = rs.getString(2); ProcedureName = rs.getString(2);
m_pi.setClassName (rs.getString(3)); m_pi.setClassName (rs.getString(3));
m_pi.setAD_Process_ID (rs.getInt(4)); m_pi.setAD_Process_ID (rs.getInt(4));
m_pi.setAD_Process_UU (rs.getString(12));
// Report // Report
if ("Y".equals(rs.getString(5))) if ("Y".equals(rs.getString(5)))
{ {

View File

@ -76,6 +76,7 @@ public class FinReportJasper extends FinReport
poInfo.setRecord_ID(getRecord_ID()); poInfo.setRecord_ID(getRecord_ID());
poInfo.setAD_Process_ID(proc.getAD_Process_ID()); poInfo.setAD_Process_ID(proc.getAD_Process_ID());
poInfo.setAD_PInstance_ID(instance.getAD_PInstance_ID()); poInfo.setAD_PInstance_ID(instance.getAD_PInstance_ID());
poInfo.setAD_Process_UU(proc.getAD_Process_UU());
// need to commit in order to allow jasper to view the data // need to commit in order to allow jasper to view the data
Trx trx = Trx.get(get_TrxName(), true); Trx trx = Trx.get(get_TrxName(), true);

View File

@ -170,6 +170,7 @@ public class Scheduler extends AdempiereServer
pi.setAD_User_ID(getAD_User_ID()); pi.setAD_User_ID(getAD_User_ID());
pi.setAD_Client_ID(get(getCtx(), AD_Scheduler_ID).getAD_Client_ID()); pi.setAD_Client_ID(get(getCtx(), AD_Scheduler_ID).getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID()); pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
pi.setAD_Process_UU(process.getAD_Process_UU());
pi.setIsBatch(true); pi.setIsBatch(true);
pi.setPrintPreview(true); pi.setPrintPreview(true);
MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null); MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null);

View File

@ -2439,6 +2439,7 @@ public final class APanel extends CPanel
pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
pi.setPrintPreview(printPreview); pi.setPrintPreview(printPreview);
pi.setAD_Process_UU(m_curTab.getAD_Process_UU());
ClientProcessCtrl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI ClientProcessCtrl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
statusBar.setStatusLine(pi.getSummary(), pi.isError()); statusBar.setStatusLine(pi.getSummary(), pi.isError());
@ -2872,6 +2873,7 @@ public final class APanel extends CPanel
ProcessInfo pi = new ProcessInfo (title, processID, table_ID, record_ID); ProcessInfo pi = new ProcessInfo (title, processID, table_ID, record_ID);
pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
pi.setAD_Process_UU(pr.getAD_Process_UU());
ff.setProcessInfo(pi); ff.setProcessInfo(pi);
ff.openForm(form_ID, m_curTab); ff.openForm(form_ID, m_curTab);
ff.pack(); ff.pack();

View File

@ -111,6 +111,7 @@ public class ProcessModalDialog extends CDialog
private StringBuffer m_messageText = new StringBuffer(); private StringBuffer m_messageText = new StringBuffer();
private String m_ShowHelp = null; // Determine if a Help Process Window is shown private String m_ShowHelp = null; // Determine if a Help Process Window is shown
private boolean m_valid = true; private boolean m_valid = true;
private String m_AD_Process_UU;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(ProcessDialog.class); private static CLogger log = CLogger.getCLogger(ProcessDialog.class);
@ -247,11 +248,11 @@ public class ProcessModalDialog extends CDialog
log.config(""); log.config("");
// //
boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process"); boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process");
String sql = "SELECT Name, Description, Help, IsReport, ShowHelp " String sql = "SELECT Name, Description, Help, IsReport, ShowHelp, AD_Process_UU "
+ "FROM AD_Process " + "FROM AD_Process "
+ "WHERE AD_Process_ID=?"; + "WHERE AD_Process_ID=?";
if (trl) if (trl)
sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp " sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp, AD_Process_UU "
+ "FROM AD_Process p, AD_Process_Trl t " + "FROM AD_Process p, AD_Process_Trl t "
+ "WHERE p.AD_Process_ID=t.AD_Process_ID" + "WHERE p.AD_Process_ID=t.AD_Process_ID"
+ " AND p.AD_Process_ID=? AND t.AD_Language=?"; + " AND p.AD_Process_ID=? AND t.AD_Language=?";
@ -280,6 +281,8 @@ public class ProcessModalDialog extends CDialog
s = rs.getString(3); // Help s = rs.getString(3); // Help
if (!rs.wasNull()) if (!rs.wasNull())
m_messageText.append("<p>").append(s).append("</p>"); m_messageText.append("<p>").append(s).append("</p>");
m_AD_Process_UU = rs.getString(6);
} }
} }
catch (SQLException e) catch (SQLException e)
@ -301,6 +304,7 @@ public class ProcessModalDialog extends CDialog
// Move from APanel.actionButton // Move from APanel.actionButton
m_pi = new ProcessInfo(m_Name, m_AD_Process_ID, m_tableId, m_recordId); m_pi = new ProcessInfo(m_Name, m_AD_Process_ID, m_tableId, m_recordId);
m_pi.setAD_Process_UU(m_AD_Process_UU);
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi); parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);

View File

@ -49,6 +49,8 @@ import org.compiere.grid.ed.VComboBox;
import org.compiere.grid.ed.VDate; import org.compiere.grid.ed.VDate;
import org.compiere.minigrid.MiniTable; import org.compiere.minigrid.MiniTable;
import static org.compiere.model.SystemIDs.*; import static org.compiere.model.SystemIDs.*;
import org.compiere.model.MProcess;
import org.compiere.model.X_C_PaySelection; import org.compiere.model.X_C_PaySelection;
import org.compiere.plaf.CompiereColor; import org.compiere.plaf.CompiereColor;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
@ -373,6 +375,7 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID()); X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID());
pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
pi.setAD_Process_UU(new MProcess(Env.getCtx(), AD_Proces_ID, null).getAD_Process_UU());
ProcessParameterPanel pp = new ProcessParameterPanel(m_WindowNo, pi); ProcessParameterPanel pp = new ProcessParameterPanel(m_WindowNo, pi);
// Execute Process // Execute Process

View File

@ -100,11 +100,11 @@ import org.zkoss.zul.Vlayout;
public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener<Event> public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener<Event>
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 8307953279095577359L; private static final long serialVersionUID = 2821858988648268894L;
private static final String ON_COMPLETE = "onComplete"; private static final String ON_COMPLETE = "onComplete";
private static final String ON_STATUS_UPDATE = "onStatusUpdate"; private static final String ON_STATUS_UPDATE = "onStatusUpdate";
@ -132,6 +132,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
private Future<?> future; private Future<?> future;
private List<File> downloadFiles; private List<File> downloadFiles;
private boolean m_locked = false; private boolean m_locked = false;
private String m_AD_Process_UU = "";
protected AbstractProcessDialog() protected AbstractProcessDialog()
{ {
@ -161,11 +162,11 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
log.config(""); log.config("");
// //
boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process"); boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process");
String sql = "SELECT Name, Description, Help, IsReport, ShowHelp " String sql = "SELECT Name, Description, Help, IsReport, ShowHelp, AD_Process_UU "
+ "FROM AD_Process " + "FROM AD_Process "
+ "WHERE AD_Process_ID=?"; + "WHERE AD_Process_ID=?";
if (trl) if (trl)
sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp " sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp, AD_Process_UU "
+ "FROM AD_Process p, AD_Process_Trl t " + "FROM AD_Process p, AD_Process_Trl t "
+ "WHERE p.AD_Process_ID=t.AD_Process_ID" + "WHERE p.AD_Process_ID=t.AD_Process_ID"
+ " AND p.AD_Process_ID=? AND t.AD_Language=?"; + " AND p.AD_Process_ID=? AND t.AD_Language=?";
@ -196,6 +197,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
s = rs.getString(3); // Help s = rs.getString(3); // Help
if (!rs.wasNull()) if (!rs.wasNull())
buildMsg.append("<p>").append(s).append("</p>"); buildMsg.append("<p>").append(s).append("</p>");
m_AD_Process_UU = rs.getString(6);
} }
initialMessage = buildMsg.toString(); initialMessage = buildMsg.toString();
@ -221,6 +223,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
m_pi.setTitle(m_Name); m_pi.setTitle(m_Name);
m_pi.setAD_Process_UU(m_AD_Process_UU);
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi); parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
if ( !parameterPanel.init() ) { if ( !parameterPanel.init() ) {

View File

@ -127,8 +127,8 @@ public abstract class AbstractProcessCtl implements Runnable
// //
String sql = "SELECT p.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4 String sql = "SELECT p.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport,p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8 + " p.isReport,p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
+ " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ " p.IsServerProcess, p.JasperReport " + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p" + "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) " + " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ "WHERE p.IsActive='Y'" + "WHERE p.IsActive='Y'"
@ -136,8 +136,8 @@ public abstract class AbstractProcessCtl implements Runnable
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process"))
sql = "SELECT t.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4 sql = "SELECT t.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport, p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8 + " p.isReport, p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
+ " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ " p.IsServerProcess, p.JasperReport " + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p" + "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) " + " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ " INNER JOIN AD_Process_Trl t ON (p.AD_Process_ID=t.AD_Process_ID" + " INNER JOIN AD_Process_Trl t ON (p.AD_Process_ID=t.AD_Process_ID"
@ -160,6 +160,7 @@ public abstract class AbstractProcessCtl implements Runnable
ProcedureName = rs.getString(2); ProcedureName = rs.getString(2);
m_pi.setClassName (rs.getString(3)); m_pi.setClassName (rs.getString(3));
m_pi.setAD_Process_ID (rs.getInt(4)); m_pi.setAD_Process_ID (rs.getInt(4));
m_pi.setAD_Process_UU(rs.getString(12));
// Report // Report
if ("Y".equals(rs.getString(5))) if ("Y".equals(rs.getString(5)))
{ {