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 RuleTemplates 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
ConstructorsConstructorDescriptionRuleTemplate(@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 aRuleTemplateinstance that will be used for creatingRules from a set of modules, belong to the template. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo objects are equal if they own equal UIDs.Gets the actions participating inRuleTemplate.Gets the conditions participating inRuleTemplate.Gets theListwithConfigDescriptionParameters defining meta info for configuration properties of the futureRuleinstances.@Nullable StringGets the human-readable description of the purpose of theRuleTemplate.@Nullable StringgetLabel()Gets theRuleTemplate's human-readable label.@Nullable ModuleGets aModuleparticipating 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.inthashCode()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 aRuleTemplateinstance that will be used for creatingRules from a set of modules, belong to the template. Whennullis passed for theuidparameter, theRuleTemplate's identifier will be randomly generated.- Parameters:
uid- theRuleTemplate's identifier, ornullif 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, ornullif theRuleTemplateshould have no triggers.conditions- theRuleTemplate's conditions list, ornullif theRuleTemplateshould have no conditions.actions- theRuleTemplate's actions list, ornullif theRuleTemplateshould have no actions.configDescriptions- describing meta-data for the configuration of the futureRuleinstances.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:
getUIDin interfaceIdentifiable<String>- Specified by:
getUIDin interfaceTemplate- Returns:
- an identifier of this
RuleTemplate. Can't benull.
-
getTags
Gets theRuleTemplate's assigned tags.- Specified by:
getTagsin interfaceTemplate- Returns:
- the
RuleTemplate's assigned tags.
-
getLabel
Gets theRuleTemplate's human-readable label.- Specified by:
getLabelin interfaceTemplate- Returns:
- the
RuleTemplate's human-readable label, ornullif not specified.
-
getDescription
Gets the human-readable description of the purpose of theRuleTemplate.- Specified by:
getDescriptionin interfaceTemplate- Returns:
- the
RuleTemplate's human-readable description, ornull.
-
getVisibility
Gets theRuleTemplate'sVisibility.- Specified by:
getVisibilityin interfaceTemplate- Returns:
- the
RuleTemplate'sVisibilityvalue.
-
getConfigurationDescriptions
Gets theListwithConfigDescriptionParameters defining meta info for configuration properties of the futureRuleinstances.- Returns:
- a
ListofConfigDescriptionParameters.
-
getModule
Gets aModuleparticipating in theRuleTemplate.- Parameters:
moduleId- unique identifier of a module in thisRuleTemplate.- Returns:
- module with specified identifier or
nullwhen 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,ConditionorAction.- Returns:
- the modules of defined type or empty list if the
RuleTemplatehas 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.
-