Make null models declarative no-ops and use boolean map for user group membership#475
Merged
Merged
Conversation
…p membership Null model semantics across all bulk set services (setGroups, setUsers, setDirectories, setApplications, setApplicationLinks) are now declarative: null + existing entity returns it as-is, null + missing entity is a no-op. This makes multi-document YAML config merging work without forcing later documents to re-specify entire models just to reference an entry. UserModel.groups changes from Map<String, GroupModel> to Map<String, Boolean>: true ensures membership, false ensures non-membership, null is a no-op. Avoids duplicating group definitions inside user definitions; group lifecycle is managed only via the top-level groups map. Idempotent in both directions (MembershipAlreadyExistsException and MembershipNotFoundException are swallowed). Single-entity create endpoints (createGroup, addUser) still reject null models since there is no map key to fall back on. Name fallback from map key remains when the model name field is null.
There was a problem hiding this comment.
Pull request overview
This PR updates bulk “set*” operations to treat null models as declarative no-ops (supporting multi-document YAML merges), and refactors UserModel.groups to be a boolean membership map instead of embedding GroupModel definitions inside users.
Changes:
- Make bulk setters treat
nullmodels as: existing entity → return as-is; missing entity → no-op/skip. - Change
UserModel.groupsfromMap<String, GroupModel>toMap<String, Boolean>and implement idempotent add/remove membership behavior. - Add/adjust tests for the new declarative null semantics and boolean group membership semantics.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| jira/Models/UserModel.md | Updates generated model docs for UserModel.groups type. |
| crowd/Models/UserModel.md | Updates generated model docs for UserModel.groups type. |
| confluence/Models/UserModel.md | Updates generated model docs for UserModel.groups type. |
| commons/src/main/java/com/deftdevs/bootstrapi/commons/model/UserModel.java | Switches groups field to Map<String, Boolean>. |
| crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceImpl.java | Implements declarative null behavior for bulk user setting and boolean-based group membership management. |
| crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/GroupsServiceImpl.java | Implements declarative null behavior for group set operations and map-key name fallback. |
| crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/ApplicationsServiceImpl.java | Implements declarative null behavior for bulk application setting and map-key name fallback. |
| commons/src/main/java/com/deftdevs/bootstrapi/commons/service/AbstractDirectoriesService.java | Implements declarative null behavior for bulk directory setting and map-key name fallback. |
| commons/src/main/java/com/deftdevs/bootstrapi/commons/service/DefaultApplicationLinksServiceImpl.java | Treats null application link models as declarative no-ops and applies name fallback from map key. |
| crowd/src/main/java/com/deftdevs/bootstrapi/crowd/config/ServiceConfig.java | Updates wiring for UsersServiceImpl constructor signature change. |
| crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceTest.java | Updates/extends tests for null-model semantics and boolean group membership behavior. |
| crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/GroupsServiceTest.java | Adds tests for null-model semantics and map-key name fallback; updates for new createGroup overload. |
| crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/DirectoriesServiceTest.java | Adds tests for null-model semantics and map-key name fallback in bulk directory setting. |
| crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/ApplicationsServiceTest.java | Adds tests for null-model semantics and map-key name fallback in bulk application setting. |
| commons/src/test/java/com/deftdevs/bootstrapi/commons/service/DefaultApplicationLinkServiceTest.java | Adds tests for null-model semantics and map-key name fallback in bulk application link setting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Null model semantics across all bulk set services (setGroups, setUsers, setDirectories, setApplications, setApplicationLinks) are now declarative: null + existing entity returns it as-is, null + missing entity is a no-op. This makes multi-document YAML config merging work without forcing later documents to re-specify entire models just to reference an entry.
UserModel.groups changes from Map<String, GroupModel> to Map<String, Boolean>: true ensures membership, false ensures non-membership, null is a no-op. Avoids duplicating group definitions inside user definitions; group lifecycle is managed only via the top-level groups map. Idempotent in both directions (MembershipAlreadyExistsException and MembershipNotFoundException are swallowed).
Single-entity create endpoints (createGroup, addUser) still reject null models since there is no map key to fall back on. Name fallback from map key remains when the model name field is null.