Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
91915182
Commit
91915182
authored
11 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-1001: dedup the list of groups in the user import worklow
parent
bb18535c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/admin/user/groups/GroupSearchController.java
+12
-4
12 additions, 4 deletions
...ava/org/olat/admin/user/groups/GroupSearchController.java
with
12 additions
and
4 deletions
src/main/java/org/olat/admin/user/groups/GroupSearchController.java
+
12
−
4
View file @
91915182
...
@@ -21,8 +21,10 @@ package org.olat.admin.user.groups;
...
@@ -21,8 +21,10 @@ package org.olat.admin.user.groups;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
org.olat.core.CoreSpringFactory
;
import
org.olat.core.CoreSpringFactory
;
import
org.olat.core.commons.persistence.PersistenceHelper
;
import
org.olat.core.commons.persistence.PersistenceHelper
;
...
@@ -196,13 +198,14 @@ public class GroupSearchController extends StepFormBasicController {
...
@@ -196,13 +198,14 @@ public class GroupSearchController extends StepFormBasicController {
if
(
StringHelper
.
containsNonWhitespace
(
searchValue
))
{
if
(
StringHelper
.
containsNonWhitespace
(
searchValue
))
{
SearchBusinessGroupParams
param1s
=
new
SearchBusinessGroupParams
();
SearchBusinessGroupParams
param1s
=
new
SearchBusinessGroupParams
();
param1s
.
setNameOrDesc
(
searchValue
);
param1s
.
setNameOrDesc
(
searchValue
);
Set
<
BusinessGroup
>
dedupGroups
=
new
HashSet
<>();
List
<
BusinessGroup
>
group1s
=
businessGroupService
.
findBusinessGroups
(
param1s
,
null
,
0
,
-
1
);
List
<
BusinessGroup
>
group1s
=
businessGroupService
.
findBusinessGroups
(
param1s
,
null
,
0
,
-
1
);
filterGroups
(
group1s
);
filterGroups
(
group1s
,
dedupGroups
);
SearchBusinessGroupParams
param2s
=
new
SearchBusinessGroupParams
();
SearchBusinessGroupParams
param2s
=
new
SearchBusinessGroupParams
();
param2s
.
setCourseTitle
(
searchValue
);
param2s
.
setCourseTitle
(
searchValue
);
List
<
BusinessGroup
>
group2s
=
businessGroupService
.
findBusinessGroups
(
param2s
,
null
,
0
,
-
1
);
List
<
BusinessGroup
>
group2s
=
businessGroupService
.
findBusinessGroups
(
param2s
,
null
,
0
,
-
1
);
filterGroups
(
group2s
);
filterGroups
(
group2s
,
dedupGroups
);
List
<
BusinessGroup
>
groups
=
new
ArrayList
<
BusinessGroup
>(
group1s
.
size
()
+
group2s
.
size
());
List
<
BusinessGroup
>
groups
=
new
ArrayList
<
BusinessGroup
>(
group1s
.
size
()
+
group2s
.
size
());
groups
.
addAll
(
group1s
);
groups
.
addAll
(
group1s
);
...
@@ -233,10 +236,15 @@ public class GroupSearchController extends StepFormBasicController {
...
@@ -233,10 +236,15 @@ public class GroupSearchController extends StepFormBasicController {
}
}
}
}
private
void
filterGroups
(
List
<
BusinessGroup
>
groups
)
{
private
void
filterGroups
(
List
<
BusinessGroup
>
groups
,
Set
<
BusinessGroup
>
dedupGroups
)
{
for
(
Iterator
<
BusinessGroup
>
groupIt
=
groups
.
iterator
();
groupIt
.
hasNext
();
)
{
for
(
Iterator
<
BusinessGroup
>
groupIt
=
groups
.
iterator
();
groupIt
.
hasNext
();
)
{
if
(
BusinessGroupManagedFlag
.
isManaged
(
groupIt
.
next
(),
BusinessGroupManagedFlag
.
membersmanagement
))
{
BusinessGroup
group
=
groupIt
.
next
();
if
(
BusinessGroupManagedFlag
.
isManaged
(
group
,
BusinessGroupManagedFlag
.
membersmanagement
))
{
groupIt
.
remove
();
groupIt
.
remove
();
}
else
if
(
dedupGroups
.
contains
(
group
))
{
groupIt
.
remove
();
}
else
{
dedupGroups
.
add
(
group
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment