Class DefaultRuleEngineSystemSetup

  • All Implemented Interfaces:
    RuleEngineSystemSetup, java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<AfterInitializationEndEvent>

    public class DefaultRuleEngineSystemSetup
    extends AbstractEventListener<AfterInitializationEndEvent>
    implements RuleEngineSystemSetup
    The default implementation for RuleEngineSystemSetupService. This setup class allows to register source rules for deployment after system initialization.
    • Constructor Detail

      • DefaultRuleEngineSystemSetup

        public DefaultRuleEngineSystemSetup()
    • Method Detail

      • initializeModule

        public <T extends AbstractRulesModule> void initializeModule​(T module)
        Description copied from interface: RuleEngineSystemSetup
        Performs initialization of the provided (jalo) rules module. This method is intended to be used from within impex scripts.
        Specified by:
        initializeModule in interface RuleEngineSystemSetup
        Parameters:
        module - Jalo representation of rules module to be initialized
      • registerSourceRuleForDeployment

        public void registerSourceRuleForDeployment​(SourceRule sourceRule,
                                                    java.lang.String... moduleNames)
        Description copied from interface: RuleEngineSystemSetup
        registers a (jalo) SourceRule to be compiled and deployed for the given moduleNames after the next initialization. This method is intended to be used from within impex scripts.
        Specified by:
        registerSourceRuleForDeployment in interface RuleEngineSystemSetup
        Parameters:
        sourceRule - the source rule to be registered for deployment
        moduleNames - the target module(s) by name
      • registerSourceRulesForDeployment

        public void registerSourceRulesForDeployment​(java.util.Collection<SourceRuleModel> sourceRules,
                                                     java.util.Collection<java.lang.String> moduleNames)
        Description copied from interface: RuleEngineSystemSetup
        registers a collection of SourceRules to be compiled and deployed for the given moduleNames after the next initialization. This call will register all given source rules for all given module names.
        Specified by:
        registerSourceRulesForDeployment in interface RuleEngineSystemSetup
        Parameters:
        sourceRules - the source rules to be registered for deployment
        moduleNames - the target modules by name
      • doRuleDeployment

        protected void doRuleDeployment​(java.lang.String moduleName,
                                        java.util.List<SourceRuleModel> rules)
      • validateAndConvertFromJalo

        protected <T extends SourceRuleModel> java.util.Optional<T> validateAndConvertFromJalo​(SourceRule sourceRule)
      • validateAndConvertFromJalo

        protected <T extends ItemModel> java.util.Optional<T> validateAndConvertFromJalo​(PK pk)
      • failOnError

        protected boolean failOnError()
        whether to fail on any error or ignore them (set via ruleengineservices.system.setup.failOnError system property, defaults to true.
        Returns:
        whether to fail on any error or not
      • convert

        protected <T extends ItemModel> java.util.List<T> convert​(java.util.Set<PK> pks)
        converts the given set of PKs to source rule model objects.
        Parameters:
        pks - the set of pks
        Returns:
        the list of source rule models
      • getInitializationMap

        protected java.util.Map<java.lang.String,​java.util.Set<PK>> getInitializationMap()
      • setRuleMaintenanceService

        public void setRuleMaintenanceService​(RuleMaintenanceService ruleMaintenanceService)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • setConfigurationService

        public void setConfigurationService​(ConfigurationService configurationService)
      • getSourceRuleModelValidator

        protected java.util.function.Predicate<SourceRuleModel> getSourceRuleModelValidator()
      • setSourceRuleModelValidator

        public void setSourceRuleModelValidator​(java.util.function.Predicate<SourceRuleModel> sourceRuleModelValidator)
      • setRuleEngineService

        public void setRuleEngineService​(RuleEngineService ruleEngineService)