Making sample MyValidator work also with Global ModelValidator approach
for a better sample and testing purposes on [ 2039563 ] zk webui not calling modelvalidator
This commit is contained in:
parent
5a5cdac18d
commit
09dfff3a6c
|
@ -49,7 +49,6 @@ public class MyValidator implements ModelValidator
|
||||||
/** Client */
|
/** Client */
|
||||||
private int m_AD_Client_ID = -1;
|
private int m_AD_Client_ID = -1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Validation
|
* Initialize Validation
|
||||||
* @param engine validation engine
|
* @param engine validation engine
|
||||||
|
@ -57,13 +56,14 @@ public class MyValidator implements ModelValidator
|
||||||
*/
|
*/
|
||||||
public void initialize (ModelValidationEngine engine, MClient client)
|
public void initialize (ModelValidationEngine engine, MClient client)
|
||||||
{
|
{
|
||||||
if (client != null)
|
//client = null for global validator
|
||||||
|
if (client != null) {
|
||||||
m_AD_Client_ID = client.getAD_Client_ID();
|
m_AD_Client_ID = client.getAD_Client_ID();
|
||||||
else
|
log.info(client.toString());
|
||||||
m_AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
}
|
||||||
log.info("" + m_AD_Client_ID);
|
else {
|
||||||
if (m_AD_Client_ID != 11) // GardenWorld Example
|
log.info("Initializing global validator: "+this.toString());
|
||||||
return;
|
}
|
||||||
|
|
||||||
// We want to be informed when C_Order is created/changed
|
// We want to be informed when C_Order is created/changed
|
||||||
engine.addModelChange(MOrder.Table_Name, this);
|
engine.addModelChange(MOrder.Table_Name, this);
|
||||||
|
@ -102,6 +102,7 @@ public class MyValidator implements ModelValidator
|
||||||
public String docValidate (PO po, int timing)
|
public String docValidate (PO po, int timing)
|
||||||
{
|
{
|
||||||
log.info(po.get_TableName() + " Timing: "+timing);
|
log.info(po.get_TableName() + " Timing: "+timing);
|
||||||
|
|
||||||
// Ignore all after Complete events
|
// Ignore all after Complete events
|
||||||
if (timing == TIMING_AFTER_COMPLETE)
|
if (timing == TIMING_AFTER_COMPLETE)
|
||||||
return null;
|
return null;
|
||||||
|
@ -188,7 +189,6 @@ public class MyValidator implements ModelValidator
|
||||||
return null;
|
return null;
|
||||||
} // login
|
} // login
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Client to be monitored
|
* Get Client to be monitored
|
||||||
* @return AD_Client_ID client
|
* @return AD_Client_ID client
|
||||||
|
|
Loading…
Reference in New Issue