Class MRule

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_Rule, I_Persistent, Evaluatee, ImmutablePOSupport

public class MRule extends X_AD_Rule implements ImmutablePOSupport
Application Rule Model
Version:
$Id: MRule.java
Author:
Carlos Ruiz
See Also:
  • Field Details

  • Constructor Details

    • MRule

      public MRule(Properties ctx, String AD_Rule_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      AD_Rule_UU - UUID key
      trxName - Transaction
    • MRule

      public MRule(Properties ctx, int AD_Rule_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      AD_Rule_ID - id
      trxName - transaction
    • MRule

      public MRule(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - context
      rs - result set
      trxName - transaction
    • MRule

      public MRule(MRule copy)
      Copy constructor
      Parameters:
      copy -
    • MRule

      public MRule(Properties ctx, MRule copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MRule

      public MRule(Properties ctx, MRule copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • get

      public static MRule get(int AD_Rule_ID)
      Get Rule from Cache (immutable)
      Parameters:
      AD_Rule_ID - id
      Returns:
      MRule
    • get

      public static MRule get(Properties ctx, int AD_Rule_ID)
      Get Rule from Cache (immutable)
      Parameters:
      ctx - context
      AD_Rule_ID - id
      Returns:
      MRule
    • get

      public static MRule get(Properties ctx, String ruleValue)
      Get Rule from Cache
      Parameters:
      ctx - context
      ruleValue - case sensitive rule Value
      Returns:
      MRule or null
    • getModelValidatorLoginRules

      public static List<MRule> getModelValidatorLoginRules(Properties ctx)
      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 class PO
      Parameters:
      newRecord - true if it is a new record
      Returns:
      true if record can be saved
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class X_AD_Rule
      Returns:
      info
    • getScriptEngine

      public ScriptEngine getScriptEngine()
      Script Engine for this rule
      Returns:
      ScriptEngine or null
    • getEngineName

      public String getEngineName()
      Get engine name from Value (format is engineName:scriptSearchKey)
      Returns:
      script engine name or null
    • setContext

      public static void setContext(ScriptEngine engine, Properties ctx, int windowNo)
      Add context entries as variable binding to the script engine based on windowNo
      Parameters:
      engine - Script Engine
      ctx - context
      windowNo - window number
    • convertKey

      public static String convertKey(String key, int m_windowNo)
      Convert context key to script engine variable name
      # -> _
      Parameters:
      key -
      m_windowNo -
      Returns:
      context key converted to script engine variable name
    • markImmutable

      public MRule markImmutable()
      Description copied from interface: ImmutablePOSupport
      mark PO as immutable
      Specified by:
      markImmutable in interface ImmutablePOSupport
      Returns:
      PO