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 Details

      • get

        public static ModelValidationEngine get()
        Get Singleton instance
        Returns:
        singleton engine instance
      • 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.
        - Call ModelValidator.login(int, int, int) on register validators. - Call script validator (AD_Table_ScriptValidator)
        - Fire IEventTopics.AFTER_LOGIN OSGi event.
        Parameters:
        AD_Client_ID - client
        AD_Org_ID - org
        AD_Role_ID - role
        AD_User_ID - user
        Returns:
        error message or null
      • addModelChange

        public void addModelChange(String tableName, ModelValidator listener)
        Add Model Change Listener for a table
        Parameters:
        tableName - table name
        listener - listener (global or tenant specific)
      • removeModelChange

        public void removeModelChange(String tableName, ModelValidator listener)
        Remove Model Change Listener for a table
        Parameters:
        tableName - table name
        listener - listener (global or tenant specific)
      • fireModelChange

        public String fireModelChange(PO po, int changeType)
        Fire Model Change event of a table. - Call ModelValidator.modelChange(PO, int) on register validators.
        - Call script validator (AD_Table_ScriptValidator)
        - Fire IEventTopics.PO_* OSGi event.
        Parameters:
        po - PO instance for the event
        changeType - ModelValidator.TYPE_*
        Returns:
        error message or NULL for no veto
      • addDocValidate

        public void addDocValidate(String tableName, ModelValidator listener)
        Add Document Validation Listener for a table
        Parameters:
        tableName - table name
        listener - listener (global or tenant specific)
      • removeDocValidate

        public void removeDocValidate(String tableName, ModelValidator listener)
        Remove Document Validation Listener of a table
        Parameters:
        tableName - table name
        listener - listener (global or tenant specific)
      • fireDocValidate

        public String fireDocValidate(PO po, int docTiming)
        Fire Document Validation event of a table.
        - Call ModelValidator.docValidate(PO, int) on register validators.
        - Call script validator (AD_Table_ScriptValidator)
        - Fire IEventTopics.DOC_* OSGi event.
        Parameters:
        po - PO instance for the event
        docTiming - 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 name
        listener - listener (global or tenant specific)
      • addImportValidate

        public void addImportValidate(String importTableName, ImportValidator listener)
        Add Import Validation Listener of an import table
        Parameters:
        importTableName - table name
        listener - listener
      • removeFactsValidate

        public void removeFactsValidate(String tableName, FactsValidator listener)
        Remove Accounting Facts Validation Listener of a table
        Parameters:
        tableName - table name
        listener - listener
      • fireFactsValidate

        public String fireFactsValidate(MAcctSchema schema, List<Fact> facts, PO po)
        Fire Accounting Facts Validation event of a table.
        - Call FactsValidator.factsValidate(MAcctSchema, List, PO) on register validators.
        - Fire IEventTopics.ACCT_FACTS_VALIDATE OSGi event.
        Parameters:
        schema -
        facts -
        po - PO instance of event
        Returns:
        error message or null
      • fireImportValidate

        public void fireImportValidate(ImportProcess process, PO importModel, PO targetModel, int timing)
        Fire Import Validation event.
        - Call ImportValidator.validate(ImportProcess, Object, Object, int) on registered validators.
        - Fire IEventTopics.IMPORT_* OSGi event.
        Parameters:
        process - import process
        importModel - 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
        Overrides:
        toString in class Object
        Returns:
        info
      • getInfoDetail

        public StringBuffer getInfoDetail(StringBuffer sb, Properties ctx)
        Get Model Validation Engine Info
        Parameters:
        sb - optional string buffer
        ctx - context
        Returns:
        Model Validation Engine Info author Teo Sarca, FR [ 1724662 ]
      • afterLoadPreferences

        public void afterLoadPreferences(Properties ctx)
        After Load Preferences into Context for selected client.
        Fire afterLoadPreferences model validator event and IEventTopics.PREF_AFTER_LOAD OSGi event.
        Parameters:
        ctx - context
        See Also:
      • beforeSaveProperties

        @Deprecated public void beforeSaveProperties()
        Deprecated.
        for deprecated swing client only
        Before Save Properties for selected client.