Class RuleTemplate
java.lang.Object
org.openhab.core.automation.template.RuleTemplate
- All Implemented Interfaces:
Template
,Identifiable<String>
This class is used to define
Rule Templates
which are shared combination of ready to use modules, which can
be configured to produce Rule
instances.
The RuleTemplate
s can be used by any creator of Rules, but they can be modified only by its creator. The
template modification is done by updating the RuleTemplate
.
Templates can have tags
- non-hierarchical keywords or terms for describing them.
- Author:
- Yordan Mihaylov - Initial contribution, Ana Dimova - Initial contribution, Vasil Ilchev - Initial contribution, Markus Rathgeb - Add default constructor for deserialization
-
Constructor Summary
ConstructorDescriptionRuleTemplate
(@Nullable String uid, @Nullable String label, @Nullable String description, @Nullable Set<String> tags, @Nullable List<Trigger> triggers, @Nullable List<Condition> conditions, @Nullable List<Action> actions, @Nullable List<ConfigDescriptionParameter> configDescriptions, @Nullable Visibility visibility) Creates aRuleTemplate
instance that will be used for creatingRule
s from a set of modules, belong to the template. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two objects are equal if they own equal UIDs.Gets the actions participating inRuleTemplate
.Gets the conditions participating inRuleTemplate
.Gets theList
withConfigDescriptionParameter
s defining meta info for configuration properties of the futureRule
instances.@Nullable String
Gets the human-readable description of the purpose of theRuleTemplate
.@Nullable String
getLabel()
Gets theRuleTemplate
's human-readable label.@Nullable Module
Gets aModule
participating in theRuleTemplate
.getModules
(Class<T> moduleClazz) Gets the modules of theRuleTemplate
, corresponding to the specified class.getTags()
Gets theRuleTemplate
's assigned tags.Gets the triggers participating inRuleTemplate
.getUID()
Gets the unique identifier of theRuleTemplate
.Gets theRuleTemplate
'sVisibility
.int
hashCode()
Returns the hash code of this object depends on the hash code of the UID that it owns.
-
Constructor Details
-
RuleTemplate
public RuleTemplate(@Nullable String uid, @Nullable String label, @Nullable String description, @Nullable Set<String> tags, @Nullable List<Trigger> triggers, @Nullable List<Condition> conditions, @Nullable List<Action> actions, @Nullable List<ConfigDescriptionParameter> configDescriptions, @Nullable Visibility visibility) Creates aRuleTemplate
instance that will be used for creatingRule
s from a set of modules, belong to the template. Whennull
is passed for theuid
parameter, theRuleTemplate
's identifier will be randomly generated.- Parameters:
uid
- theRuleTemplate
's identifier, ornull
if a random identifier should be generated.label
- the short human-readableRuleTemplate
's label.description
- a detailed human-readableRuleTemplate
's description.tags
- theRuleTemplate
's assigned tags.triggers
- theRuleTemplate
's triggers list, ornull
if theRuleTemplate
should have no triggers.conditions
- theRuleTemplate
's conditions list, ornull
if theRuleTemplate
should have no conditions.actions
- theRuleTemplate
's actions list, ornull
if theRuleTemplate
should have no actions.configDescriptions
- describing meta-data for the configuration of the futureRule
instances.visibility
- theRuleTemplate
's visibility.
-
-
Method Details
-
getUID
Gets the unique identifier of theRuleTemplate
. It can be specified by theRuleTemplate
's creator, or randomly generated.- Specified by:
getUID
in interfaceIdentifiable<String>
- Specified by:
getUID
in interfaceTemplate
- Returns:
- an identifier of this
RuleTemplate
. Can't benull
.
-
getTags
Gets theRuleTemplate
's assigned tags.- Specified by:
getTags
in interfaceTemplate
- Returns:
- the
RuleTemplate
's assigned tags.
-
getLabel
Gets theRuleTemplate
's human-readable label.- Specified by:
getLabel
in interfaceTemplate
- Returns:
- the
RuleTemplate
's human-readable label, ornull
if not specified.
-
getDescription
Gets the human-readable description of the purpose of theRuleTemplate
.- Specified by:
getDescription
in interfaceTemplate
- Returns:
- the
RuleTemplate
's human-readable description, ornull
.
-
getVisibility
Gets theRuleTemplate
'sVisibility
.- Specified by:
getVisibility
in interfaceTemplate
- Returns:
- the
RuleTemplate
'sVisibility
value.
-
getConfigurationDescriptions
Gets theList
withConfigDescriptionParameter
s defining meta info for configuration properties of the futureRule
instances.- Returns:
- a
List
ofConfigDescriptionParameter
s.
-
getModule
Gets aModule
participating in theRuleTemplate
.- Parameters:
moduleId
- unique identifier of a module in thisRuleTemplate
.- Returns:
- module with specified identifier or
null
when such does not exist.
-
getModules
Gets the modules of theRuleTemplate
, corresponding to the specified class.- Parameters:
moduleClazz
- defines the class of the looking modules. It can beModule
,Trigger
,Condition
orAction
.- Returns:
- the modules of defined type or empty list if the
RuleTemplate
has no modules that belong to the specified type.
-
getTriggers
Gets the triggers participating inRuleTemplate
.- Returns:
- a list with the triggers that belong to this
RuleTemplate
.
-
getConditions
Gets the conditions participating inRuleTemplate
.- Returns:
- a list with the conditions that belong to this
RuleTemplate
.
-
getActions
Gets the actions participating inRuleTemplate
.- Returns:
- a list with the actions that belong to this
RuleTemplate
.
-
hashCode
public int hashCode()Returns the hash code of this object depends on the hash code of the UID that it owns. -
equals
Two objects are equal if they own equal UIDs.
-