diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/StateProfileTypeImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/StateProfileTypeImpl.java index af7b4433b95..cccac549723 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/StateProfileTypeImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/StateProfileTypeImpl.java @@ -18,6 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.thing.profiles.ProfileTypeUID; import org.openhab.core.thing.profiles.StateProfileType; +import org.openhab.core.thing.type.ChannelTypeUID; /** * Default implementation of a {@link StateProfileType}. @@ -31,13 +32,15 @@ public class StateProfileTypeImpl implements StateProfileType { private final String label; private final Collection supportedItemTypes; private final Collection supportedItemTypesOfChannel; + private final Collection supportedChannelTypeUIDs; public StateProfileTypeImpl(ProfileTypeUID profileTypeUID, String label, Collection supportedItemTypes, - Collection supportedItemTypesOfChannel) { + Collection supportedItemTypesOfChannel, Collection supportedChannelTypeUIDs) { this.profileTypeUID = profileTypeUID; this.label = label; this.supportedItemTypes = Collections.unmodifiableCollection(supportedItemTypes); this.supportedItemTypesOfChannel = Collections.unmodifiableCollection(supportedItemTypesOfChannel); + this.supportedChannelTypeUIDs = Collections.unmodifiableCollection(supportedChannelTypeUIDs); } @Override @@ -45,6 +48,11 @@ public ProfileTypeUID getUID() { return profileTypeUID; } + @Override + public Collection getSupportedChannelTypeUIDs() { + return supportedChannelTypeUIDs; + } + @Override public Collection getSupportedItemTypes() { return supportedItemTypes; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/TriggerProfileTypeImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/TriggerProfileTypeImpl.java index 89b87819063..017ea92fe60 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/TriggerProfileTypeImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/TriggerProfileTypeImpl.java @@ -31,13 +31,15 @@ public class TriggerProfileTypeImpl implements TriggerProfileType { private final ProfileTypeUID profileTypeUID; private final String label; private final Collection supportedItemTypes; + private final Collection supportedItemTypesOfChannel; private final Collection supportedChannelTypeUIDs; public TriggerProfileTypeImpl(ProfileTypeUID profileTypeUID, String label, Collection supportedItemTypes, - Collection supportedChannelTypeUIDs) { + Collection supportedItemTypesOfChannel, Collection supportedChannelTypeUIDs) { this.profileTypeUID = profileTypeUID; this.label = label; this.supportedItemTypes = Collections.unmodifiableCollection(supportedItemTypes); + this.supportedItemTypesOfChannel = Collections.unmodifiableCollection(supportedItemTypesOfChannel); this.supportedChannelTypeUIDs = Collections.unmodifiableCollection(supportedChannelTypeUIDs); } @@ -60,4 +62,9 @@ public String getLabel() { public ProfileTypeUID getUID() { return profileTypeUID; } + + @Override + public Collection getSupportedItemTypesOfChannel() { + return supportedItemTypesOfChannel; + } } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileType.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileType.java index 00619458f8a..a8a90622b22 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileType.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileType.java @@ -16,6 +16,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.common.registry.Identifiable; +import org.openhab.core.thing.type.ChannelTypeUID; /** * Describes a profile type. @@ -31,6 +32,19 @@ public interface ProfileType extends Identifiable { */ Collection getSupportedItemTypes(); + /** + * Get a collection of ItemType names that a Channel needs to support in order to able to use this ProfileType + * + * @return a collection of supported ItemType names (an empty list means ALL types are supported) + */ + Collection getSupportedItemTypesOfChannel(); + + /** + * + * @return a collection of ChannelTypeUIDs (may be empty if all are supported). + */ + Collection getSupportedChannelTypeUIDs(); + /** * Get a human readable description. * diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileTypeBuilder.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileTypeBuilder.java index b8e4fd1767f..3a6d04b53aa 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileTypeBuilder.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/ProfileTypeBuilder.java @@ -64,7 +64,7 @@ public static ProfileTypeBuilder newState(ProfileTypeUID profi return new ProfileTypeBuilder<>(profileTypeUID, label, (leProfileTypeUID, leLabel, leSupportedItemTypes, leSupportedItemTypesOfChannel, leSupportedChannelTypeUIDs) -> new StateProfileTypeImpl(leProfileTypeUID, leLabel, - leSupportedItemTypes, leSupportedItemTypesOfChannel)); + leSupportedItemTypes, leSupportedItemTypesOfChannel, leSupportedChannelTypeUIDs)); } /** @@ -78,7 +78,7 @@ public static ProfileTypeBuilder newTrigger(ProfileTypeUID p return new ProfileTypeBuilder<>(profileTypeUID, label, (leProfileTypeUID, leLabel, leSupportedItemTypes, leSupportedItemTypesOfChannel, leSupportedChannelTypeUIDs) -> new TriggerProfileTypeImpl(leProfileTypeUID, leLabel, - leSupportedItemTypes, leSupportedChannelTypeUIDs)); + leSupportedItemTypes, leSupportedItemTypesOfChannel, leSupportedChannelTypeUIDs)); } /** diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/StateProfileType.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/StateProfileType.java index 5ef1c501140..a3989bae1ec 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/StateProfileType.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/StateProfileType.java @@ -12,8 +12,6 @@ */ package org.openhab.core.thing.profiles; -import java.util.Collection; - import org.eclipse.jdt.annotation.NonNullByDefault; /** @@ -24,11 +22,4 @@ */ @NonNullByDefault public interface StateProfileType extends ProfileType { - - /** - * Get a collection of ItemType names that a Channel needs to support in order to able to use this ProfileType - * - * @return a collection of supported ItemType names (an empty list means ALL types are supported) - */ - Collection getSupportedItemTypesOfChannel(); } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/TriggerProfileType.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/TriggerProfileType.java index e0f3b2d9dcf..17d1cd1f826 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/TriggerProfileType.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/profiles/TriggerProfileType.java @@ -12,10 +12,7 @@ */ package org.openhab.core.thing.profiles; -import java.util.Collection; - import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.thing.type.ChannelTypeUID; /** * Describes a {@link TriggerProfile} type. @@ -24,10 +21,4 @@ */ @NonNullByDefault public interface TriggerProfileType extends ProfileType { - - /** - * - * @return a collection of ChannelTypeUIDs (may be empty if all are supported). - */ - Collection getSupportedChannelTypeUIDs(); }