From 7e4480142ade62a82c127cbca5b938bd66dcca4f Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Mon, 16 Jul 2012 16:22:27 +0200 Subject: [PATCH] OO-291: fix an issue with the enrollment --- .../PersistingCourseGroupManager.java | 11 +------ .../olat/course/nodes/en/ENRunController.java | 17 +++++----- .../course/nodes/en/EnrollmentManager.java | 31 +++++++++---------- .../org/olat/group/BusinessGroupShort.java | 4 ++- .../org/olat/group/area/BGAreaManager.java | 2 +- .../olat/group/area/BGAreaManagerImpl.java | 18 +++++++---- .../olat/group/manager/BusinessGroupDAO.java | 6 ++-- .../group/model/BusinessGroupShortImpl.java | 14 +++++++++ .../model/SearchBusinessGroupParams.java | 10 +++--- .../BusinessGroupTableModelWithMaxSize.java | 20 +++++------- .../olat/group/ui/main/BGMainController.java | 2 +- .../ui/main/BusinessGroupListController.java | 2 +- .../olat/group/test/BGAreaManagerTest.java | 6 ++-- 13 files changed, 75 insertions(+), 68 deletions(-) diff --git a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java index 946ee2396fc..a91d88db6e3 100644 --- a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java +++ b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java @@ -164,7 +164,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course public boolean existGroup(String nameOrKey) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(); if(StringHelper.isLong(nameOrKey)) { - params.setKeys(Collections.singletonList(new Long(nameOrKey))); + params.setGroupKeys(Collections.singletonList(new Long(nameOrKey))); }else { params.setExactName(nameOrKey); } @@ -180,15 +180,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course return areas; } - /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getBusinessGroupsInArea(java.lang.String) - */ - public List<BusinessGroup> getBusinessGroupsInArea(String areaName) { - List<BGArea> areas = areaManager.findBGAreasInContext(courseResource); - List<BusinessGroup> groups = areaManager.findBusinessGroupsOfAreas(areas); - return groups; - } - @Override public boolean existArea(String nameOrKey) { return areaManager.existArea(nameOrKey, courseResource); diff --git a/src/main/java/org/olat/course/nodes/en/ENRunController.java b/src/main/java/org/olat/course/nodes/en/ENRunController.java index 7e87379ee59..2a444f9729b 100644 --- a/src/main/java/org/olat/course/nodes/en/ENRunController.java +++ b/src/main/java/org/olat/course/nodes/en/ENRunController.java @@ -130,7 +130,7 @@ public class ENRunController extends BasicController implements GenericEventList } enrollableAreaKeys = (List<Long>)moduleConfig.get(ENCourseNode.CONFIG_AREA_IDS); - if(enrollableAreaKeys != null) { + if(enrollableAreaKeys == null) { String areaInitVal = (String) moduleConfig.get(ENCourseNode.CONFIG_AREANAME); enrollableAreaKeys = areaManager.toAreaKeys(areaInitVal, courseGroupManager.getCourseResource()); } @@ -138,7 +138,7 @@ public class ENRunController extends BasicController implements GenericEventList cancelEnrollEnabled = ((Boolean) moduleConfig.get(ENCourseNode.CONF_CANCEL_ENROLL_ENABLED)).booleanValue(); Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity(); - enrolledGroup = enrollmentManager.getBusinessGroupWhereEnrolled(identity, enrollableGroupKeys, enrollableAreaKeys, courseGroupManager); + enrolledGroup = enrollmentManager.getBusinessGroupWhereEnrolled(identity, enrollableGroupKeys, enrollableAreaKeys, courseGroupManager.getCourseResource()); waitingListGroup = enrollmentManager.getBusinessGroupWhereInWaitingList(identity, enrollableGroupKeys, enrollableAreaKeys, courseGroupManager); registerGroupChangedEvents(enrollableGroupKeys, enrollableAreaKeys, ureq.getIdentity()); // Set correct view @@ -231,9 +231,8 @@ public class ENRunController extends BasicController implements GenericEventList if (enrolledGroup != null) { enrollVC.contextPut("isEnrolledView", Boolean.TRUE); enrollVC.contextPut("isWaitingList", Boolean.FALSE); - String desc = this.enrolledGroup.getDescription(); - enrollVC.contextPut("groupName", this.enrolledGroup.getName()); - enrollVC.contextPut("groupDesc", (desc == null) ? "" : this.enrolledGroup.getDescription()); + enrollVC.contextPut("groupName", enrolledGroup.getName()); + enrollVC.contextPut("groupDesc", (enrolledGroup.getDescription() == null) ? "" : enrolledGroup.getDescription()); } else if (waitingListGroup != null){ enrollVC.contextPut("isEnrolledView", Boolean.TRUE); enrollVC.contextPut("isWaitingList", Boolean.TRUE); @@ -291,15 +290,15 @@ public class ENRunController extends BasicController implements GenericEventList /* * Add as listener to BusinessGroups so we are being notified about changes. */ - private void registerGroupChangedEvents(List<Long> enrollableGroupNames, List<Long> enrollableAreaNames, Identity identity) { - List<BusinessGroup> groups = enrollmentManager.loadGroupsFromNames(enrollableGroupNames, enrollableAreaNames, courseGroupManager); + private void registerGroupChangedEvents(List<Long> enrollableGroupKeys, List<Long> enrollableAreaKeys, Identity identity) { + List<BusinessGroup> groups = enrollmentManager.loadGroupsFromNames(enrollableGroupKeys, enrollableAreaKeys, courseGroupManager); for (BusinessGroup group: groups) { CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, identity, group); } } - private void deregisterGroupChangedEvents(List<Long> enrollableGroupNames, List<Long> enrollableAreaNames) { - List<BusinessGroup> groups = enrollmentManager.loadGroupsFromNames(enrollableGroupNames, enrollableAreaNames, courseGroupManager); + private void deregisterGroupChangedEvents(List<Long> enrollableGroupKeys, List<Long> enrollableAreaKeys) { + List<BusinessGroup> groups = enrollmentManager.loadGroupsFromNames(enrollableGroupKeys, enrollableAreaKeys, courseGroupManager); for (BusinessGroup group:groups) { CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, group); } diff --git a/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java b/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java index ebd04d8fedd..28f81dec949 100644 --- a/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java +++ b/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java @@ -46,11 +46,11 @@ import org.olat.course.nodes.ENCourseNode; import org.olat.course.properties.CoursePropertyManager; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; -import org.olat.group.area.BGArea; import org.olat.group.area.BGAreaManager; import org.olat.group.model.SearchBusinessGroupParams; import org.olat.group.ui.BGMailHelper; import org.olat.properties.Property; +import org.olat.resource.OLATResource; import org.olat.testutils.codepoints.server.Codepoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -82,7 +82,7 @@ public class EnrollmentManager extends BasicManager { final EnrollStatus enrollStatus = new EnrollStatus(); if (isLogDebugEnabled()) logDebug("doEnroll"); // check if the user is already enrolled (user can be enrooled only in one group) - if ( ( getBusinessGroupWhereEnrolled( identity, groupKeys, areaKeys, cgm) == null) + if ( ( getBusinessGroupWhereEnrolled( identity, groupKeys, areaKeys, cgm.getCourseResource()) == null) && ( getBusinessGroupWhereInWaitingList( identity, groupKeys, areaKeys, cgm) == null) ) { if (isLogDebugEnabled()) logDebug("Identity is not enrolled identity=" + identity.getName() + " group=" + group.getName()); // 1. Check if group has max size defined. If so check if group is full @@ -198,14 +198,14 @@ public class EnrollmentManager extends BasicManager { * @return BusinessGroup in which the identity is enrolled, null if identity * is nowhere enrolled. */ - protected BusinessGroup getBusinessGroupWhereEnrolled(Identity identity, List<Long> groupKeys, List<Long> areaKeys, CourseGroupManager cgm) { + protected BusinessGroup getBusinessGroupWhereEnrolled(Identity identity, List<Long> groupKeys, List<Long> areaKeys, OLATResource courseResource) { // 1. check in groups if(groupKeys != null && !groupKeys.isEmpty()) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(); params.setAttendee(true); params.setIdentity(identity); - params.setKeys(groupKeys); - List<BusinessGroup> groups = businessGroupService.findBusinessGroups(params, cgm.getCourseResource(), 0, 1); + params.setGroupKeys(groupKeys); + List<BusinessGroup> groups = businessGroupService.findBusinessGroups(params, courseResource, 0, 1); if (groups.size() > 0) { // Usually it is only possible to be in one group. However, // theoretically the @@ -218,18 +218,15 @@ public class EnrollmentManager extends BasicManager { } // 2. check in areas if(areaKeys != null && !areaKeys.isEmpty()) { - List<BGArea> areas = areaManager.loadAreas(areaKeys); - for (BGArea area:areas) { - List<BusinessGroup> groups = areaManager.findBusinessGroupsOfArea(area); - if (groups.size() > 0) { - // Usually it is only possible to be in one group. However, - // theoretically the - // admin can put the user in a second enrollment group or the user could - // theoretically be in a second group context. For now, we only look for - // the first - // group. All groups found after the first one are discarded. - return groups.get(0); - } + List<BusinessGroup> groups = areaManager.findBusinessGroupsOfAreaAttendedBy(identity, areaKeys, courseResource); + if (groups.size() > 0) { + // Usually it is only possible to be in one group. However, + // theoretically the + // admin can put the user in a second enrollment group or the user could + // theoretically be in a second group context. For now, we only look for + // the first + // group. All groups found after the first one are discarded. + return groups.get(0); } } return null; diff --git a/src/main/java/org/olat/group/BusinessGroupShort.java b/src/main/java/org/olat/group/BusinessGroupShort.java index 4133e498c07..f6372026c2e 100644 --- a/src/main/java/org/olat/group/BusinessGroupShort.java +++ b/src/main/java/org/olat/group/BusinessGroupShort.java @@ -1,6 +1,8 @@ package org.olat.group; -public interface BusinessGroupShort { +import org.olat.core.id.OLATResourceable; + +public interface BusinessGroupShort extends OLATResourceable { public Long getKey(); diff --git a/src/main/java/org/olat/group/area/BGAreaManager.java b/src/main/java/org/olat/group/area/BGAreaManager.java index 08da66362c7..f7d04999bc6 100644 --- a/src/main/java/org/olat/group/area/BGAreaManager.java +++ b/src/main/java/org/olat/group/area/BGAreaManager.java @@ -152,7 +152,7 @@ public interface BGAreaManager { * @param context * @return A list of business groups */ - public List<BusinessGroup> findBusinessGroupsOfAreaAttendedBy(Identity identity, String areaName, OLATResource resource); + public List<BusinessGroup> findBusinessGroupsOfAreaAttendedBy(Identity identity, List<Long> areaKeys, OLATResource resource); /** * Searches for all business group areas associated with the given business diff --git a/src/main/java/org/olat/group/area/BGAreaManagerImpl.java b/src/main/java/org/olat/group/area/BGAreaManagerImpl.java index c9ea31f1771..8761315c263 100644 --- a/src/main/java/org/olat/group/area/BGAreaManagerImpl.java +++ b/src/main/java/org/olat/group/area/BGAreaManagerImpl.java @@ -229,7 +229,12 @@ public class BGAreaManagerImpl extends BasicManager implements BGAreaManager { if(areaKeys == null || areaKeys.isEmpty()) return Collections.emptyList(); StringBuilder sb = new StringBuilder(); - sb.append("select distinct bgarel.businessGroup from ").append(BGtoAreaRelationImpl.class.getName()).append(" as bgarel ") + sb.append("select distinct businessGroup from ").append(BGtoAreaRelationImpl.class.getName()).append(" as bgarel ") + .append(" inner join bgarel.businessGroup businessGroup ") + .append(" left join fetch businessGroup.ownerGroup ownerGroup") + .append(" left join fetch businessGroup.partipiciantGroup participantGroup") + .append(" left join fetch businessGroup.waitingGroup waitingGroup") + .append(" left join fetch businessGroup.resource resource") .append(" where bgarel.groupArea.key in (:areaKeys)"); List<BusinessGroup> result = DBFactory.getInstance().getCurrentEntityManager() @@ -243,7 +248,8 @@ public class BGAreaManagerImpl extends BasicManager implements BGAreaManager { * @see org.olat.group.area.BGAreaManager#findBusinessGroupsOfAreaAttendedBy(org.olat.core.id.Identity, * java.lang.String, org.olat.group.context.BGContext) */ - public List<BusinessGroup> findBusinessGroupsOfAreaAttendedBy(Identity identity, String areaName, OLATResource resource) { + @Override + public List<BusinessGroup> findBusinessGroupsOfAreaAttendedBy(Identity identity, List<Long> areaKeys, OLATResource resource) { StringBuilder sb = new StringBuilder(); sb.append("select bgi from ").append(BusinessGroupImpl.class.getName()).append(" as bgi ") .append(", org.olat.basesecurity.SecurityGroupMembershipImpl as sgmi") @@ -252,8 +258,8 @@ public class BGAreaManagerImpl extends BasicManager implements BGAreaManager { .append(" where bgarel.groupArea=area and bgi.partipiciantGroup=sgmi.securityGroup and bgarel.businessGroup=bgi") .append(" and sgmi.identity.key=:identityKey"); - if(StringHelper.containsNonWhitespace(areaName)) { - sb.append(" and area.name=:name"); + if(areaKeys != null && !areaKeys.isEmpty()) { + sb.append(" and area.key in (:areaKeys)"); } if(resource != null) { sb.append(" and area.resource.key=:resourceKey"); @@ -261,8 +267,8 @@ public class BGAreaManagerImpl extends BasicManager implements BGAreaManager { TypedQuery<BusinessGroup> query = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), BusinessGroup.class) .setParameter("identityKey", identity.getKey()); - if(StringHelper.containsNonWhitespace(areaName)) { - query.setParameter("name", areaName); + if(areaKeys != null && !areaKeys.isEmpty()) { + query.setParameter("areaKeys", areaKeys); } if(resource != null) { query.setParameter("resourceKey", resource.getKey()); diff --git a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java index 500cc6ed457..7819cdb1357 100644 --- a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java +++ b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java @@ -459,7 +459,7 @@ public class BusinessGroupDAO { query.append(")"); } - if(params.getKeys() != null && !params.getKeys().isEmpty()) { + if(params.getGroupKeys() != null && !params.getGroupKeys().isEmpty()) { where = where(query, where); query.append("bgi.key in (:groupKeys)"); } @@ -553,8 +553,8 @@ public class BusinessGroupDAO { if(params.isPublicGroup()) { dbq.setParameter("atDate", new Date(), TemporalType.TIMESTAMP); } - if(params.getKeys() != null && !params.getKeys().isEmpty()) { - dbq.setParameter("groupKeys", params.getKeys()); + if(params.getGroupKeys() != null && !params.getGroupKeys().isEmpty()) { + dbq.setParameter("groupKeys", params.getGroupKeys()); } if (resource != null) { diff --git a/src/main/java/org/olat/group/model/BusinessGroupShortImpl.java b/src/main/java/org/olat/group/model/BusinessGroupShortImpl.java index f885afc1753..dbe56d555a0 100644 --- a/src/main/java/org/olat/group/model/BusinessGroupShortImpl.java +++ b/src/main/java/org/olat/group/model/BusinessGroupShortImpl.java @@ -1,6 +1,8 @@ package org.olat.group.model; import org.olat.core.commons.persistence.PersistentObject; +import org.olat.core.util.resource.OresHelper; +import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupShort; /** @@ -25,6 +27,18 @@ public class BusinessGroupShortImpl extends PersistentObject implements Business this.name = name; } + + + @Override + public String getResourceableTypeName() { + return OresHelper.calculateTypeName(BusinessGroup.class); + } + + @Override + public Long getResourceableId() { + return getKey(); + } + /** * Compares the keys. * @see java.lang.Object#equals(java.lang.Object) diff --git a/src/main/java/org/olat/group/model/SearchBusinessGroupParams.java b/src/main/java/org/olat/group/model/SearchBusinessGroupParams.java index 64ad1cf239c..6afa0ca01de 100644 --- a/src/main/java/org/olat/group/model/SearchBusinessGroupParams.java +++ b/src/main/java/org/olat/group/model/SearchBusinessGroupParams.java @@ -38,7 +38,7 @@ public class SearchBusinessGroupParams { private List<String> types; private List<String> tools; private String nameOrDesc; - private List<Long> keys; + private List<Long> groupKeys; private String name; private String exactName; private String description; @@ -95,12 +95,12 @@ public class SearchBusinessGroupParams { } } - public List<Long> getKeys() { - return keys; + public List<Long> getGroupKeys() { + return groupKeys; } - public void setKeys(List<Long> keys) { - this.keys = keys; + public void setGroupKeys(List<Long> groupKeys) { + this.groupKeys = groupKeys; } public String getName() { diff --git a/src/main/java/org/olat/group/ui/BusinessGroupTableModelWithMaxSize.java b/src/main/java/org/olat/group/ui/BusinessGroupTableModelWithMaxSize.java index 9a9cfbb9fb7..2b9a88c249b 100644 --- a/src/main/java/org/olat/group/ui/BusinessGroupTableModelWithMaxSize.java +++ b/src/main/java/org/olat/group/ui/BusinessGroupTableModelWithMaxSize.java @@ -25,14 +25,12 @@ package org.olat.group.ui; -import java.util.Iterator; import java.util.List; import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.BaseSecurityManager; import org.olat.core.CoreSpringFactory; import org.olat.core.gui.components.table.DefaultTableDataModel; -import org.olat.core.gui.components.table.TableDataModel; import org.olat.core.gui.translator.Translator; import org.olat.core.id.Identity; import org.olat.core.logging.Tracing; @@ -50,9 +48,9 @@ import org.olat.group.BusinessGroupService; * * @author gnaegi */ -public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel implements TableDataModel { +public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel<BusinessGroup> { private static final int COLUMN_COUNT = 7; - private List members; + private List<Integer> members; private Translator trans; private Identity identity; private boolean cancelEnrollEnabled; @@ -65,7 +63,7 @@ public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel im * The index of the list corresponds with the index of the group list * @param trans */ - public BusinessGroupTableModelWithMaxSize(List groups, List members, Translator trans, Identity identity, boolean cancelEnrollEnabled) { + public BusinessGroupTableModelWithMaxSize(List<BusinessGroup> groups, List<Integer> members, Translator trans, Identity identity, boolean cancelEnrollEnabled) { super(groups); this.members = members; this.trans = trans; @@ -87,7 +85,7 @@ public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel im */ public Object getValueAt(int row, int col) { BusinessGroup businessGroup = (BusinessGroup) objects.get(row); - Integer numbParts = (Integer) members.get(row); + Integer numbParts = members.get(row); Integer max = businessGroup.getMaxParticipants(); switch (col) { case 0: @@ -122,9 +120,9 @@ public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel im return trans.translate("grouplist.table.noWaitingList"); case 4: // Status - if (securityManager.isIdentityInSecurityGroup(this.identity,businessGroup.getPartipiciantGroup())) { + if (securityManager.isIdentityInSecurityGroup(identity,businessGroup.getPartipiciantGroup())) { return trans.translate("grouplist.table.state.onPartipiciantList"); - } else if (securityManager.isIdentityInSecurityGroup(this.identity,businessGroup.getWaitingGroup())) { + } else if (securityManager.isIdentityInSecurityGroup(identity,businessGroup.getWaitingGroup())) { int pos = businessGroupService.getPositionInWaitingListFor(identity,businessGroup); String[] onWaitingListArgs = new String[] { Integer.toString(pos) }; return trans.translate("grouplist.table.state.onWaitingList",onWaitingListArgs); @@ -167,7 +165,7 @@ public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel im /** * @param owned */ - public void setEntries(List owned) { + public void setEntries(List<BusinessGroup> owned) { this.objects = owned; } @@ -198,10 +196,8 @@ public class BusinessGroupTableModelWithMaxSize extends DefaultTableDataModel im * @param identity * @return true: Found identity in any security-group of this table model. */ private boolean isEnrolledInAnyGroup(Identity identity) { - BusinessGroup businessGroup; // loop over all business-groups - for (Iterator iter = objects.iterator(); iter.hasNext() ;) { - businessGroup = (BusinessGroup)iter.next(); + for (BusinessGroup businessGroup:objects) { if (isEnrolledIn(businessGroup, identity) ) { return true; } diff --git a/src/main/java/org/olat/group/ui/main/BGMainController.java b/src/main/java/org/olat/group/ui/main/BGMainController.java index 0bcc24dd7c6..42aaf4db4b9 100644 --- a/src/main/java/org/olat/group/ui/main/BGMainController.java +++ b/src/main/java/org/olat/group/ui/main/BGMainController.java @@ -720,7 +720,7 @@ public class BGMainController extends MainLayoutBasicController implements Activ SearchBusinessGroupParams params = new SearchBusinessGroupParams(); if(id != null) { - params.setKeys(Collections.singletonList(id)); + params.setGroupKeys(Collections.singletonList(id)); } params.setName(name); params.setDescription(description); diff --git a/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java b/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java index 225aae12f97..b23279eaa10 100644 --- a/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java +++ b/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java @@ -276,7 +276,7 @@ public class BusinessGroupListController extends BasicController { SearchBusinessGroupParams params = new SearchBusinessGroupParams(); if(id != null) { - params.setKeys(Collections.singletonList(id)); + params.setGroupKeys(Collections.singletonList(id)); } params.setName(StringHelper.containsNonWhitespace(name) ? name : null); params.setDescription(StringHelper.containsNonWhitespace(description) ? description : null); diff --git a/src/test/java/org/olat/group/test/BGAreaManagerTest.java b/src/test/java/org/olat/group/test/BGAreaManagerTest.java index 8f06e97aee9..5e81de15b56 100644 --- a/src/test/java/org/olat/group/test/BGAreaManagerTest.java +++ b/src/test/java/org/olat/group/test/BGAreaManagerTest.java @@ -570,12 +570,14 @@ public class BGAreaManagerTest extends OlatTestCase { Assert.assertTrue(groupId1.contains(group1)); //find nothing with name and resource - List<BusinessGroup> groupId1Area2 = areaManager.findBusinessGroupsOfAreaAttendedBy(id1, "area-2-" + areaName, resource); + List<Long> area2Keys = Collections.singletonList(area2.getKey()); + List<BusinessGroup> groupId1Area2 = areaManager.findBusinessGroupsOfAreaAttendedBy(id1, area2Keys, resource); Assert.assertNotNull(groupId1Area2); Assert.assertEquals(0, groupId1Area2.size()); //find groups id 2 with name and resource - List<BusinessGroup> groupId2Area1 = areaManager.findBusinessGroupsOfAreaAttendedBy(id2, "area-1-" + areaName, resource); + List<Long> area1Keys = Collections.singletonList(area1.getKey()); + List<BusinessGroup> groupId2Area1 = areaManager.findBusinessGroupsOfAreaAttendedBy(id2, area1Keys, resource); Assert.assertNotNull(groupId2Area1); Assert.assertEquals(2, groupId2Area1.size()); Assert.assertTrue(groupId2Area1.contains(group2)); -- GitLab