Skip to content

Commit

Permalink
openhab#363: Passing through the templateUid but only when it's set a…
Browse files Browse the repository at this point in the history
…nd differs from the rules Uid
  • Loading branch information
ThaDaVos committed Jul 24, 2024
1 parent f502e9d commit 027958b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public Rule addRule(Rule element) {
}

public Rule addUnmanagedRule(Rule element) {
RuleBuilder builder = RuleBuilder.create(element.getUID());
String ruleUid = element.getUID();
RuleBuilder builder = RuleBuilder.create(ruleUid);

String name = element.getName();
if (name == null || name.isEmpty()) {
Expand All @@ -126,6 +127,11 @@ public Rule addUnmanagedRule(Rule element) {

builder.withName(name).withDescription(element.getDescription()).withTags(element.getTags());

String templateUid = element.getTemplateUID();
if (templateUid.isEmpty() == false && ruleUid.equals(templateUid) == false) {
builder.withTemplateUID(templateUid);
}

// used for numbering the modules of the rule
int moduleIndex = 1;

Expand Down

0 comments on commit 027958b

Please sign in to comment.