Class SimpleRule
java.lang.Object
org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleRule
- All Implemented Interfaces:
SimpleRuleActionHandler,Rule,Identifiable<String>
@NonNullByDefault
public abstract class SimpleRule
extends Object
implements Rule, SimpleRuleActionHandler
convenience Rule class with an action handler. This allows to define Rules which have an execution block.
- Author:
- Simon Merschjohann - Initial contribution, Kai Kreuzer - made it implement Rule
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openhab.core.automation.Rule
Rule.TemplateState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ConfigDescriptionParameter> protected Configurationprotected @Nullable Stringprotected @Nullable Stringprotected RuleStatusInfoprotected @Nullable Stringprotected Stringprotected Visibility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is used to get the actions participating inRule.This method is used to get the conditions participating inRule.This method is used to obtain theRule'sConfiguration.This method is used to obtain theListwithConfigDescriptionParameters defining meta info for configuration properties of theRule.@Nullable StringThis method is used to obtain the human-readable description of the purpose and consequences of theRule's execution.Obtains the modules of theRule.getModules(@Nullable Class<T> moduleClazz) @Nullable StringgetName()This method is used to obtain theRule's human-readable name.getTags()This method is used to obtain theRule's assigned tags.@Nullable StringThis method is used to obtain theRuleTemplateidentifier of the template theRulewas created from.This method is used to get the triggers participating inRule.getUID()This method is used to obtain the identifier of the Rule.This method is used to obtain theRule'sVisibility.inthashCode()voidsetActions(@Nullable List<Action> actions) This method is used to specify the actions participating inRulevoidsetConditions(@Nullable List<Condition> conditions) This method is used to specify the conditions participating inRule.voidsetConfiguration(@Nullable Configuration ruleConfiguration) This method is used to specify theRule'sConfiguration.voidsetConfigurationDescriptions(@Nullable List<ConfigDescriptionParameter> configDescriptions) This method is used to describe withConfigDescriptionParameters the meta info for configuration properties of theRule.voidsetDescription(@Nullable String ruleDescription) This method is used to specify human-readable description of the purpose and consequences of theRule's execution.voidThis method is used to specify theRule's human-readable name.voidThis method is used to specify theRule's assigned tags.voidsetTemplateUID(@Nullable String templateUID) This method is used to specify theRuleTemplateidentifier of the template that will be used to by theRuleRegistryto resolve theRule: to validate theRule's configuration, as well as to create and configure theRule's modules.voidsetTriggers(@Nullable List<Trigger> triggers) This method is used to specify the triggers participating inRulevoidsetVisibility(@Nullable Visibility visibility) This method is used to specify theRule'sVisibility.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.automation.Rule
getModule, getTemplateStateMethods inherited from interface org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleRuleActionHandler
execute
-
Field Details
-
triggers
-
conditions
-
actions
-
configuration
-
configDescriptions
-
templateUID
-
uid
-
name
-
tags
-
visibility
-
description
-
status
-
-
Constructor Details
-
SimpleRule
public SimpleRule()
-
-
Method Details
-
getUID
Description copied from interface:RuleThis method is used to obtain the identifier of the Rule. It can be specified by theRule's creator, or randomly generated. -
getTemplateUID
Description copied from interface:RuleThis method is used to obtain theRuleTemplateidentifier of the template theRulewas created from. It will be used by theRuleRegistryto resolve theRule: to validate theRule's configuration, as well as to create and configure theRule's modules. If aRulehas not been created from a template, or has been successfully resolved by theRuleRegistry, this method will returnnull.- Specified by:
getTemplateUIDin interfaceRule- Returns:
- the identifier of the
Rule'sRuleTemplate, ornullif theRulehas not been created from a template, or has been successfully resolved by theRuleRegistry.
-
setTemplateUID
This method is used to specify theRuleTemplateidentifier of the template that will be used to by theRuleRegistryto resolve theRule: to validate theRule's configuration, as well as to create and configure theRule's modules. -
getName
Description copied from interface:RuleThis method is used to obtain theRule's human-readable name. -
setName
This method is used to specify theRule's human-readable name.- Parameters:
ruleName- theRule's human-readable name, ornull.
-
getTags
Description copied from interface:RuleThis method is used to obtain theRule's assigned tags. -
setTags
This method is used to specify theRule's assigned tags.- Parameters:
ruleTags- theRule's assigned tags.
-
getDescription
Description copied from interface:RuleThis method is used to obtain the human-readable description of the purpose and consequences of theRule's execution.- Specified by:
getDescriptionin interfaceRule- Returns:
- the
Rule's human-readable description, ornull.
-
setDescription
This method is used to specify human-readable description of the purpose and consequences of theRule's execution.- Parameters:
ruleDescription- theRule's human-readable description, ornull.
-
getVisibility
Description copied from interface:RuleThis method is used to obtain theRule'sVisibility.- Specified by:
getVisibilityin interfaceRule- Returns:
- the
Rule'sVisibilityvalue.
-
setVisibility
This method is used to specify theRule'sVisibility.- Parameters:
visibility- theRule'sVisibilityvalue.
-
getConfiguration
Description copied from interface:RuleThis method is used to obtain theRule'sConfiguration.- Specified by:
getConfigurationin interfaceRule- Returns:
- current configuration values, or an empty
Configuration.
-
setConfiguration
This method is used to specify theRule'sConfiguration.- Parameters:
ruleConfiguration- the new configuration values.
-
getConfigurationDescriptions
Description copied from interface:RuleThis method is used to obtain theListwithConfigDescriptionParameters defining meta info for configuration properties of theRule.- Specified by:
getConfigurationDescriptionsin interfaceRule- Returns:
- a
ListofConfigDescriptionParameters.
-
setConfigurationDescriptions
public void setConfigurationDescriptions(@Nullable List<ConfigDescriptionParameter> configDescriptions) This method is used to describe withConfigDescriptionParameters the meta info for configuration properties of theRule. -
getConditions
Description copied from interface:RuleThis method is used to get the conditions participating inRule.- Specified by:
getConditionsin interfaceRule- Returns:
- a list with the conditions that belong to this
Rule.
-
setConditions
This method is used to specify the conditions participating inRule.- Parameters:
conditions- a list with the conditions that should belong to thisRule.
-
getActions
Description copied from interface:RuleThis method is used to get the actions participating inRule.- Specified by:
getActionsin interfaceRule- Returns:
- a list with the actions that belong to this
Rule.
-
getTriggers
Description copied from interface:RuleThis method is used to get the triggers participating inRule.- Specified by:
getTriggersin interfaceRule- Returns:
- a list with the triggers that belong to this
Rule.
-
setActions
This method is used to specify the actions participating inRule- Parameters:
actions- a list with the actions that should belong to thisRule.
-
setTriggers
This method is used to specify the triggers participating inRule- Parameters:
triggers- a list with the triggers that should belong to thisRule.
-
getModules
Description copied from interface:RuleObtains the modules of theRule.- Specified by:
getModulesin interfaceRule- Returns:
- the modules of the
Ruleor empty list if theRulehas no modules.
-
getModules
-
hashCode
public int hashCode() -
equals
-