@@ -41,7 +41,8 @@ public AccountScaffoldFacade(
4141
4242 /**
4343 * Get all super groups that have the provided types and their "sub" groups with their members.
44- * For groups that require managed accounts, only users that have participated in gdpr training are included.
44+ * For groups that require managed accounts, only users that have participated in gdpr training
45+ * are included.
4546 */
4647 public List <AccountScaffoldSuperGroupDTO > getActiveSuperGroups () {
4748 this .accessGuard .require (isApi (ApiKeyType .ACCOUNT_SCAFFOLD ));
@@ -63,9 +64,10 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
6364 group -> {
6465 List <AccountScaffoldUserPostDTO > activeGroupMember =
6566 group .groupMembers ().stream ()
66- .filter (groupMember ->
67- gdprTrained .contains (groupMember .user ().id ()) ||
68- !isGroupWithManagedAccounts (group , settings ))
67+ .filter (
68+ groupMember ->
69+ gdprTrained .contains (groupMember .user ().id ())
70+ || !isGroupWithManagedAccounts (group , settings ))
6971 .map (AccountScaffoldUserPostDTO ::new )
7072 .toList ();
7173
@@ -74,9 +76,15 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
7476 superGroupMap .put (
7577 superGroupId ,
7678 new SuperGroupWithGroups (
77- group .superGroup (), new ArrayList <>(List .of (new GroupWithMembers (group , new HashSet <>(activeGroupMember ))))));
79+ group .superGroup (),
80+ new ArrayList <>(
81+ List .of (
82+ new GroupWithMembers (group , new HashSet <>(activeGroupMember ))))));
7883 } else {
79- superGroupMap .get (superGroupId ).groups .add (new GroupWithMembers (group , new HashSet <>(activeGroupMember )));
84+ superGroupMap
85+ .get (superGroupId )
86+ .groups
87+ .add (new GroupWithMembers (group , new HashSet <>(activeGroupMember )));
8088 }
8189 });
8290
@@ -85,7 +93,12 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
8593 superGroupWithGroups ->
8694 new AccountScaffoldSuperGroupDTO (
8795 superGroupWithGroups .superGroup ,
88- superGroupWithGroups .groups .stream ().map (group -> new AccountScaffoldGroupDTO (group .group , new ArrayList <>(group .members ))).toList (),
96+ superGroupWithGroups .groups .stream ()
97+ .map (
98+ group ->
99+ new AccountScaffoldGroupDTO (
100+ group .group , new ArrayList <>(group .members )))
101+ .toList (),
89102 settings .superGroupTypes ().stream ()
90103 .anyMatch (
91104 row ->
@@ -96,8 +109,8 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
96109
97110 /**
98111 * Returns the users that are active right now. Takes in a list of super group types to help
99- * determine what kinds of groups that are deemed active. User must have
100- * participated in gdpr training.
112+ * determine what kinds of groups that are deemed active. User must have participated in gdpr
113+ * training.
101114 */
102115 public List <AccountScaffoldUserDTO > getActiveUsers () {
103116 this .accessGuard .require (isApi (ApiKeyType .ACCOUNT_SCAFFOLD ));
@@ -152,19 +165,9 @@ public AccountScaffoldUserDTO(GammaUser user) {
152165 }
153166
154167 public record AccountScaffoldGroupDTO (
155- String name ,
156- String prettyName ,
157- List <AccountScaffoldUserPostDTO > members
158- ) {
159- public AccountScaffoldGroupDTO (
160- Group group ,
161- List <AccountScaffoldUserPostDTO > members
162- ) {
163- this (
164- group .name ().value (),
165- group .prettyName ().value (),
166- members
167- );
168+ String name , String prettyName , List <AccountScaffoldUserPostDTO > members ) {
169+ public AccountScaffoldGroupDTO (Group group , List <AccountScaffoldUserPostDTO > members ) {
170+ this (group .name ().value (), group .prettyName ().value (), members );
168171 }
169172 }
170173
@@ -175,9 +178,7 @@ public record AccountScaffoldSuperGroupDTO(
175178 List <AccountScaffoldGroupDTO > groups ,
176179 boolean useManagedAccount ) {
177180 public AccountScaffoldSuperGroupDTO (
178- SuperGroup superGroup ,
179- List <AccountScaffoldGroupDTO > groups ,
180- boolean useManagedAccount ) {
181+ SuperGroup superGroup , List <AccountScaffoldGroupDTO > groups , boolean useManagedAccount ) {
181182 this (
182183 superGroup .name ().value (),
183184 superGroup .prettyName ().value (),
@@ -187,7 +188,6 @@ public AccountScaffoldSuperGroupDTO(
187188 }
188189 }
189190
190-
191191 private static class GroupWithMembers {
192192 private final Group group ;
193193 private final Set <AccountScaffoldUserPostDTO > members ;
@@ -210,11 +210,6 @@ private SuperGroupWithGroups(SuperGroup superGroup, List<GroupWithMembers> group
210210
211211 private boolean isGroupWithManagedAccounts (Group group , ApiKeyAccountScaffoldSettings settings ) {
212212 return settings .superGroupTypes ().stream ()
213- .anyMatch (
214- row ->
215- row .type ().equals (group .superGroup ().type ())
216- && row .requiresManaged ());
213+ .anyMatch (row -> row .type ().equals (group .superGroup ().type ()) && row .requiresManaged ());
217214 }
218-
219-
220215}
0 commit comments