Compiere 3.1

compiere.model
Class MyValidator

java.lang.Object
  extended by compiere.model.MyValidator
All Implemented Interfaces:
ModelValidator

public class MyValidator
extends Object
implements ModelValidator

Validator Example Implementation

Version:
$Id: MyValidator.java,v 1.2 2006/07/30 00:51:57 jjanke Exp $
Author:
Jorg Janke

Field Summary
 
Fields inherited from interface org.compiere.api.ModelValidator
CHANGETYPE_CHANGE, CHANGETYPE_DELETE, CHANGETYPE_NEW, DOCTIMING_AFTER_COMPLETE, DOCTIMING_BEFORE_PREPARE
 
Constructor Summary
MyValidator()
          Constructor.
 
Method Summary
 String docValidate(PO po, int timing)
          Validate Document.
 int getAD_Client_ID()
          Get Client to be monitored
 void initialize(int AD_Client_ID, ModelValidationEngine engine)
          Initialize Validation
 String login(int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
          User Login.
 String modelChange(PO po, int type)
          Model Change of a monitored Table.
 String toString()
          String Representation
 boolean updateInfoColumns(ArrayList<Info_Column> columns, StringBuffer sqlFrom, StringBuffer sqlOrder)
          Update Info Window Columns
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyValidator

public MyValidator()
Constructor. The class is instanciated when logging in and client is selected/known

Method Detail

initialize

public void initialize(int AD_Client_ID,
                       ModelValidationEngine engine)
Initialize Validation

Specified by:
initialize in interface ModelValidator
Parameters:
engine - validation engine

getAD_Client_ID

public int getAD_Client_ID()
Get Client to be monitored

Specified by:
getAD_Client_ID in interface ModelValidator
Returns:
AD_Client_ID or 0 for ALL

login

public String login(int AD_Org_ID,
                    int AD_Role_ID,
                    int AD_User_ID)
User Login. Called when preferences are set

Specified by:
login in interface ModelValidator
Parameters:
AD_Org_ID - org
AD_Role_ID - role
AD_User_ID - user
Returns:
error message or null

modelChange

public String modelChange(PO po,
                          int type)
                   throws Exception
Model Change of a monitored Table. Called after PO.beforeSave/PO.beforeDelete when you called addModelChange for the table

Specified by:
modelChange in interface ModelValidator
Parameters:
po - persistent object
type - TYPE_
Returns:
error message or null
Throws:
Exception - if the recipient wishes the change to be not accept.

docValidate

public String docValidate(PO po,
                          int timing)
Validate Document. Called as first step of DocAction.prepareIt when you called addDocValidate for the table. Note that totals, etc. may not be correct.

Specified by:
docValidate in interface ModelValidator
Parameters:
po - persistent object
timing - see TIMING_ constants
Returns:
error message or null

updateInfoColumns

public boolean updateInfoColumns(ArrayList<Info_Column> columns,
                                 StringBuffer sqlFrom,
                                 StringBuffer sqlOrder)
Update Info Window Columns. - add new Columns - remove columns - change dispay sequence

Specified by:
updateInfoColumns in interface ModelValidator
Parameters:
columns - array of columns
sqlFrom - from clause, can be modified
sqlOrder - order by clause, can me modified
Returns:
true if you updated columns, sequence or sql From clause

toString

public String toString()
String Representation

Overrides:
toString in class Object
Returns:
info

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.