Skip to content

Commit fc8d791

Browse files
authored
Semantic Tags: Overload Equipment tag setters for Things (openhab#4713)
* overload tag setter methods * run resolver Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
1 parent 5632e29 commit fc8d791

File tree

17 files changed

+52
-11
lines changed

17 files changed

+52
-11
lines changed

bundles/org.openhab.core.thing/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<artifactId>org.openhab.core.transform</artifactId>
3131
<version>${project.version}</version>
3232
</dependency>
33+
<dependency>
34+
<groupId>org.openhab.core.bundles</groupId>
35+
<artifactId>org.openhab.core.semantics</artifactId>
36+
<version>${project.version}</version>
37+
</dependency>
3338
<dependency>
3439
<groupId>org.openhab.core.bundles</groupId>
3540
<artifactId>org.openhab.core.test</artifactId>

bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/Thing.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.openhab.core.common.registry.Identifiable;
2121
import org.openhab.core.config.core.Configuration;
2222
import org.openhab.core.items.Item;
23+
import org.openhab.core.semantics.SemanticTag;
2324
import org.openhab.core.thing.binding.ThingHandler;
2425

2526
/**
@@ -246,4 +247,6 @@ public interface Thing extends Identifiable<ThingUID> {
246247
* @param semanticEquipmentTag the semantic (equipment) tag or {@code null} if no tag has been configured.
247248
*/
248249
void setSemanticEquipmentTag(@Nullable String semanticEquipmentTag);
250+
251+
void setSemanticEquipmentTag(@Nullable SemanticTag semanticEquipmentTag);
249252
}

bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/BridgeBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.jdt.annotation.NonNullByDefault;
1919
import org.eclipse.jdt.annotation.Nullable;
2020
import org.openhab.core.config.core.Configuration;
21+
import org.openhab.core.semantics.SemanticTag;
2122
import org.openhab.core.thing.Bridge;
2223
import org.openhab.core.thing.Channel;
2324
import org.openhab.core.thing.ChannelUID;
@@ -128,4 +129,9 @@ public BridgeBuilder withLocation(@Nullable String location) {
128129
public BridgeBuilder withSemanticEquipmentTag(@Nullable String semanticEquipmentTag) {
129130
return (BridgeBuilder) super.withSemanticEquipmentTag(semanticEquipmentTag);
130131
}
132+
133+
@Override
134+
public BridgeBuilder withSemanticEquipmentTag(SemanticTag semanticEquipmentTag) {
135+
return withSemanticEquipmentTag(semanticEquipmentTag.getName());
136+
}
131137
}

bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/ThingBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.eclipse.jdt.annotation.NonNullByDefault;
2424
import org.eclipse.jdt.annotation.Nullable;
2525
import org.openhab.core.config.core.Configuration;
26+
import org.openhab.core.semantics.SemanticTag;
2627
import org.openhab.core.thing.Channel;
2728
import org.openhab.core.thing.ChannelUID;
2829
import org.openhab.core.thing.Thing;
@@ -265,6 +266,10 @@ public ThingBuilder withSemanticEquipmentTag(@Nullable String semanticEquipmentT
265266
return this;
266267
}
267268

269+
public ThingBuilder withSemanticEquipmentTag(SemanticTag semanticEquipmentTag) {
270+
return withSemanticEquipmentTag(semanticEquipmentTag.getName());
271+
}
272+
268273
protected Thing populate(ThingImpl thing) {
269274
thing.setLabel(label);
270275
thing.setChannels(channels);

bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.eclipse.jdt.annotation.NonNullByDefault;
2121
import org.eclipse.jdt.annotation.Nullable;
2222
import org.openhab.core.config.core.Configuration;
23+
import org.openhab.core.semantics.SemanticTag;
2324
import org.openhab.core.thing.Channel;
2425
import org.openhab.core.thing.ChannelUID;
2526
import org.openhab.core.thing.Thing;
@@ -299,4 +300,9 @@ public boolean equals(@Nullable Object obj) {
299300
public void setSemanticEquipmentTag(@Nullable String semanticEquipmentTag) {
300301
this.semanticEquipmentTag = semanticEquipmentTag;
301302
}
303+
304+
@Override
305+
public void setSemanticEquipmentTag(@Nullable SemanticTag semanticEquipmentTag) {
306+
setSemanticEquipmentTag(semanticEquipmentTag.getName());
307+
}
302308
}

bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/type/ThingTypeBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import org.eclipse.jdt.annotation.NonNullByDefault;
2020
import org.eclipse.jdt.annotation.Nullable;
21+
import org.openhab.core.semantics.SemanticTag;
2122
import org.openhab.core.thing.ThingTypeUID;
2223

2324
/**
@@ -207,4 +208,8 @@ public ThingTypeBuilder withSemanticEquipmentTag(String semanticEquipmentTag) {
207208
this.semanticEquipmentTag = semanticEquipmentTag;
208209
return this;
209210
}
211+
212+
public ThingTypeBuilder withSemanticEquipmentTag(SemanticTag semanticEquipmentTag) {
213+
return withSemanticEquipmentTag(semanticEquipmentTag.getName());
214+
}
210215
}

itests/org.openhab.core.automation.integration.tests/itest.bndrun

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ Fragment-Host: org.openhab.core.automation
8282
com.fasterxml.jackson.dataformat.jackson-dataformat-yaml;version='[2.18.2,2.18.3)',\
8383
org.yaml.snakeyaml;version='[2.3.0,2.3.1)',\
8484
de.focus_shift.jollyday-core;version='[1.5.0,1.5.1)',\
85-
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)'
85+
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)',\
86+
org.openhab.core.semantics;version='[5.0.0,5.0.1)'

itests/org.openhab.core.automation.module.core.tests/itest.bndrun

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ Fragment-Host: org.openhab.core.automation
8282
com.fasterxml.jackson.dataformat.jackson-dataformat-yaml;version='[2.18.2,2.18.3)',\
8383
org.yaml.snakeyaml;version='[2.3.0,2.3.1)',\
8484
de.focus_shift.jollyday-core;version='[1.5.0,1.5.1)',\
85-
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)'
85+
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)',\
86+
org.openhab.core.semantics;version='[5.0.0,5.0.1)'

itests/org.openhab.core.automation.module.script.tests/itest.bndrun

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ Fragment-Host: org.openhab.core.automation.module.script
7979
com.fasterxml.jackson.dataformat.jackson-dataformat-yaml;version='[2.18.2,2.18.3)',\
8080
org.yaml.snakeyaml;version='[2.3.0,2.3.1)',\
8181
de.focus_shift.jollyday-core;version='[1.5.0,1.5.1)',\
82-
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)'
82+
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)',\
83+
org.openhab.core.semantics;version='[5.0.0,5.0.1)'

itests/org.openhab.core.automation.module.timer.tests/itest.bndrun

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ Fragment-Host: org.openhab.core.automation
8282
com.fasterxml.jackson.dataformat.jackson-dataformat-yaml;version='[2.18.2,2.18.3)',\
8383
org.yaml.snakeyaml;version='[2.3.0,2.3.1)',\
8484
de.focus_shift.jollyday-core;version='[1.5.0,1.5.1)',\
85-
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)'
85+
de.focus_shift.jollyday-jackson;version='[1.5.0,1.5.1)',\
86+
org.openhab.core.semantics;version='[5.0.0,5.0.1)'

0 commit comments

Comments
 (0)