Interface ModuleHandlerCallback

  • All Known Subinterfaces:
    SimpleTriggerHandlerCallback, TriggerHandlerCallback

    public interface ModuleHandlerCallback
    This class is responsible to provide a RegistryChangeListener logic. An instance of it is added to RuleRegistry service, to listen for changes when a single Rule has been added, updated, enabled, disabled or removed and to involve Rule Engine to process these changes. Also to send a run command for a single Rule to the Rule Engine.
    Kai Kreuzer - Initial contribution
    • Method Detail

      • setEnabled

        void setEnabled​(String uid,
                        boolean isEnabled)
        This method is used for changing enabled state of the Rule. The enabled rule statuses are RuleStatus.UNINITIALIZED, RuleStatus.IDLE and RuleStatus.RUNNING. The disabled rule status is RuleStatus#DISABLED.
        uid - the unique identifier of the Rule.
        isEnabled - a new enabled / disabled state of the Rule.
      • getStatus

        @Nullable RuleStatus getStatus​(String ruleUID)
        Utility method which gets RuleStatus of the specified Rule.
        ruleUID - UID of the Rule
        RuleStatus object containing status of the looking Rule or null when a rule with specified UID does not exists.
      • runNow

        void runNow​(String uid)
        The method skips the triggers and the conditions and directly executes the actions of the rule. This should always be possible unless an action has a mandatory input that is linked to a trigger. In that case the action is skipped and the rule engine continues execution of rest actions.
        ruleUID - id of the rule whose actions have to be executed.
      • runNow

        void runNow​(String uid,
                    boolean considerConditions,
                    @Nullable Map<String,​Object> context)
        Same as runNow(String) with the additional option to enable/disable evaluation of conditions defined in the target rule. The context can be set here, too, but also might be null.
        ruleUID - id of the rule whose actions have to be executed.
        considerConditions - if true the conditions of the rule will be checked.
        context - the context that is passed to the conditions and the actions of the rule.