Skip to content

Make null models declarative no-ops and use boolean map for user group membership#475

Merged
pathob merged 1 commit into
mainfrom
feat/declarative-null-and-boolean-group-membership
May 12, 2026
Merged

Make null models declarative no-ops and use boolean map for user group membership#475
pathob merged 1 commit into
mainfrom
feat/declarative-null-and-boolean-group-membership

Conversation

@pathob
Copy link
Copy Markdown
Contributor

@pathob pathob commented May 12, 2026

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.

…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.
@pathob pathob changed the title Make null models declarative no-ops and use boolean map for user grou… Make null models declarative no-ops and use boolean map for user group membership May 12, 2026
@pathob pathob requested a review from Copilot May 12, 2026 16:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 null models as: existing entity → return as-is; missing entity → no-op/skip.
  • Change UserModel.groups from Map<String, GroupModel> to Map<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.

Comment thread crowd/Models/UserModel.md
Comment thread jira/Models/UserModel.md
Comment thread confluence/Models/UserModel.md
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@pathob pathob merged commit d7c8931 into main May 12, 2026
12 of 13 checks passed
@pathob pathob deleted the feat/declarative-null-and-boolean-group-membership branch May 12, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants