Package org.compiere.model
Class MRule
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_AD_Rule
org.compiere.model.MRule
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_Rule
,I_Persistent
,Evaluatee
,ImmutablePOSupport
Application Rule Model
- Version:
- $Id: MRule.java
- Author:
- Carlos Ruiz
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected ScriptEngine
static final String
static final String
static final String
static final String
Fields inherited from class org.compiere.model.X_AD_Rule
ACCESSLEVEL_AD_Reference_ID, ACCESSLEVEL_All, ACCESSLEVEL_ClientOnly, ACCESSLEVEL_ClientPlusOrganization, ACCESSLEVEL_Organization, ACCESSLEVEL_SystemOnly, ACCESSLEVEL_SystemPlusClient, ENTITYTYPE_AD_Reference_ID, EVENTTYPE_AD_Reference_ID, EVENTTYPE_Callout, EVENTTYPE_GLReconciliation, EVENTTYPE_HumanResourcePayroll, EVENTTYPE_MeasureForPerformanceAnalysis, EVENTTYPE_ModelValidatorDocumentEvent, EVENTTYPE_ModelValidatorLoginEvent, EVENTTYPE_ModelValidatorTableEvent, EVENTTYPE_Process, RULETYPE_AD_Reference_ID, RULETYPE_AspectOrientProgram, RULETYPE_JSR223ScriptingAPIs, RULETYPE_JSR94RuleEngineAPI, RULETYPE_SQL
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_AD_Rule
accessLevel, COLUMNNAME_AccessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Rule_ID, COLUMNNAME_AD_Rule_UU, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_Description, COLUMNNAME_EntityType, COLUMNNAME_EventType, COLUMNNAME_Help, COLUMNNAME_IsActive, COLUMNNAME_Name, COLUMNNAME_RuleType, COLUMNNAME_Script, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_Value, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMRule
(Properties ctx, int AD_Rule_ID, String trxName) Standard ConstructorMRule
(Properties ctx, String AD_Rule_UU, String trxName) UUID based ConstructorMRule
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMRule
(Properties ctx, MRule copy) Copy constructorMRule
(Properties ctx, MRule copy, String trxName) Copy constructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static String
convertKey
(String key, int m_windowNo) Convert context key to script engine variable name
# -> _static MRule
get
(int AD_Rule_ID) Get Rule from Cache (immutable)static MRule
get
(Properties ctx, int AD_Rule_ID) Get Rule from Cache (immutable)static MRule
get
(Properties ctx, String ruleValue) Get Rule from CacheGet engine name from Value (format is engineName:scriptSearchKey)Get Login RulesScript Engine for this rulemark PO as immutablestatic void
setContext
(ScriptEngine engine, Properties ctx, int windowNo) Add context entries as variable binding to the script engine based on windowNotoString()
String RepresentationMethods inherited from class org.compiere.model.X_AD_Rule
get_AccessLevel, getAccessLevel, getAD_Rule_ID, getAD_Rule_UU, getDescription, getEntityType, getEventType, getHelp, getKeyNamePair, getName, getRuleType, getScript, getValue, initPO, setAccessLevel, setAD_Rule_ID, setAD_Rule_UU, setDescription, setEntityType, setEventType, setHelp, setName, setRuleType, setScript, setValue
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_AD_Rule
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Field Details
-
GLOBAL_CONTEXT_PREFIX
- See Also:
-
WINDOW_CONTEXT_PREFIX
- See Also:
-
ARGUMENTS_PREFIX
- See Also:
-
PARAMETERS_PREFIX
- See Also:
-
SCRIPT_PREFIX
- See Also:
-
engine
-
-
Constructor Details
-
MRule
UUID based Constructor- Parameters:
ctx
- ContextAD_Rule_UU
- UUID keytrxName
- Transaction
-
MRule
Standard Constructor- Parameters:
ctx
- contextAD_Rule_ID
- idtrxName
- transaction
-
MRule
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MRule
Copy constructor- Parameters:
copy
-
-
MRule
Copy constructor- Parameters:
ctx
-copy
-
-
MRule
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
get
Get Rule from Cache (immutable)- Parameters:
AD_Rule_ID
- id- Returns:
- MRule
-
get
Get Rule from Cache (immutable)- Parameters:
ctx
- contextAD_Rule_ID
- id- Returns:
- MRule
-
get
Get Rule from Cache- Parameters:
ctx
- contextruleValue
- case sensitive rule Value- Returns:
- MRule or null
-
getModelValidatorLoginRules
Get Login Rules- Parameters:
ctx
- context- Returns:
- list of rule or null
-
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:PO
Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- true if it is a new record- Returns:
- true if record can be saved
-
toString
String Representation -
getScriptEngine
Script Engine for this rule- Returns:
- ScriptEngine or null
-
getEngineName
Get engine name from Value (format is engineName:scriptSearchKey)- Returns:
- script engine name or null
-
setContext
Add context entries as variable binding to the script engine based on windowNo- Parameters:
engine
- Script Enginectx
- contextwindowNo
- window number
-
convertKey
Convert context key to script engine variable name
# -> _- Parameters:
key
-m_windowNo
-- Returns:
- context key converted to script engine variable name
-
markImmutable
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-