Implement Validator for beforeSaveProperties - ID: 2373679
This commit is contained in:
parent
9d58437440
commit
4c50d922c5
|
@ -737,4 +737,34 @@ public class ModelValidationEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before Save Properties for selected client.
|
||||||
|
*/
|
||||||
|
public void beforeSaveProperties ()
|
||||||
|
{
|
||||||
|
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||||
|
for (int i = 0; i < m_validators.size(); i++)
|
||||||
|
{
|
||||||
|
ModelValidator validator = (ModelValidator)m_validators.get(i);
|
||||||
|
if (AD_Client_ID == validator.getAD_Client_ID()
|
||||||
|
|| m_globalValidators.contains(validator))
|
||||||
|
{
|
||||||
|
java.lang.reflect.Method m = null;
|
||||||
|
try {
|
||||||
|
m = validator.getClass().getMethod("beforeSaveProperties");
|
||||||
|
}
|
||||||
|
catch(NoSuchMethodException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (m != null)
|
||||||
|
m.invoke(validator);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
log.warning("" + validator + ": " + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // ModelValidatorEngine
|
} // ModelValidatorEngine
|
||||||
|
|
|
@ -16,14 +16,25 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.util;
|
package org.compiere.util;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Dimension;
|
||||||
import java.io.*;
|
import java.awt.Point;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.sql.*;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
import java.util.logging.*;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.jnlp.BasicService;
|
import javax.jnlp.BasicService;
|
||||||
import javax.jnlp.FileContents;
|
import javax.jnlp.FileContents;
|
||||||
|
@ -31,7 +42,9 @@ import javax.jnlp.PersistenceService;
|
||||||
import javax.jnlp.ServiceManager;
|
import javax.jnlp.ServiceManager;
|
||||||
import javax.jnlp.UnavailableServiceException;
|
import javax.jnlp.UnavailableServiceException;
|
||||||
|
|
||||||
import org.adempiere.plaf.*;
|
import org.adempiere.plaf.AdempiereLookAndFeel;
|
||||||
|
import org.adempiere.plaf.AdempiereThemeInnova;
|
||||||
|
import org.compiere.model.ModelValidationEngine;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,6 +244,11 @@ public final class Ini implements Serializable
|
||||||
*/
|
*/
|
||||||
public static void saveProperties (boolean tryUserHome)
|
public static void saveProperties (boolean tryUserHome)
|
||||||
{
|
{
|
||||||
|
if (Ini.isClient() && DB.isConnected()) {
|
||||||
|
// Call ModelValidators beforeSaveProperties
|
||||||
|
ModelValidationEngine.get().beforeSaveProperties();
|
||||||
|
}
|
||||||
|
|
||||||
if (isWebStartClient())
|
if (isWebStartClient())
|
||||||
{
|
{
|
||||||
saveWebStartProperties();
|
saveWebStartProperties();
|
||||||
|
|
Loading…
Reference in New Issue