Package org.openhab.core.thing.link
Class ItemChannelLinkRegistry
java.lang.Object
org.openhab.core.common.registry.AbstractRegistry<ItemChannelLink,String,ItemChannelLinkProvider>
org.openhab.core.thing.link.AbstractLinkRegistry<ItemChannelLink,ItemChannelLinkProvider>
org.openhab.core.thing.link.ItemChannelLinkRegistry
- All Implemented Interfaces:
ProviderChangeListener<ItemChannelLink>
,Registry<ItemChannelLink,
String>
@NonNullByDefault
public class ItemChannelLinkRegistry
extends AbstractLinkRegistry<ItemChannelLink,ItemChannelLinkProvider>
- Author:
- Dennis Nobel - Initial contribution, Markus Rathgeb - Linked items returns only existing items, Markus Rathgeb - Rewrite collection handling to improve performance
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionItemChannelLinkRegistry
(ThingRegistry thingRegistry, ItemRegistry itemRegistry) -
Method Summary
Modifier and TypeMethodDescriptiongetBoundChannels
(String itemName) Returns a set of bound channels for the given item name.getBoundThings
(String itemName) Returns a set of bound things for the given item name.getLinkedItemNames
(UID uid) Returns the item names, which are bound to the given UID.getLinkedItems
(UID uid) Returns a set of bound items for the given channel UID.Get all orphan links (item or channel missing)protected void
protected void
protected void
notifyListenersAboutUpdatedElement
(ItemChannelLink oldElement, ItemChannelLink element) int
purge()
Remove all orphaned (item or channel missing) links that are editableint
removeLinksForItem
(String itemName) Remove all links related to an itemint
removeLinksForThing
(ThingUID thingUID) Remove all links related to a thingprotected void
setEventPublisher
(EventPublisher eventPublisher) protected void
protected void
setReadyService
(ReadyService readyService) protected void
unsetEventPublisher
(EventPublisher eventPublisher) protected void
protected void
unsetReadyService
(ReadyService readyService) Methods inherited from class org.openhab.core.thing.link.AbstractLinkRegistry
getLinks, getLinks, isLinked, isLinked, isLinked, onAddElement, onRemoveElement, onUpdateElement
Methods inherited from class org.openhab.core.common.registry.AbstractRegistry
activate, add, added, addProvider, addRegistryChangeListener, beforeUpdateElement, deactivate, forEach, forEach, forEach, get, getAll, getEventPublisher, getManagedProvider, getProvider, getProvider, getValueAndProvider, notifyListeners, notifyListeners, postEvent, remove, removed, removeProvider, removeRegistryChangeListener, setManagedProvider, stream, unsetManagedProvider, update, updated, waitForCompletedAsyncActivationTasks
-
Constructor Details
-
ItemChannelLinkRegistry
-
-
Method Details
-
getBoundChannels
Returns a set of bound channels for the given item name.- Parameters:
itemName
- item name- Returns:
- an unmodifiable set of bound channels for the given item name
-
getLinkedItemNames
Description copied from class:AbstractLinkRegistry
Returns the item names, which are bound to the given UID.- Overrides:
getLinkedItemNames
in classAbstractLinkRegistry<ItemChannelLink,
ItemChannelLinkProvider> - Parameters:
uid
- UID- Returns:
- a non-null unmodifiable collection of item names that are linked to the given UID.
-
getLinkedItems
Returns a set of bound items for the given channel UID.- Parameters:
uid
- channel UID- Returns:
- an unmodifiable set of bound items for the given channel UID
-
getBoundThings
Returns a set of bound things for the given item name.- Parameters:
itemName
- item name- Returns:
- an unmodifiable set of bound things for the given item name
-
setManagedProvider
-
unsetManagedProvider
-
setEventPublisher
- Overrides:
setEventPublisher
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
setReadyService
- Overrides:
setReadyService
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
unsetReadyService
- Overrides:
unsetReadyService
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
unsetEventPublisher
- Overrides:
unsetEventPublisher
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
removeLinksForThing
Remove all links related to a thing- Parameters:
thingUID
- the UID of the thing- Returns:
- the number of removed links
-
removeLinksForItem
Remove all links related to an item- Parameters:
itemName
- the name of the item- Returns:
- the number of removed links
-
purge
public int purge()Remove all orphaned (item or channel missing) links that are editable- Returns:
- the number of removed links
- See Also:
-
getOrphanLinks
Get all orphan links (item or channel missing)- Returns:
- a map with orphan links as key and reason they are broken as value
- See Also:
-
notifyListenersAboutAddedElement
- Overrides:
notifyListenersAboutAddedElement
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
notifyListenersAboutRemovedElement
- Overrides:
notifyListenersAboutRemovedElement
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-
notifyListenersAboutUpdatedElement
protected void notifyListenersAboutUpdatedElement(ItemChannelLink oldElement, ItemChannelLink element) - Overrides:
notifyListenersAboutUpdatedElement
in classAbstractRegistry<ItemChannelLink,
String, ItemChannelLinkProvider>
-