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
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<ConfigDescriptionParameter>
protected Configuration
protected @Nullable String
protected @Nullable String
protected RuleStatusInfo
protected @Nullable String
protected String
protected Visibility
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This 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 theList
withConfigDescriptionParameter
s defining meta info for configuration properties of theRule
.@Nullable String
This 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 String
getName()
This method is used to obtain theRule
's human-readable name.getTags()
This method is used to obtain theRule
's assigned tags.@Nullable String
This method is used to obtain theRuleTemplate
identifier of the template theRule
was 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
.int
hashCode()
void
setActions
(@Nullable List<Action> actions) This method is used to specify the actions participating inRule
void
setConditions
(@Nullable List<Condition> conditions) This method is used to specify the conditions participating inRule
.void
setConfiguration
(@Nullable Configuration ruleConfiguration) This method is used to specify theRule
'sConfiguration
.void
setConfigurationDescriptions
(@Nullable List<ConfigDescriptionParameter> configDescriptions) This method is used to describe withConfigDescriptionParameter
s the meta info for configuration properties of theRule
.void
setDescription
(@Nullable String ruleDescription) This method is used to specify human-readable description of the purpose and consequences of theRule
's execution.void
This method is used to specify theRule
's human-readable name.void
This method is used to specify theRule
's assigned tags.void
setTemplateUID
(@Nullable String templateUID) This method is used to specify theRuleTemplate
identifier of the template that will be used to by theRuleRegistry
to resolve theRule
: to validate theRule
's configuration, as well as to create and configure theRule
's modules.void
setTriggers
(@Nullable List<Trigger> triggers) This method is used to specify the triggers participating inRule
void
setVisibility
(@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, wait
Methods 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:Rule
This 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:Rule
This method is used to obtain theRuleTemplate
identifier of the template theRule
was created from. It will be used by theRuleRegistry
to resolve theRule
: to validate theRule
's configuration, as well as to create and configure theRule
's modules. If aRule
has not been created from a template, or has been successfully resolved by theRuleRegistry
, this method will returnnull
.- Specified by:
getTemplateUID
in interfaceRule
- Returns:
- the identifier of the
Rule
'sRuleTemplate
, ornull
if theRule
has not been created from a template, or has been successfully resolved by theRuleRegistry
.
-
setTemplateUID
This method is used to specify theRuleTemplate
identifier of the template that will be used to by theRuleRegistry
to resolve theRule
: to validate theRule
's configuration, as well as to create and configure theRule
's modules. -
getName
Description copied from interface:Rule
This 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:Rule
This 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:Rule
This method is used to obtain the human-readable description of the purpose and consequences of theRule
's execution.- Specified by:
getDescription
in 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:Rule
This method is used to obtain theRule
'sVisibility
.- Specified by:
getVisibility
in interfaceRule
- Returns:
- the
Rule
'sVisibility
value.
-
setVisibility
This method is used to specify theRule
'sVisibility
.- Parameters:
visibility
- theRule
'sVisibility
value.
-
getConfiguration
Description copied from interface:Rule
This method is used to obtain theRule
'sConfiguration
.- Specified by:
getConfiguration
in 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:Rule
This method is used to obtain theList
withConfigDescriptionParameter
s defining meta info for configuration properties of theRule
.- Specified by:
getConfigurationDescriptions
in interfaceRule
- Returns:
- a
List
ofConfigDescriptionParameter
s.
-
setConfigurationDescriptions
public void setConfigurationDescriptions(@Nullable List<ConfigDescriptionParameter> configDescriptions) This method is used to describe withConfigDescriptionParameter
s the meta info for configuration properties of theRule
. -
getConditions
Description copied from interface:Rule
This method is used to get the conditions participating inRule
.- Specified by:
getConditions
in 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:Rule
This method is used to get the actions participating inRule
.- Specified by:
getActions
in interfaceRule
- Returns:
- a list with the actions that belong to this
Rule
.
-
getTriggers
Description copied from interface:Rule
This method is used to get the triggers participating inRule
.- Specified by:
getTriggers
in 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:Rule
Obtains the modules of theRule
.- Specified by:
getModules
in interfaceRule
- Returns:
- the modules of the
Rule
or empty list if theRule
has no modules.
-
getModules
-
hashCode
public int hashCode() -
equals
-