Package org.compiere.model
Class ModelValidationEngine
- java.lang.Object
-
- org.compiere.model.ModelValidationEngine
-
public class ModelValidationEngine extends Object
Model Validation Engine- Version:
- $Id: ModelValidationEngine.java,v 1.2 2006/07/30 00:58:38 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- FR [ 1670025 ] ModelValidator.afterLoadPreferences will be useful
- BF [ 1679692 ] fireDocValidate doesn't treat exceptions as errors
- FR [ 1724662 ] Support Email should contain model validators info
- FR [ 2788276 ] Data Import Validator https://sourceforge.net/p/adempiere/feature-requests/712/
- BF [ 2804135 ] Global FactsValidator are not invoked https://sourceforge.net/p/adempiere/bugs/1936/
- BF [ 2819617 ] NPE if script validator rule returns null https://sourceforge.net/p/adempiere/bugs/1976/, victor.perez@e-evolution.com, www.e-evolution.com
- BF [ 2947607 ] Model Validator Engine duplicate listeners
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocValidate(String tableName, ModelValidator listener)
Add Document Validation Listenervoid
addFactsValidate(String tableName, FactsValidator listener)
Add Accounting Facts Validation Listenervoid
addImportValidate(String importTableName, ImportValidator listener)
Add Date Import Validation Listenervoid
addModelChange(String tableName, ModelValidator listener)
Add Model Change Listenervoid
afterLoadPreferences(Properties ctx)
After Load Preferences into Context for selected client.void
beforeSaveProperties()
Before Save Properties for selected client.String
fireDocValidate(PO po, int docTiming)
Fire Document Validation.String
fireFactsValidate(MAcctSchema schema, List<Fact> facts, PO po)
Fire Accounting Facts Validation.void
fireImportValidate(ImportProcess process, PO importModel, PO targetModel, int timing)
Fire Import Validation.String
fireModelChange(PO po, int changeType)
Fire Model Change.static ModelValidationEngine
get()
Get SingletonStringBuffer
getInfoDetail(StringBuffer sb, Properties ctx)
Create Model Validators InfoString
loginComplete(int AD_Client_ID, int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
Called when login is completevoid
removeDocValidate(String tableName, ModelValidator listener)
Remove Document Validation Listenervoid
removeFactsValidate(String tableName, FactsValidator listener)
Remove Accounting Facts Validation Listenervoid
removeModelChange(String tableName, ModelValidator listener)
Remove Model Change ListenerString
toString()
String Representation
-
-
-
Method Detail
-
get
public static ModelValidationEngine get()
Get Singleton- Returns:
- engine
-
loginComplete
public String loginComplete(int AD_Client_ID, int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
Called when login is complete- Parameters:
AD_Client_ID
- clientAD_Org_ID
- orgAD_Role_ID
- roleAD_User_ID
- user- Returns:
- error message or null
-
addModelChange
public void addModelChange(String tableName, ModelValidator listener)
Add Model Change Listener- Parameters:
tableName
- table namelistener
- listener
-
removeModelChange
public void removeModelChange(String tableName, ModelValidator listener)
Remove Model Change Listener- Parameters:
tableName
- table namelistener
- listener
-
fireModelChange
public String fireModelChange(PO po, int changeType)
Fire Model Change. Call modelChange method of added validators- Parameters:
po
- persistent objectschangeType
- ModelValidator.TYPE_*- Returns:
- error message or NULL for no veto
-
addDocValidate
public void addDocValidate(String tableName, ModelValidator listener)
Add Document Validation Listener- Parameters:
tableName
- table namelistener
- listener
-
removeDocValidate
public void removeDocValidate(String tableName, ModelValidator listener)
Remove Document Validation Listener- Parameters:
tableName
- table namelistener
- listener
-
fireDocValidate
public String fireDocValidate(PO po, int docTiming)
Fire Document Validation. Call docValidate method of added validators- Parameters:
po
- persistent objectsdocTiming
- see ModelValidator.TIMING_ constants- Returns:
- error message or null
-
addFactsValidate
public void addFactsValidate(String tableName, FactsValidator listener)
Add Accounting Facts Validation Listener- Parameters:
tableName
- table namelistener
- listener
-
addImportValidate
public void addImportValidate(String importTableName, ImportValidator listener)
Add Date Import Validation Listener- Parameters:
importTableName
- table namelistener
- listener
-
removeFactsValidate
public void removeFactsValidate(String tableName, FactsValidator listener)
Remove Accounting Facts Validation Listener- Parameters:
tableName
- table namelistener
- listener
-
fireFactsValidate
public String fireFactsValidate(MAcctSchema schema, List<Fact> facts, PO po)
Fire Accounting Facts Validation. Call factsValidate method of added validators- Parameters:
schema
-facts
-po
-- Returns:
- error message or null
-
fireImportValidate
public void fireImportValidate(ImportProcess process, PO importModel, PO targetModel, int timing)
Fire Import Validation. CallImportValidator.validate(ImportProcess, Object, Object, int)
or registered validators.- Parameters:
process
- import processimportModel
- import record (e.g. X_I_BPartner)targetModel
- target model (e.g. MBPartner, MBPartnerLocation, MUser)timing
- see ImportValidator.TIMING_* constants
-
toString
public String toString()
String Representation
-
getInfoDetail
public StringBuffer getInfoDetail(StringBuffer sb, Properties ctx)
Create Model Validators Info- Parameters:
sb
- optional string bufferctx
- context- Returns:
- Model Validators Info author Teo Sarca, FR [ 1724662 ]
-
afterLoadPreferences
public void afterLoadPreferences(Properties ctx)
After Load Preferences into Context for selected client.- Parameters:
ctx
- context- See Also:
author Teo Sarca - FR [ 1670025 ] - https://sourceforge.net/p/adempiere/feature-requests/78/
-
beforeSaveProperties
public void beforeSaveProperties()
Before Save Properties for selected client.
-
-