com.ibm.commerce.giftcenter.registry

Class GiftListRulesRegistry

  • java.lang.Object
    • com.ibm.commerce.giftcenter.registry.GiftListRulesRegistry
  • All Implemented Interfaces:
    Registry


    public class GiftListRulesRegistry
    extends java.lang.Object
    implements Registry
    The GiftListRulesRegistry class stores the gift list rule details which are configured in the GRREGRULE table. The class also stores a list of validator class definitions used to validate each enabled rule against the gift list object.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addRuleEntry(java.lang.Integer storeId, java.lang.String eventTypeName, java.lang.Integer name, java.lang.String value)
      Adds a new rule entry in to the registry cache.
      java.util.Hashtable getAllValidators()
      Returns all the rule validators defined in registry.
      java.util.Hashtable getCreateRuleValidators()
      Returns the validators for create rule defined in the rule validator configuration file.
      java.util.Hashtable getDeleteRuleValidators()
      Returns the validators for delete rule defined in the rule validator configuration file.
      java.lang.String getRuleValue(java.lang.Integer storeId, java.lang.String eventTypeName, java.lang.Integer name)
      Returns the rule value for a storeId, event type, rule name combination.
      java.util.Hashtable getUpdateRuleValidators()
      Returns the validators for update rule defined in the rule validator configuration file.
      GiftListRulesValidator getValidatorInstance(java.lang.String implClassName)
      Returns the gift list rule validator instance class based on the implementation class name.
      void initialize()
      Initializes the rule registry.
      void refresh()
      Refreshes the memory to reload the rule details and the validator details.
      void removeRuleEntry(java.lang.Integer storeId, java.lang.String eventTypeName, java.lang.Integer name)
      Removes a rule entry from the registry cache.
      static GiftListRulesRegistry singleton()
      Returns the singleton instance of GiftListRulesRegistry class that contains a reference to the cached data.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GiftListRulesRegistry

        public GiftListRulesRegistry()
    • Method Detail

      • initialize

        public void initialize()
                        throws java.lang.Exception
        Initializes the rule registry.
        Specified by:
        initialize in interface Registry
        Throws:
        java.lang.Exception - if an error is encountered on initialization.
      • refresh

        public void refresh()
                     throws java.lang.Exception
        Refreshes the memory to reload the rule details and the validator details.
        Specified by:
        refresh in interface Registry
        Throws:
        java.lang.Exception - if an error is encountered on refresh.
      • singleton

        public static GiftListRulesRegistry singleton()
        Returns the singleton instance of GiftListRulesRegistry class that contains a reference to the cached data.
        Returns:
        The rule registry instance.
      • addRuleEntry

        public void addRuleEntry(java.lang.Integer storeId,
                                 java.lang.String eventTypeName,
                                 java.lang.Integer name,
                                 java.lang.String value)
        Adds a new rule entry in to the registry cache.
        Parameters:
        storeId - The store ID.
        eventTypeName - The event type name.
        name - The rule name.
        value - The rule value.
      • getRuleValue

        public java.lang.String getRuleValue(java.lang.Integer storeId,
                                             java.lang.String eventTypeName,
                                             java.lang.Integer name)
        Returns the rule value for a storeId, event type, rule name combination.
        Parameters:
        storeId - The store ID.
        eventTypeName - The event type.
        name - The rule name.
        Returns:
        The rule value.
      • removeRuleEntry

        public void removeRuleEntry(java.lang.Integer storeId,
                                    java.lang.String eventTypeName,
                                    java.lang.Integer name)
        Removes a rule entry from the registry cache.
        Parameters:
        storeId - The store ID.
        eventTypeName - The event type.
        name - The rule name.
      • getCreateRuleValidators

        public java.util.Hashtable getCreateRuleValidators()
        Returns the validators for create rule defined in the rule validator configuration file.
        Returns:
        The create rule validators.
        See Also:
        GiftListServerConstants.GL_RULE_VALIDATION_CONFIG_XML
      • getUpdateRuleValidators

        public java.util.Hashtable getUpdateRuleValidators()
        Returns the validators for update rule defined in the rule validator configuration file.
        Returns:
        The update rule validators.
        See Also:
        GiftListServerConstants.GL_RULE_VALIDATION_CONFIG_XML
      • getDeleteRuleValidators

        public java.util.Hashtable getDeleteRuleValidators()
        Returns the validators for delete rule defined in the rule validator configuration file.
        Returns:
        The delete rule validators.
        See Also:
        GiftListServerConstants.GL_RULE_VALIDATION_CONFIG_XML
      • getValidatorInstance

        public GiftListRulesValidator getValidatorInstance(java.lang.String implClassName)
        Returns the gift list rule validator instance class based on the implementation class name.
        Parameters:
        implClassName - The validator implementation class.
        Returns:
        The GiftList rule validator instance.
      • getAllValidators

        public java.util.Hashtable getAllValidators()
        Returns all the rule validators defined in registry.
        Returns:
        A table containing the rule name to the validator class mapping for all the rules.