@@ -24,7 +24,8 @@ public class GroupService {
24
24
GitLabService gitLabService ;
25
25
26
26
// get a group
27
- public Optional <Group > getGitLabGroupByName (String name ) throws UnexpectedGitLabResponseException {
27
+ public Optional <Group > getGitLabGroupByName (String name , Integer parentId )
28
+ throws UnexpectedGitLabResponseException {
28
29
29
30
Optional <Group > optional = Optional .empty ();
30
31
@@ -35,8 +36,8 @@ public Optional<Group> getGitLabGroupByName(String name) throws UnexpectedGitLab
35
36
}
36
37
37
38
// look for a match between returned name and provided path
38
- for (Group group : groupList ) {
39
- if (name .equals (group .getPath ())) {
39
+ for (Group group : groupList ) {
40
+ if (name .equals (group .getPath ()) && parentId . equals ( group . getParentId ())) {
40
41
return Optional .of (group );
41
42
}
42
43
}
@@ -45,15 +46,16 @@ public Optional<Group> getGitLabGroupByName(String name) throws UnexpectedGitLab
45
46
46
47
}
47
48
48
- public List <Group > getAllGroups (Integer engagementRepositoryId ) {
49
+ public List <Group > getAllGroups (Integer engagementRepositoryId ) {
49
50
50
- //FIRST LEVEL
51
+ // FIRST LEVEL
51
52
List <Group > customerGroups = gitLabService .getSubGroups (engagementRepositoryId );
52
53
53
54
List <Group > customerEngagementGroups = new ArrayList <>();
54
- customerGroups .stream ().forEach (group -> customerEngagementGroups .addAll (gitLabService .getSubGroups (group .getId ())));
55
+ customerGroups .stream ()
56
+ .forEach (group -> customerEngagementGroups .addAll (gitLabService .getSubGroups (group .getId ())));
55
57
56
- if (LOGGER .isDebugEnabled ()) {
58
+ if (LOGGER .isDebugEnabled ()) {
57
59
customerEngagementGroups .stream ().forEach (group -> LOGGER .debug ("Group -> {}" , group .getName ()));
58
60
}
59
61
0 commit comments