java.lang.Object
org.openhab.core.common.registry.AbstractProvider<Rule>
org.openhab.core.automation.module.script.rulesupport.shared.ScriptedRuleProvider
All Implemented Interfaces:
RuleProvider, ManagedProvider<Rule,String>, Provider<Rule>

@NonNullByDefault public class ScriptedRuleProvider extends AbstractProvider<Rule> implements RuleProvider, ManagedProvider<Rule,String>
This RuleProvider keeps Rules added by scripts during runtime. This ensures that Rules are not kept on reboot, but have to be added by the scripts again.
Author:
Simon Merschjohann - Initial contribution
  • Constructor Details

    • ScriptedRuleProvider

      public ScriptedRuleProvider()
  • Method Details

    • getAll

      public Collection<Rule> getAll()
      Description copied from interface: Provider
      Returns a collection of all elements.
      Specified by:
      getAll in interface Provider<Rule>
      Returns:
      collection of all elements
    • get

      public @Nullable Rule get(String ruleUID)
      Description copied from interface: ManagedProvider
      Returns an element for the given key or null if no element for the given key exists.
      Specified by:
      get in interface ManagedProvider<Rule,String>
      Parameters:
      ruleUID - key
      Returns:
      returns element or null, if no element for the given key exists
    • add

      public void add(Rule rule)
      Description copied from interface: ManagedProvider
      Adds an element.
      Specified by:
      add in interface ManagedProvider<Rule,String>
      Parameters:
      rule - element to be added
    • addRule

      @Deprecated public void addRule(Rule rule)
      Deprecated.
    • update

      public @Nullable Rule update(Rule rule)
      Description copied from interface: ManagedProvider
      Updates an element.
      Specified by:
      update in interface ManagedProvider<Rule,String>
      Parameters:
      rule - element to be updated
      Returns:
      returns the old element or null if no element with the same key exists
    • remove

      public @Nullable Rule remove(String ruleUID)
      Description copied from interface: ManagedProvider
      Removes an element and returns the removed element.
      Specified by:
      remove in interface ManagedProvider<Rule,String>
      Parameters:
      ruleUID - key of the element that should be removed
      Returns:
      element that was removed, or null if no element with the given key exists
    • removeRule

      @Deprecated public void removeRule(String ruleUID)
      Deprecated.
    • removeRule

      public void removeRule(Rule rule)