LCO Validator

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.


(This is an exposition of a pretty good ModelValidator which originates from Jorg Janke's Compiere but much attended to by our community experts.)

Call Hierarchy

  • Firstly we look at the java class calling hierarchy that leads to such a Validator.
  • In Eclipse when we do that for one of its methods we get:


  • Note at the bottom which is truncated, it is actually a long list of Model activity.
  • Such as Document Actions (M<Document>) which are closeIt(), completeIt(), prepareIt(), reverseCorrectIt(), voidIt(), reActivateIt().
  • And in Persistence Object (PO) activity which are save(), saveFinish(boolean,boolean) and delete().
  • It is also called during Accounts Posting as in,boolean).
  • And in a few other distinctive places:
    • org.compiere.apps.Dialog.createSupportEmail(,,),
    • org.compiere.util.Login.loadPreferences(,,,),
    • org.compiere.util.Login.validateLogin(KeyNamePair),
    • org.compiere.util.Ini.saveProperties(),

Allowing the Interception

  • So you can see that the LCO_Validator class is called in an AOP (Aspect Oriented Programming) manner where its methods can intercept during any of the above Model or PO or callings.
  • A code example that calls from a Model class is:


Intercepting Methods

  • Now the registered (see ModelValidator) methods will come into play and the event stated will be activated in the LCO_Validator.
  • They are ModelChange(PO, type) and DocValidate(PO, type).
  • For example:


See Also