Class DefaultRuleEngineContextFinderStrategy

    • Constructor Detail

      • DefaultRuleEngineContextFinderStrategy

        public DefaultRuleEngineContextFinderStrategy()
    • Method Detail

      • findRuleEngineContext

        public <T extends AbstractRuleEngineContextModel> java.util.Optional<T> findRuleEngineContext​(RuleType ruleType)
        Description copied from interface: RuleEngineContextFinderStrategy
        Finds rule engine contexts for the given rule type. The method only works in rule environments where only 1 rules module exists for the given ruleType. If there are multiple rules modules for the given ruleType it will throw an IllegalStateException exception.
        Specified by:
        findRuleEngineContext in interface RuleEngineContextFinderStrategy
        Parameters:
        ruleType - the rule type to look up rule engine contexts for
        Returns:
        an optional of unique rule engine context for the given rule type. Otherwise throw IllegalStateException
      • findRuleEngineContext

        public <T extends AbstractRuleEngineContextModel> java.util.Optional<T> findRuleEngineContext​(ProductModel product,
                                                                                                      RuleType ruleType)
        Description copied from interface: RuleEngineContextFinderStrategy
        Given the product, finds the rule engine context, compatible with specified rule type
        Specified by:
        findRuleEngineContext in interface RuleEngineContextFinderStrategy
        Parameters:
        product - the product, for which we need to find the rule engine context
        ruleType - filters to return only mappings which rules module is of the given rule type
        Returns:
        a rule engine context, compatible with given rule type. Empty optional if did not find any
      • getRuleEngineContextForCatalogVersions

        public <T extends AbstractRuleEngineContextModel> java.util.Optional<T> getRuleEngineContextForCatalogVersions​(java.util.Collection<CatalogVersionModel> catalogVersions,
                                                                                                                       RuleType ruleType)
        Description copied from interface: RuleEngineContextFinderStrategy
        Finds rule engine contexts for the given catalog versions and rule type. If there are multiple rules modules for the provided parameters it will throw an IllegalStateException exception.
        Specified by:
        getRuleEngineContextForCatalogVersions in interface RuleEngineContextFinderStrategy
        Parameters:
        catalogVersions - collection of catalog versions to perform look up of engine context for
        ruleType - the rule type to look up rule engine context for
        Returns:
        a rule engine context compatible with the given rule type and catalog versions
      • catalogVersionToString

        protected java.lang.String catalogVersionToString​(CatalogVersionModel catalogVersion)
      • getCatalogVersionsForProducts

        protected java.util.Collection<CatalogVersionModel> getCatalogVersionsForProducts​(java.util.Collection<ProductModel> products)
      • getAvailableCatalogVersions

        protected java.util.Collection<CatalogVersionModel> getAvailableCatalogVersions()
      • setCatalogVersionService

        public void setCatalogVersionService​(CatalogVersionService catalogVersionService)
      • setRulesModuleDao

        public void setRulesModuleDao​(RulesModuleDao rulesModuleDao)
      • setRuleEngineContextDao

        public void setRuleEngineContextDao​(RuleEngineContextDao ruleEngineContextDao)