Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update semantic metadata of group members when groups are added/removed #2884

Merged
merged 2 commits into from
Apr 3, 2022

Conversation

wborn
Copy link
Member

@wborn wborn commented Mar 30, 2022

This fixes the issue that the semantic metadata is incorrect when defining group member items in files and their groups in the UI.

Fixes #2106
Fixes #2117

This fixes the issue that the semantic metadata is incorrect when defining items in files and groups in the UI.

Fixes openhab#2117

Signed-off-by: Wouter Born <github@maindrain.net>
@wborn wborn added the bug An unexpected problem or unintended behavior of the Core label Mar 30, 2022
@wborn wborn requested a review from a team as a code owner March 30, 2022 18:28
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/file-based-items-and-ui-defined-groups-not-playing-nicely/134609/21

@wborn
Copy link
Member Author

wborn commented Apr 2, 2022

Maybe you have some time to review this small bugfix so it makes it into the next milestone @openhab/core-maintainers?

@@ -82,10 +82,10 @@ public SemanticsMetadataProvider(final @Reference ItemRegistry itemRegistry) {
@Activate
protected void activate() {
initRelations();
itemRegistry.addRegistryChangeListener(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is moving this line up here really needed? Listening to changes should happen only after the initial item set is processed and it should be made sure that those calls only come in once the service is activated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it because without this change there is a chance that it will not receive changes when the thread gets suspended while processing all the items.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iirc, we are using this pattern at many places.
To be really clean, we should then have a marker that the component is not yet activated and queue the listener changes to have them processed at a later moment. Because otherwise, it could also happen that you process a change before the activate method processed its older state. That would make the overall code pretty complex, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved it back. Let's fix this when it really becomes an issue. 😉

Signed-off-by: Wouter Born <github@maindrain.net>
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

@kaikreuzer kaikreuzer merged commit b5de891 into openhab:main Apr 3, 2022
@kaikreuzer kaikreuzer added this to the 3.3 milestone Apr 3, 2022
@wborn wborn deleted the fix-semantics branch April 3, 2022 09:58
wborn added a commit that referenced this pull request Apr 6, 2022
…ed (#2884)

* Update semantic metadata of group members when groups are added/removed

This fixes the issue that the semantic metadata is incorrect when defining items in files and groups in the UI.

Fixes #2117
@wborn wborn added the patch A PR that has been cherry-picked to a patch release branch label Apr 6, 2022
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
…ed (openhab#2884)

* Update semantic metadata of group members when groups are added/removed

This fixes the issue that the semantic metadata is incorrect when defining items in files and groups in the UI.

Fixes openhab#2117

GitOrigin-RevId: b5de891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
3 participants