diff --git a/src/main/java/de/bps/course/assessment/AssessmentMainController.java b/src/main/java/de/bps/course/assessment/AssessmentMainController.java index 088b3cdc0f85e1de9e97dc6121d6414bf865e345..2c02fee63df31a698c9d65ed4fed34be4c44a259 100644 --- a/src/main/java/de/bps/course/assessment/AssessmentMainController.java +++ b/src/main/java/de/bps/course/assessment/AssessmentMainController.java @@ -813,9 +813,9 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea ICourse course = CourseFactory.loadCourse(ores); CourseGroupManager gm = course.getCourseEnvironment().getCourseGroupManager(); if (callback.mayAssessAllUsers() || callback.mayViewAllUsersAssessments()) { - return gm.getAllLearningGroupsFromAllContexts(); + return gm.getAllBusinessGroups(); } else if (callback.mayAssessCoachedUsers()) { - return gm.getOwnedLearningGroupsFromAllContexts(identity); + return gm.getOwnedBusinessGroups(identity); } else { throw new OLATSecurityException("No rights to assess or even view any groups"); } diff --git a/src/main/java/de/bps/olat/modules/cl/ChecklistManageCheckpointsController.java b/src/main/java/de/bps/olat/modules/cl/ChecklistManageCheckpointsController.java index 2b4ba8ab5b74c7b597c39d4fc6e4ee2f2f630fe7..76a2f3809e0c4d367669573fcdd73bba71ab1c02 100644 --- a/src/main/java/de/bps/olat/modules/cl/ChecklistManageCheckpointsController.java +++ b/src/main/java/de/bps/olat/modules/cl/ChecklistManageCheckpointsController.java @@ -125,7 +125,7 @@ public class ChecklistManageCheckpointsController extends BasicController { // collect all identities in learning groups HashSet<Identity> identitiesInGroups = new HashSet<Identity>(); - identitiesInGroups.addAll(cgm.getParticipantsFromLearningGroup(null)); + identitiesInGroups.addAll(cgm.getParticipantsFromBusinessGroup(null)); //fxdiff VCRP-1,2: access control of resources identitiesInGroups.addAll(cgm.getParticipants()); @@ -142,24 +142,24 @@ public class ChecklistManageCheckpointsController extends BasicController { notInGroupIdentities.addAll(identitiesNotInGroups); // collect all learning groups - lstGroups.addAll(cgm.getAllLearningGroupsFromAllContexts()); + lstGroups.addAll(cgm.getAllBusinessGroups()); } else if(cgm.hasRight(identity, CourseRights.RIGHT_GROUPMANAGEMENT)) { // collect all identities in learning groups HashSet<Identity> identitiesInGroups = new HashSet<Identity>(); - identitiesInGroups.addAll(cgm.getParticipantsFromLearningGroup(null)); + identitiesInGroups.addAll(cgm.getParticipantsFromBusinessGroup(null)); //fxdiff VCRP-1,2: access control of resources identitiesInGroups.addAll(cgm.getParticipants()); allIdentities.addAll(identitiesInGroups); // collect all learning groups - lstGroups.addAll(cgm.getAllLearningGroupsFromAllContexts()); + lstGroups.addAll(cgm.getAllBusinessGroups()); } else if(cgm.isIdentityCourseCoach(identity)) { HashSet<Identity> identitiesInGroups = new HashSet<Identity>(); - for( Object obj : cgm.getAllLearningGroupsFromAllContexts() ) { + for( Object obj : cgm.getAllBusinessGroups() ) { BusinessGroup group = (BusinessGroup) obj; - if(cgm.getCoachesFromLearningGroup(group.getName()).contains(identity)) { + if(cgm.getCoachesFromBusinessGroup(group.getName()).contains(identity)) { lstGroups.add(group); - identitiesInGroups.addAll(cgm.getParticipantsFromLearningGroup(group.getName())); + identitiesInGroups.addAll(cgm.getParticipantsFromBusinessGroup(group.getName())); } } allIdentities.addAll(identitiesInGroups); @@ -202,7 +202,7 @@ public class ChecklistManageCheckpointsController extends BasicController { } else if(groupForm.getSelection().equals(GroupChoiceForm.CHOICE_OTHERS)) { lstIdents.addAll(notInGroupIdentities); } else { - lstIdents.addAll(cgm.getParticipantsFromLearningGroup(groupForm.getSelection())); + lstIdents.addAll(cgm.getParticipantsFromBusinessGroup(groupForm.getSelection())); } // prepare table for run view diff --git a/src/main/java/org/olat/admin/securitygroup/gui/UserControllerFactory.java b/src/main/java/org/olat/admin/securitygroup/gui/UserControllerFactory.java index 97899bdcf627ce8ef98c523ae4746ce871ef0b67..fa7f57e73de99fc03a15055cd15857c230ceeb89 100644 --- a/src/main/java/org/olat/admin/securitygroup/gui/UserControllerFactory.java +++ b/src/main/java/org/olat/admin/securitygroup/gui/UserControllerFactory.java @@ -35,6 +35,7 @@ import org.olat.core.gui.components.table.TableGuiConfiguration; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.translator.PackageTranslator; import org.olat.core.gui.translator.Translator; +import org.olat.core.id.Identity; import org.olat.core.id.Roles; import org.olat.core.util.Util; import org.olat.user.UserManager; @@ -48,7 +49,7 @@ public class UserControllerFactory { - public static TableController createTableControllerFor(TableGuiConfiguration tableConfig, List identities, UserRequest ureq, + public static TableController createTableControllerFor(TableGuiConfiguration tableConfig, List<Identity> identities, UserRequest ureq, WindowControl wControl, String actionCommand) { Locale loc = ureq.getLocale(); Translator trans = new PackageTranslator(PACKAGE, loc); diff --git a/src/main/java/org/olat/admin/user/UserTableDataModel.java b/src/main/java/org/olat/admin/user/UserTableDataModel.java index 7175e482f80579abd0e654a1665e5fa8bab2e4a2..70016188156bed3be2052356761db850cb79c8f2 100644 --- a/src/main/java/org/olat/admin/user/UserTableDataModel.java +++ b/src/main/java/org/olat/admin/user/UserTableDataModel.java @@ -46,7 +46,7 @@ import org.olat.user.propertyhandlers.UserPropertyHandler; * and not org.olat.user.User to build the list! * </pre> */ -public class UserTableDataModel extends DefaultTableDataModel { +public class UserTableDataModel extends DefaultTableDataModel<Identity> { private List<UserPropertyHandler> userPropertyHandlers; private static final String usageIdentifyer = UserTableDataModel.class.getCanonicalName(); @@ -54,7 +54,7 @@ public class UserTableDataModel extends DefaultTableDataModel { /** * @param objects */ - public UserTableDataModel(List objects, Locale locale, boolean isAdministrativeUser) { + public UserTableDataModel(List<Identity> objects, Locale locale, boolean isAdministrativeUser) { super(objects); setLocale(locale); userPropertyHandlers = UserManager.getInstance().getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser); @@ -82,7 +82,7 @@ public class UserTableDataModel extends DefaultTableDataModel { * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int) */ public final Object getValueAt(int row, int col) { - Identity identity = (Identity) getObject(row); + Identity identity = getObject(row); User user = identity.getUser(); if (col == 0) { return identity.getName(); @@ -110,7 +110,7 @@ public class UserTableDataModel extends DefaultTableDataModel { * @return */ public Identity getIdentityAt(int rowid) { - return (Identity) getObject(rowid); + return getObject(rowid); } } diff --git a/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java b/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java index ddeb447feac0bc4e36f077a258cfd84b6e202993..c78f02151aee70aa62e99126f88b9844ea95a5df 100644 --- a/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java +++ b/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java @@ -60,7 +60,6 @@ import org.olat.core.util.notifications.NotificationHelper; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.model.AddToGroupsEvent; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGControllerFactory; import org.olat.group.ui.BGMailHelper; import org.olat.group.ui.BusinessGroupTableModel; @@ -277,7 +276,6 @@ public class GroupOverviewController extends BasicController { BusinessGroup currBusinessGroup = (BusinessGroup) removeFromGrpDlg.getUserObject(); String groupName = currBusinessGroup.getName(); BaseSecurity securityManager = BaseSecurityManager.getInstance(); - final BGConfigFlags flags = BGConfigFlags.createBuddyGroupDefaultFlags(); SecurityGroup owners = currBusinessGroup.getOwnerGroup(); List<Identity> ownerList = securityManager.getIdentitiesOfSecurityGroup(owners); List<Identity> partList = securityManager.getIdentitiesOfSecurityGroup(currBusinessGroup.getPartipiciantGroup()); @@ -293,7 +291,7 @@ public class GroupOverviewController extends BasicController { } else { // 1) remove as owner if (securityManager.isIdentityInSecurityGroup(identity, owners)) { - businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(identity), currBusinessGroup, flags); + businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(identity), currBusinessGroup); } // 2) remove as participant @@ -301,7 +299,7 @@ public class GroupOverviewController extends BasicController { //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(currBusinessGroup, new SyncerExecutor() { public void execute() { - businessGroupService.removeParticipant(getIdentity(), identity, toRemFromGroup, flags); + businessGroupService.removeParticipant(getIdentity(), identity, toRemFromGroup); } }); diff --git a/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java b/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java index 90f11943b201ca98f3db3d21c6ff3382ed2b8529..5395eb26e71466df02b37cef9dc483842d8a94bb 100644 --- a/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java +++ b/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java @@ -158,7 +158,7 @@ public class GroupSearchResultProvider implements ResultMapProvider { for (RepositoryEntry repositoryEntry : allRepoEntries) { ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource()); - List<BusinessGroup> allCourseGroups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> allCourseGroups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups(); for (BusinessGroup group : allCourseGroups) { if (!tempResult.containsKey(group.getKey())) { tempResult.put(group.getKey(), getCombinedRepoName(group, repositoryEntry)); diff --git a/src/main/java/org/olat/collaboration/CollaborationTools.java b/src/main/java/org/olat/collaboration/CollaborationTools.java index 02afc10a14d129bc1c1f9ae19944735af465e5e0..fb5505e684c10de34dc8995884bbc9880fc9df71 100644 --- a/src/main/java/org/olat/collaboration/CollaborationTools.java +++ b/src/main/java/org/olat/collaboration/CollaborationTools.java @@ -80,7 +80,6 @@ import org.olat.course.ICourse; import org.olat.course.run.calendar.CourseLinkProviderController; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; import org.olat.instantMessaging.InstantMessagingModule; import org.olat.instantMessaging.groupchat.GroupChatManagerController; import org.olat.modules.co.ContactFormController; @@ -715,8 +714,8 @@ public class CollaborationTools implements Serializable { * @param ureq * @return a collaboration tools settings controller */ - public CollaborationToolsSettingsController createCollaborationToolsSettingsController(UserRequest ureq, WindowControl wControl, BGConfigFlags flags) { - return new CollaborationToolsSettingsController(ureq, wControl, ores, flags); + public CollaborationToolsSettingsController createCollaborationToolsSettingsController(UserRequest ureq, WindowControl wControl) { + return new CollaborationToolsSettingsController(ureq, wControl, ores); } /** diff --git a/src/main/java/org/olat/collaboration/CollaborationToolsSettingsController.java b/src/main/java/org/olat/collaboration/CollaborationToolsSettingsController.java index 8781154f25c3bae990e51c16079b1b5d96672951..f9913d9f5b82e795e6d70f5fab29056e580896df 100644 --- a/src/main/java/org/olat/collaboration/CollaborationToolsSettingsController.java +++ b/src/main/java/org/olat/collaboration/CollaborationToolsSettingsController.java @@ -48,7 +48,6 @@ import org.olat.core.id.OLATResourceable; import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.resource.OresHelper; import org.olat.core.util.vfs.QuotaManager; -import org.olat.group.ui.BGConfigFlags; /** * Description: <BR> @@ -74,14 +73,14 @@ public class CollaborationToolsSettingsController extends BasicController { * @param ureq * @param tools */ - public CollaborationToolsSettingsController(UserRequest ureq, WindowControl wControl, OLATResourceable businessGroup, BGConfigFlags flags) { + public CollaborationToolsSettingsController(UserRequest ureq, WindowControl wControl, OLATResourceable businessGroup) { super(ureq, wControl); this.businessGroup = businessGroup; CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); vc_collabtools = createVelocityContainer ("collaborationtools"); - cots = new ChoiceOfToolsForm (ureq, wControl, collabTools, flags); + cots = new ChoiceOfToolsForm (ureq, wControl, collabTools); listenTo(cots); vc_collabtools.put("choiceOfTools", cots.getInitialComponent()); @@ -262,13 +261,13 @@ class ChoiceOfToolsForm extends FormBasicController { List <String>theKeys = new ArrayList<String>(); List <String>theValues = new ArrayList<String>(); - public ChoiceOfToolsForm(UserRequest ureq, WindowControl wControl, CollaborationTools cts, BGConfigFlags flags) { + public ChoiceOfToolsForm(UserRequest ureq, WindowControl wControl, CollaborationTools cts) { super(ureq, wControl); this.cts = cts; - for (int i=0, j=0; i<CollaborationTools.TOOLS.length; i++) { + for (int i=0; i<CollaborationTools.TOOLS.length; i++) { String k = CollaborationTools.TOOLS[i]; - if (k.equals(CollaborationTools.TOOL_CHAT) && !flags.isEnabled(BGConfigFlags.BUDDYLIST)) { + if (k.equals(CollaborationTools.TOOL_CHAT)) { continue; } theKeys.add(""+i); diff --git a/src/main/java/org/olat/course/CourseFactory.java b/src/main/java/org/olat/course/CourseFactory.java index dc4509c1cc67fcaf17de69c4c852f5d60f7c581d..3e5d143f628f2cefe4f6ea9e1776f2feb17533a4 100644 --- a/src/main/java/org/olat/course/CourseFactory.java +++ b/src/main/java/org/olat/course/CourseFactory.java @@ -425,7 +425,7 @@ public class CourseFactory extends BasicManager { CalendarManager calMan = CalendarManagerFactory.getInstance().getCalendarManager(); NotificationsManager nfm = NotificationsManager.getInstance(); CourseGroupManager courseGroupManager = PersistingCourseGroupManager.getInstance(res); - List<BusinessGroup> learningGroups = courseGroupManager.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> learningGroups = courseGroupManager.getAllBusinessGroups(); //all learning and right group calendars for (BusinessGroup bg : learningGroups) { KalendarRenderWrapper calRenderWrapper = calMan.getGroupCalendar(bg); @@ -622,8 +622,7 @@ public class CourseFactory extends BasicManager { // create group management CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); // import groups - cgm.importCourseLearningGroups(courseExportData); - cgm.importCourseRightGroups(courseExportData); + cgm.importCourseBusinessGroups(courseExportData); // create security group SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup(); diff --git a/src/main/java/org/olat/course/PersistingCourseImpl.java b/src/main/java/org/olat/course/PersistingCourseImpl.java index 5444911f27dc2ff5c8d56ee9c6fe4442a3ce3533..0777a52d08ca67be30304facf24e4956d41ff161 100644 --- a/src/main/java/org/olat/course/PersistingCourseImpl.java +++ b/src/main/java/org/olat/course/PersistingCourseImpl.java @@ -364,7 +364,7 @@ public class PersistingCourseImpl implements ICourse, OLATResourceable, Serializ // export configuration file FileUtils.copyFileToDir(new File(fCourseBase, CourseConfigManager.COURSECONFIG_XML), exportDirectory, "course export configuration and repo info"); // export learning groups - PersistingCourseGroupManager.getInstance(this).exportCourseLeaningGroups(fExportedDataDir); + PersistingCourseGroupManager.getInstance(this).exportCourseBusinessGroups(fExportedDataDir); // export right groups //PersistingCourseGroupManager.getInstance(this).exportCourseRightGroups(fExportedDataDir); // export repo metadata diff --git a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java index d2d37f2d382c53db24d7deec942c02a210a7f943..21362745c7ce5b854495e19f54edd1082db77215 100644 --- a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java +++ b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java @@ -377,7 +377,7 @@ public class ScoreAccountingHelper { public static List<Identity> loadUsers(CourseEnvironment courseEnv) { CourseGroupManager gm = courseEnv.getCourseGroupManager(); BaseSecurity securityManager = BaseSecurityManager.getInstance(); - List<BusinessGroup> groups = gm.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> groups = gm.getAllBusinessGroups(); List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); for (BusinessGroup group: groups) { diff --git a/src/main/java/org/olat/course/assessment/AssessmentEditController.java b/src/main/java/org/olat/course/assessment/AssessmentEditController.java index cb9ab77e293658b93c5b95322188eaa470117609..92d10fa2536b9be12a319f718e3d80bdbe7668e2 100644 --- a/src/main/java/org/olat/course/assessment/AssessmentEditController.java +++ b/src/main/java/org/olat/course/assessment/AssessmentEditController.java @@ -150,7 +150,7 @@ public class AssessmentEditController extends BasicController { detailView.contextPut("courseNodeCss", CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType()).getIconCSSClass()); // push infos about users groups - List<BusinessGroup> participantGroups = course.getCourseEnvironment().getCourseGroupManager().getParticipatingLearningGroupsFromAllContexts( + List<BusinessGroup> participantGroups = course.getCourseEnvironment().getCourseGroupManager().getParticipatingBusinessGroups( assessedIdentity); final Collator collator = Collator.getInstance(ureq.getLocale()); Collections.sort(participantGroups, new Comparator<BusinessGroup>() { diff --git a/src/main/java/org/olat/course/assessment/AssessmentMainController.java b/src/main/java/org/olat/course/assessment/AssessmentMainController.java index 692acc101c80851e331a5c69bf58642e3a834b37..713641a165f85c332e78fbbd0fa9faed326eec80 100644 --- a/src/main/java/org/olat/course/assessment/AssessmentMainController.java +++ b/src/main/java/org/olat/course/assessment/AssessmentMainController.java @@ -631,9 +631,9 @@ AssessmentMainController(UserRequest ureq, WindowControl wControl, OLATResourcea ICourse course = CourseFactory.loadCourse(ores); CourseGroupManager gm = course.getCourseEnvironment().getCourseGroupManager(); if (callback.mayAssessAllUsers() || callback.mayViewAllUsersAssessments()) { - return gm.getAllLearningGroupsFromAllContexts(); + return gm.getAllBusinessGroups(); } else if (callback.mayAssessCoachedUsers()) { - return gm.getOwnedLearningGroupsFromAllContexts(identity); + return gm.getOwnedBusinessGroups(identity); } else { throw new OLATSecurityException("No rights to assess or even view any groups"); } diff --git a/src/main/java/org/olat/course/assessment/AssessmentNotificationsHandler.java b/src/main/java/org/olat/course/assessment/AssessmentNotificationsHandler.java index aca32be118ca72b4ccf62a2cfda54177b852f1df..a50e7db22b1f6763c4c36185c6e7c3bf9688a071 100644 --- a/src/main/java/org/olat/course/assessment/AssessmentNotificationsHandler.java +++ b/src/main/java/org/olat/course/assessment/AssessmentNotificationsHandler.java @@ -330,7 +330,7 @@ public class AssessmentNotificationsHandler implements NotificationsHandler { final List<Identity> coachedUsers = new ArrayList<Identity>(); if (!hasFullAccess) { // initialize list of users, only when user has not full access - List<BusinessGroup> coachedGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity); + List<BusinessGroup> coachedGroups = cgm.getOwnedBusinessGroups(identity); BaseSecurity securityManager = BaseSecurityManager.getInstance(); for (Iterator<BusinessGroup> iter = coachedGroups.iterator(); iter.hasNext();) { BusinessGroup group = iter.next(); diff --git a/src/main/java/org/olat/course/assessment/EfficiencyStatementController.java b/src/main/java/org/olat/course/assessment/EfficiencyStatementController.java index c4aed664c3d3162471eccafa531ee1d97b117f20..bf70b1c15d39a70996fd91f35d127bbfa11d876c 100644 --- a/src/main/java/org/olat/course/assessment/EfficiencyStatementController.java +++ b/src/main/java/org/olat/course/assessment/EfficiencyStatementController.java @@ -126,7 +126,7 @@ public class EfficiencyStatementController extends BasicController { } if(businessGroup == null && courseRepo != null) { ICourse course = CourseFactory.loadCourse(courseRepo.getOlatResource()); - List<BusinessGroup> groups = course.getCourseEnvironment().getCourseGroupManager().getParticipatingLearningGroupsFromAllContexts(statementOwner); + List<BusinessGroup> groups = course.getCourseEnvironment().getCourseGroupManager().getParticipatingBusinessGroups(statementOwner); if(groups.size() > 0) { businessGroup = groups.get(0); } diff --git a/src/main/java/org/olat/course/condition/AreaSelectionController.java b/src/main/java/org/olat/course/condition/AreaSelectionController.java index 16aef594bd49dccba0baa99068801d67f0607cea..cb4f209c3efe2abcbc98b644f177c682cedf14d8 100644 --- a/src/main/java/org/olat/course/condition/AreaSelectionController.java +++ b/src/main/java/org/olat/course/condition/AreaSelectionController.java @@ -73,20 +73,22 @@ public class AreaSelectionController extends FormBasicController { super(ureq, wControl, "group_or_area_selection"); this.courseGrpMngr = courseGrpMngr; - // unique names from list to arry - List<BGArea> areas = courseGrpMngr.getAllAreasFromAllContexts(); + loadNamesAndKeys(); + initForm(ureq); + + for (Long selectionKey: selectionKeys) { + entrySelector.select(selectionKey.toString(), true); + } + } + + private void loadNamesAndKeys() { + List<BGArea> areas = courseGrpMngr.getAllAreas(); areaNames = new String[areas.size()]; areaKeys = new String[areas.size()]; for(int i=areas.size(); i-->0; ) { areaNames[i] = areas.get(i).getName(); areaKeys[i] = areas.get(i).getKey().toString(); } - - initForm(ureq); - - for (Long selectionKey: selectionKeys) { - entrySelector.select(selectionKey.toString(), true); - } } @Override @@ -109,14 +111,7 @@ public class AreaSelectionController extends FormBasicController { if(source == areaCreateCntrllr) { cmc.deactivate(); if (event == Event.DONE_EVENT) { - List<BGArea> areas = courseGrpMngr.getAllAreasFromAllContexts(); - areaNames = new String[areas.size()]; - areaKeys = new String[areas.size()]; - for(int i=areas.size(); i-->0; ) { - areaNames[i] = areas.get(i).getName(); - areaKeys[i] = areas.get(i).getKey().toString(); - } - + loadNamesAndKeys(); // select new value entrySelector.setKeysAndValues(areaKeys, areaNames, null); entrySelector.select(areaCreateCntrllr.getCreatedArea().getKey().toString(), true); @@ -160,10 +155,6 @@ public class AreaSelectionController extends FormBasicController { protected void formResetted(UserRequest ureq) { fireEvent(ureq, Event.CANCELLED_EVENT); } - - public Set<String> getSelectedEntries() { - return entrySelector.getSelectedKeys(); - } public List<String> getSelectedNames() { List<String> selectedNames = new ArrayList<String>(); @@ -183,5 +174,4 @@ public class AreaSelectionController extends FormBasicController { } return groupKeys; } - -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/course/condition/ConditionConfigEasyController.java b/src/main/java/org/olat/course/condition/ConditionConfigEasyController.java index f111d26168e80f57569bd6e836ae390b0b501958..c97e09b9aa13db0e0c6714a799c648b3f35e8f48 100644 --- a/src/main/java/org/olat/course/condition/ConditionConfigEasyController.java +++ b/src/main/java/org/olat/course/condition/ConditionConfigEasyController.java @@ -338,7 +338,7 @@ public class ConditionConfigEasyController extends FormBasicController implement removeAsListenerAndDispose(groupCreateCtlr); OLATResource courseResource = courseEditorEnv.getCourseGroupManager().getCourseResource(); - groupCreateCtlr = new NewBGController(ureq, getWindowControl(), true, courseResource, true, null); + groupCreateCtlr = new NewBGController(ureq, getWindowControl(), courseResource, true, null); listenTo(groupCreateCtlr); cmc = new CloseableModalController(getWindowControl(), "close", groupCreateCtlr.getInitialComponent()); listenTo(cmc); @@ -373,7 +373,7 @@ public class ConditionConfigEasyController extends FormBasicController implement String[] csvGroupName = (String[]) fixGroupError.getUserObject(); OLATResource courseResource = courseEditorEnv.getCourseGroupManager().getCourseResource(); removeAsListenerAndDispose(groupCreateCtlr); - groupCreateCtlr = new NewBGController(ureq, getWindowControl(), true, courseResource, true, csvGroupName[0]); + groupCreateCtlr = new NewBGController(ureq, getWindowControl(), courseResource, true, csvGroupName[0]); listenTo(groupCreateCtlr); removeAsListenerAndDispose(cmc); diff --git a/src/main/java/org/olat/course/condition/GroupSelectionController.java b/src/main/java/org/olat/course/condition/GroupSelectionController.java index 6ee2eb897ea5621e0dade27d4ee85d200426a6bf..bc09888431a7a2067bbe704dfa08431272462147 100644 --- a/src/main/java/org/olat/course/condition/GroupSelectionController.java +++ b/src/main/java/org/olat/course/condition/GroupSelectionController.java @@ -43,7 +43,6 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.course.groupsandrights.CourseGroupManager; import org.olat.group.BusinessGroup; -import org.olat.group.ui.BGControllerFactory; import org.olat.group.ui.NewBGController; /** @@ -70,8 +69,16 @@ public class GroupSelectionController extends FormBasicController { super(ureq, wControl, "group_or_area_selection"); this.courseGrpMngr = courseGrpMngr; // unique names from list to array - List<BusinessGroup> groups = courseGrpMngr.getAllLearningGroupsFromAllContexts(); - + loadNamesAndKeys(); + initForm(ureq); + // after initialising the element, select the entries + for (Long selectionKey :selectionKeys) { + entrySelector.select(selectionKey.toString(), true); + } + } + + private void loadNamesAndKeys() { + List<BusinessGroup> groups = courseGrpMngr.getAllBusinessGroups(); groupNames = new String[groups.size()]; groupKeys = new String[groups.size()]; for(int i=groups.size(); i-->0; ) { @@ -79,11 +86,6 @@ public class GroupSelectionController extends FormBasicController { groupKeys[i] = groups.get(i).getKey().toString(); } - initForm(ureq); - // after initialising the element, select the entries - for (Long selectionKey :selectionKeys) { - entrySelector.select(selectionKey.toString(), true); - } } @Override @@ -92,9 +94,7 @@ public class GroupSelectionController extends FormBasicController { if (source == createNew) { // user wants to create a new group -> show group create form removeAsListenerAndDispose(groupCreateCntrllr); - groupCreateCntrllr = BGControllerFactory.getInstance().createNewBGController( - ureq, getWindowControl(), true, courseGrpMngr.getCourseResource(), true, null - ); + groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), courseGrpMngr.getCourseResource(), true, null); listenTo(groupCreateCntrllr); removeAsListenerAndDispose(cmc); @@ -111,13 +111,7 @@ public class GroupSelectionController extends FormBasicController { if (source == groupCreateCntrllr) { cmc.deactivate(); if (event == Event.DONE_EVENT) { - List<BusinessGroup> groups = courseGrpMngr.getAllLearningGroupsFromAllContexts(); - groupNames = new String[groups.size()]; - groupKeys = new String[groups.size()]; - for(int i=groups.size(); i-->0; ) { - groupNames[i] = groups.get(i).getName(); - groupKeys[i] = groups.get(i).getKey().toString(); - } + loadNamesAndKeys(); // select new value entrySelector.setKeysAndValues(groupKeys, groupNames, null); entrySelector.select(groupCreateCntrllr.getCreatedGroup().getKey().toString(), true); diff --git a/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java b/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java index 88f18230ce0248c675bc554a1a0e0c980571f883..d88c4459fc283755f3e3c0a00dd9a52346af7669 100644 --- a/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java +++ b/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java @@ -177,7 +177,7 @@ public class CourseEditorEnvImpl implements CourseEditorEnv { @Override public List<String> validateAreas(List<String> areanames) { - List<BGArea> cnt = cgm.getAllAreasFromAllContexts(); + List<BGArea> cnt = cgm.getAllAreas(); List<String> invalidNames = new ArrayList<String>(); a_a: diff --git a/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java b/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java index ea55da24ab23af46c9b2cf05e53b3cc98ecbe85a..0aaa0df08a60e24b48d42eeae9f90cc73a2a4ffa 100644 --- a/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java +++ b/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java @@ -52,11 +52,6 @@ public interface CourseGroupManager { public OLATResource getCourseResource(); - - /** - * Initialize the group contexts list. - */ - public void initGroupContextsList(); /** * Checks users course rights in any of the available right group context of @@ -130,7 +125,7 @@ public interface CourseGroupManager { * @return A list of all learning group from all learning group contexts of * this course */ - public List<BusinessGroup> getAllLearningGroupsFromAllContexts(); + public List<BusinessGroup> getAllBusinessGroups(); /** * @param groupName @@ -138,7 +133,7 @@ public interface CourseGroupManager { * contexts of this course */ //TODO gm why is it needed? - public List<BusinessGroup> getLearningGroupsFromAllContexts(String groupName); + public List<BusinessGroup> getBusinessGroups(String groupName); public boolean existGroup(String nameOrKey); @@ -147,14 +142,14 @@ public interface CourseGroupManager { * @return A list of all learning groups from all contexts from this course * that are in the given group area */ - public List<BusinessGroup> getLearningGroupsInAreaFromAllContexts(String areaName); + public List<BusinessGroup> getBusinessGroupsInArea(String areaName); /** * @param groupName * @return A list of all learning areas where the given group takes part. All * course group contexts are considered in this search. */ - public List<BGArea> getLearningAreasOfGroupFromAllContexts(String groupName); + public List<BGArea> getAreasOfBusinessGroup(String groupName); /** * @param identity @@ -162,7 +157,7 @@ public interface CourseGroupManager { * @return A list of all learning groups with the given name where this * identity is participant */ - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity, String groupName); + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity, String groupName); /** * @param identity @@ -170,26 +165,26 @@ public interface CourseGroupManager { * @return A list of all learning groups within the given group area where * this identity is participant */ - public List<BusinessGroup> getParticipatingLearningGroupsInAreaFromAllContexts(Identity identity, String araName); + public List<BusinessGroup> getParticipatingBusinessGroupsInArea(Identity identity, String araName); /** * @param identity * @return A list of all learning groups where this identity is owner */ - public List<BusinessGroup> getOwnedLearningGroupsFromAllContexts(Identity identity); + public List<BusinessGroup> getOwnedBusinessGroups(Identity identity); /** * @param identity * @return A list of all learning groups where this identity is participant */ - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity); + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity); /** * @return A list of all group areas from this course */ - public List<BGArea> getAllAreasFromAllContexts(); + public List<BGArea> getAllAreas(); - public List<BGArea> getAreasFromContext(String areaname); + public List<BGArea> getAreas(String areaname); public boolean existArea(String nameOrKey); @@ -217,35 +212,28 @@ public interface CourseGroupManager { * a group red is in more than one contexts, red will be only once in * the list */ - public List<String> getUniqueLearningGroupNamesFromAllContexts(); + public List<String> getUniqueBusinessGroupNames(); /** * @return A list with all area names used in all learning group contexts. If * an area red is in more than one contexts, red will be only once in * the list */ - public List<String> getUniqueAreaNamesFromAllContexts(); + public List<String> getUniqueAreaNames(); /** * Export all groups which are course internal to a file for later import. * * @param fExportDirectory */ - public void exportCourseLeaningGroups(File fExportDirectory); - - /** - * Import course internal groups fa previous export. - * - * @param fImportDirectory - */ - public void importCourseLearningGroups(File fImportDirectory); + public void exportCourseBusinessGroups(File fExportDirectory); /** * Import course internal groups fa previous export. * * @param fImportDirectory */ - public void importCourseRightGroups(File fImportDirectory); + public void importCourseBusinessGroups(File fImportDirectory); /** * List with identities being coaches in learning groups of this course. If @@ -254,9 +242,9 @@ public interface CourseGroupManager { * @param groupName * @return a list with all coaches of this course */ - public List<Identity> getCoachesFromLearningGroup(String groupName); + public List<Identity> getCoachesFromBusinessGroup(String groupName); - public List<Identity> getCoachesFromLearningGroups(List<Long> groupKeys); + public List<Identity> getCoachesFromBusinessGroups(List<Long> groupKeys); //fxdiff VCRP-1,2: access control of resources public List<Identity> getCoaches(); @@ -279,9 +267,9 @@ public interface CourseGroupManager { * @param groupName * @return a list with all participants of this course */ - public List<Identity> getParticipantsFromLearningGroup(String groupName); + public List<Identity> getParticipantsFromBusinessGroup(String groupName); - public List<Identity> getParticipantsFromLearningGroups(List<Long> groupKeys); + public List<Identity> getParticipantsFromBusinessGroups(List<Long> groupKeys); @@ -303,5 +291,5 @@ public interface CourseGroupManager { * @param identity * @return A list of all waiting-list groups where this identity is in */ - public List<BusinessGroup> getWaitingListGroupsFromAllContexts(Identity identity); + public List<BusinessGroup> getWaitingListGroups(Identity identity); } diff --git a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java index 88b1d2b1cb2e32f8c6df98793b454cb11af81c2d..ce40c920ed2e0a77fe8229020dbc36ce19b05dc4 100644 --- a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java +++ b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java @@ -83,7 +83,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course rightManager = CoreSpringFactory.getImpl(BGRightManager.class); securityManager = BaseSecurityManager.getInstance(); businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); - initGroupContextsList(); } @Override @@ -91,13 +90,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course return courseResource; } - /** - * @see org.olat.course.groupsandrights.CourseGroupManager#initGroupContextsList() - */ - public void initGroupContextsList() { - // - } - /** * @param course The current course * @return A course group manager that uses persisted data @@ -141,7 +133,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course */ public boolean isLearningGroupFull(String groupName){ OLog logger = Tracing.createLoggerFor(getClass()); - List<BusinessGroup> groups = getLearningGroupsFromAllContexts(groupName); + List<BusinessGroup> groups = getBusinessGroups(groupName); if (groups == null){ logger.warn("no groups available"); @@ -193,15 +185,16 @@ public class PersistingCourseGroupManager extends BasicManager implements Course /** * @see org.olat.course.groupsandrights.CourseGroupManager#getAllLearningGroupsFromAllContexts() */ - public List<BusinessGroup> getAllLearningGroupsFromAllContexts() { + @Override + public List<BusinessGroup> getAllBusinessGroups() { SearchBusinessGroupParams params = new SearchBusinessGroupParams(); return businessGroupService.findBusinessGroups(params, courseResource, 0, -1); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningGroupsFromAllContexts(java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getBusinessGroups(java.lang.String) */ - public List<BusinessGroup> getLearningGroupsFromAllContexts(String groupName) { + public List<BusinessGroup> getBusinessGroups(String groupName) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(); params.setExactName(groupName); return businessGroupService.findBusinessGroups(params, courseResource, 0, -1); @@ -221,13 +214,14 @@ public class PersistingCourseGroupManager extends BasicManager implements Course /** * @see org.olat.course.groupsandrights.CourseGroupManager#getAllAreasFromAllContexts() */ - public List<BGArea> getAllAreasFromAllContexts() { + @Override + public List<BGArea> getAllAreas() { List<BGArea> areas = areaManager.findBGAreasInContext(courseResource); return areas; } @Override - public List<BGArea> getAreasFromContext(String areaname) { + public List<BGArea> getAreas(String areaname) { BGArea area = areaManager.findBGArea(areaname, courseResource); if(area == null) { return Collections.emptyList(); @@ -238,19 +232,19 @@ public class PersistingCourseGroupManager extends BasicManager implements Course /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningGroupsInAreaFromAllContexts(java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getBusinessGroupsInArea(java.lang.String) */ - public List<BusinessGroup> getLearningGroupsInAreaFromAllContexts(String areaName) { + public List<BusinessGroup> getBusinessGroupsInArea(String areaName) { List<BGArea> areas = areaManager.findBGAreasInContext(courseResource); List<BusinessGroup> groups = areaManager.findBusinessGroupsOfAreas(areas); return groups; } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningAreasOfGroupFromAllContexts(java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getAreasOfBusinessGroup(java.lang.String) */ - public List<BGArea> getLearningAreasOfGroupFromAllContexts(String groupName) { - List<BusinessGroup> learningGroups = getLearningGroupsFromAllContexts(groupName); + public List<BGArea> getAreasOfBusinessGroup(String groupName) { + List<BusinessGroup> learningGroups = getBusinessGroups(groupName); List<BGArea> areas = areaManager.findBGAreasOfBusinessGroups(learningGroups); return areas; } @@ -261,28 +255,28 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity, + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroups(org.olat.core.id.Identity, * java.lang.String) */ - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity, String groupName) { + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity, String groupName) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(identity, false, true); return businessGroupService.findBusinessGroups(params, courseResource, 0, -1); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsInAreaFromAllContexts(org.olat.core.id.Identity, + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroupsInArea(org.olat.core.id.Identity, * java.lang.String) */ - public List<BusinessGroup> getParticipatingLearningGroupsInAreaFromAllContexts(Identity identity, String areaName) { + public List<BusinessGroup> getParticipatingBusinessGroupsInArea(Identity identity, String areaName) { List<BusinessGroup> groups = areaManager.findBusinessGroupsOfAreaAttendedBy(identity, areaName, courseResource); return groups; } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedLearningGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedBusinessGroups(org.olat.core.id.Identity) */ @Override - public List<BusinessGroup> getOwnedLearningGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getOwnedBusinessGroups(Identity identity) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(identity, true, false); List<BusinessGroup> allGroups = businessGroupService.findBusinessGroups(params, courseResource, 0, -1); @@ -290,10 +284,10 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroups(org.olat.core.id.Identity) */ @Override - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity) { SearchBusinessGroupParams params = new SearchBusinessGroupParams(identity, false, true); List<BusinessGroup> allGroups = businessGroupService.findBusinessGroups(params, courseResource, 0, -1); @@ -379,10 +373,10 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueAreaNamesFromAllContexts() + * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueAreaNames() */ - public List<String> getUniqueAreaNamesFromAllContexts() { - List<BGArea> areas = getAllAreasFromAllContexts(); + public List<String> getUniqueAreaNames() { + List<BGArea> areas = getAllAreas(); List<String> areaNames = new ArrayList<String>(); for (BGArea area:areas) { if (!areaNames.contains(area.getName())) { @@ -394,10 +388,10 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueLearningGroupNamesFromAllContexts() + * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueBusinessGroupNames() */ - public List<String> getUniqueLearningGroupNamesFromAllContexts() { - List<BusinessGroup> groups = getAllLearningGroupsFromAllContexts(); + public List<String> getUniqueBusinessGroupNames() { + List<BusinessGroup> groups = getAllBusinessGroups(); List<String> groupNames = new ArrayList<String>(); for (BusinessGroup group:groups) { if (!groupNames.contains(group.getName())) { @@ -409,18 +403,18 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#exportCourseLeaningGroups(java.io.File) + * @see org.olat.course.groupsandrights.CourseGroupManager#exportCourseBusinessGroups(java.io.File) */ - public void exportCourseLeaningGroups(File fExportDirectory) { + public void exportCourseBusinessGroups(File fExportDirectory) { File fExportFile = new File(fExportDirectory, LEARNINGGROUPEXPORT_XML); - List<BusinessGroup> learningGroups = this.getAllLearningGroupsFromAllContexts(); - businessGroupService.exportGroups(learningGroups, fExportFile); + List<BusinessGroup> groups = getAllBusinessGroups(); + businessGroupService.exportGroups(groups, fExportFile); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#importCourseLearningGroups(java.io.File) + * @see org.olat.course.groupsandrights.CourseGroupManager#importCourseBusinessGroups(java.io.File) */ - public void importCourseLearningGroups(File fImportDirectory) { + public void importCourseBusinessGroups(File fImportDirectory) { File fGroupExportXML = new File(fImportDirectory, LEARNINGGROUPEXPORT_XML); businessGroupService.importGroups(courseResource, fGroupExportXML); } @@ -434,16 +428,16 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getCoachesFromLearningGroups(String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getCoachesFromBusinessGroups(String) */ - public List<Identity> getCoachesFromLearningGroup(String groupName) { + public List<Identity> getCoachesFromBusinessGroup(String groupName) { List<BusinessGroup> bgs = null; if (groupName != null) { // filtered by name - bgs = getLearningGroupsFromAllContexts(groupName); + bgs = getBusinessGroups(groupName); } else { // no filter - bgs = getAllLearningGroupsFromAllContexts(); + bgs = getAllBusinessGroups(); } List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); @@ -454,16 +448,16 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipantsFromLearningGroups(String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipantsFromBusinessGroups(String) */ - public List<Identity> getParticipantsFromLearningGroup(String groupName) { + public List<Identity> getParticipantsFromBusinessGroup(String groupName) { List<BusinessGroup> bgs = null; if (groupName != null) { // filtered by name - bgs = getLearningGroupsFromAllContexts(groupName); + bgs = getBusinessGroups(groupName); } else { // no filter - bgs = getAllLearningGroupsFromAllContexts(); + bgs = getAllBusinessGroups(); } List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); @@ -474,7 +468,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } @Override - public List<Identity> getCoachesFromLearningGroups(List<Long> groupKeys) { + public List<Identity> getCoachesFromBusinessGroups(List<Long> groupKeys) { List<BusinessGroup> bgs = businessGroupService.loadBusinessGroups(groupKeys); List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); for(BusinessGroup group:bgs) { @@ -484,7 +478,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course } @Override - public List<Identity> getParticipantsFromLearningGroups(List<Long> groupKeys) { + public List<Identity> getParticipantsFromBusinessGroups(List<Long> groupKeys) { List<BusinessGroup> bgs = businessGroupService.loadBusinessGroups(groupKeys); List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); for(BusinessGroup group:bgs) { @@ -521,9 +515,9 @@ public class PersistingCourseGroupManager extends BasicManager implements Course public List<Identity> getCoachesFromArea(String areaName) { List<BusinessGroup> bgs = null; if (StringHelper.containsNonWhitespace(areaName)) { - bgs = getLearningGroupsInAreaFromAllContexts(areaName); + bgs = getBusinessGroupsInArea(areaName); } else { - bgs = getAllLearningGroupsFromAllContexts(); + bgs = getAllBusinessGroups(); } List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); @@ -550,9 +544,9 @@ public class PersistingCourseGroupManager extends BasicManager implements Course public List<Identity> getParticipantsFromArea(String areaName) { List<BusinessGroup> bgs; if (StringHelper.containsNonWhitespace(areaName)) { - bgs = getLearningGroupsInAreaFromAllContexts(areaName); + bgs = getBusinessGroupsInArea(areaName); } else { - bgs = getAllLearningGroupsFromAllContexts(); + bgs = getAllBusinessGroups(); } List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(); @@ -575,9 +569,9 @@ public class PersistingCourseGroupManager extends BasicManager implements Course /** * - * @see org.olat.course.groupsandrights.CourseGroupManager#getWaitingListGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getWaitingListGroups(org.olat.core.id.Identity) */ - public List<BusinessGroup> getWaitingListGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getWaitingListGroups(Identity identity) { List<BusinessGroup> groups = businessGroupService.findBusinessGroupsWithWaitingListAttendedBy(identity, courseResource); return groups; } @@ -588,6 +582,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course */ public void archiveCourseGroups(File exportDirectory) { File exportLearningGroupFile = new File(exportDirectory, "default_" + LEARNINGGROUPARCHIVE_XLS); - businessGroupService.archiveGroups(getAllLearningGroupsFromAllContexts(), exportLearningGroupFile); + businessGroupService.archiveGroups(getAllBusinessGroups(), exportLearningGroupFile); } } \ No newline at end of file diff --git a/src/main/java/org/olat/course/groupsandrights/ui/GroupAndAreaSelectController.java b/src/main/java/org/olat/course/groupsandrights/ui/GroupAndAreaSelectController.java index fed62a30a895c859c8e477e8c5ec7bb78a30158f..6f2018b66d95d374e940cc0b775be650107e1872 100644 --- a/src/main/java/org/olat/course/groupsandrights/ui/GroupAndAreaSelectController.java +++ b/src/main/java/org/olat/course/groupsandrights/ui/GroupAndAreaSelectController.java @@ -85,12 +85,12 @@ public class GroupAndAreaSelectController extends DefaultController { // initialize some type specific stuff switch (type) { case 1: - namesList = cgm.getUniqueLearningGroupNamesFromAllContexts(); + namesList = cgm.getUniqueBusinessGroupNames(); main.contextPut("title", trans.translate("groupandareaselect.groups.title")); main.contextPut("noChoicesText", trans.translate("groupandareaselect.groups.nodata")); break; case 2: - namesList = cgm.getUniqueAreaNamesFromAllContexts(); + namesList = cgm.getUniqueAreaNames(); main.contextPut("title", trans.translate("groupandareaselect.areas.title")); main.contextPut("noChoicesText", trans.translate("groupandareaselect.areas.nodata")); break; diff --git a/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java b/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java index 3b64ed8463198422a2de928d48d678f64b212a41..15ee8ef366350f046f496487b820c8dfebdc3f87 100644 --- a/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java +++ b/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java @@ -108,9 +108,9 @@ public class CourseCalendars { calendars.add(courseKalendarWrapper); // learning groups - List<BusinessGroup> ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity); + List<BusinessGroup> ownerGroups = cgm.getOwnedBusinessGroups(identity); addCalendars(ureq, ownerGroups, true, clpc, calendars); - List<BusinessGroup> attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity); + List<BusinessGroup> attendedGroups = cgm.getParticipatingBusinessGroups(identity); for (BusinessGroup ownerGroup : ownerGroups) { if (attendedGroups.contains(ownerGroup)) attendedGroups.remove(ownerGroup); } diff --git a/src/main/java/org/olat/course/nodes/co/COConfigForm.java b/src/main/java/org/olat/course/nodes/co/COConfigForm.java index 0aeb63031f826ae9d964eb1de40f61d006f85040..870ba503394c206efc659c2964e238e804ce9a25 100644 --- a/src/main/java/org/olat/course/nodes/co/COConfigForm.java +++ b/src/main/java/org/olat/course/nodes/co/COConfigForm.java @@ -56,7 +56,6 @@ import org.olat.course.condition.AreaSelectionController; import org.olat.course.condition.GroupSelectionController; import org.olat.course.editor.CourseEditorEnv; import org.olat.course.run.userview.UserCourseEnvironment; -import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupShort; import org.olat.group.area.BGArea; @@ -443,10 +442,10 @@ public class COConfigForm extends FormBasicController { List<Long> groupKeys = (List<Long>)config.get(COEditController.CONFIG_KEY_EMAILTOGROUP_IDS); if(groupKeys == null) { groupInitVal = (String)config.get(COEditController.CONFIG_KEY_EMAILTOGROUPS); - groupKeys = getGroupKeys(groupInitVal); - } else { - groupInitVal = getGroupNames(groupKeys); + groupKeys = businessGroupService.toGroupKeys(groupInitVal, cev.getCourseGroupManager().getCourseResource()); } + groupInitVal = getGroupNames(groupKeys); + easyGroupList = uifactory.addStaticTextElement("group", null, groupInitVal, groupChooseSubContainer); easyGroupList.setUserObject(groupKeys); @@ -469,11 +468,11 @@ public class COConfigForm extends FormBasicController { @SuppressWarnings("unchecked") List<Long> areaKeys = (List<Long>)config.get(COEditController.CONFIG_KEY_EMAILTOAREA_IDS); if(areaKeys == null) { - areaInitVal = (String) config.get(COEditController.CONFIG_KEY_EMAILTOAREAS); - areaKeys = getAreaKeys(areaInitVal); - } else { - areaInitVal = getAreaNames(areaKeys); + areaInitVal = (String)config.get(COEditController.CONFIG_KEY_EMAILTOAREAS); + areaKeys = areaManager.toAreaKeys(areaInitVal, cev.getCourseGroupManager().getCourseResource()); } + areaInitVal = getAreaNames(areaKeys); + easyAreaList = uifactory.addStaticTextElement("area", null, areaInitVal, areaChooseSubContainer); easyAreaList.setUserObject(areaKeys); @@ -582,7 +581,7 @@ public class COConfigForm extends FormBasicController { // no groups in group management -> directly show group create dialog OLATResource courseResource = cev.getCourseGroupManager().getCourseResource(); - groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), true, courseResource, true, null); + groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), courseResource, true, null); listenTo(groupCreateCntrllr); cmc = new CloseableModalController(getWindowControl(), "close", groupCreateCntrllr.getInitialComponent()); listenTo(cmc); @@ -619,9 +618,7 @@ public class COConfigForm extends FormBasicController { OLATResource courseResource = cev.getCourseGroupManager().getCourseResource(); easyGroupList.setEnabled(false); removeAsListenerAndDispose(groupCreateCntrllr); - groupCreateCntrllr = BGControllerFactory.getInstance().createNewBGController( - ureq, getWindowControl(), true, courseResource, true, csvGroupName[0] - ); + groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), courseResource, true, csvGroupName[0]); listenTo(groupCreateCntrllr); removeAsListenerAndDispose(cmc); @@ -762,53 +759,11 @@ public class COConfigForm extends FormBasicController { private String getAreaNames(List<Long> keys) { StringBuilder sb = new StringBuilder(); - for(Long key:keys) { - BGArea area = areaManager.loadArea(key); - if(area != null) { - if(sb.length() > 0) sb.append(", "); - sb.append(area.getName()); - } + List<BGArea> areas = areaManager.loadAreas(keys); + for(BGArea area:areas) { + if(sb.length() > 0) sb.append(", "); + sb.append(area.getName()); } return sb.toString(); } - - private List<Long> getGroupKeys(String groupNames) { - List<Long> groupKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(groupNames)) { - String[] groupNameArr = groupNames.split(","); - List<BusinessGroup> groups = cev.getCourseGroupManager().getAllLearningGroupsFromAllContexts(); - for(String groupName:groupNameArr) { - groupName = groupName.trim(); - for(BusinessGroup group:groups) { - if(groupName.equalsIgnoreCase(group.getName())) { - groupKeys.add(group.getKey()); - break; - } - } - } - } - return groupKeys; - } - - private List<Long> getAreaKeys(String areaNames) { - List<Long> areaKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(areaNames)) { - List<BGArea> areas = cev.getCourseGroupManager().getAllAreasFromAllContexts(); - String[] areaNameArr = areaNames.split(","); - StringBuilder sb = new StringBuilder(); - for(String areaName:areaNameArr) { - areaName = areaName.trim(); - for(BGArea area:areas) { - if(areaName.equalsIgnoreCase(area.getName())) { - if(sb.length() > 0) { - sb.append(','); - } - sb.append(area.getKey()); - break; - } - } - } - } - return areaKeys; - } } diff --git a/src/main/java/org/olat/course/nodes/co/CORunController.java b/src/main/java/org/olat/course/nodes/co/CORunController.java index 044adee0bf89c60a619b5bb5debda90ee8689d43..8e418d2b6f014ba1634fed6655730fbed5489e7e 100644 --- a/src/main/java/org/olat/course/nodes/co/CORunController.java +++ b/src/main/java/org/olat/course/nodes/co/CORunController.java @@ -191,7 +191,7 @@ public class CORunController extends BasicController { } private ContactList retrieveCoachesFromGroups(List<Long> groupKeys) { - List<Identity> coaches = cgm.getCoachesFromLearningGroups(groupKeys); + List<Identity> coaches = cgm.getCoachesFromBusinessGroups(groupKeys); Set<Identity> coachesWithoutDuplicates = new HashSet<Identity>(coaches); coaches = new ArrayList<Identity>(coachesWithoutDuplicates); ContactList cl = new ContactList(translate("form.message.chckbx.coaches")); @@ -200,7 +200,7 @@ public class CORunController extends BasicController { } private ContactList retrieveCoachesFromGroup(String grpName) { - List<Identity> coaches = cgm.getCoachesFromLearningGroup(grpName); + List<Identity> coaches = cgm.getCoachesFromBusinessGroup(grpName); Set<Identity> coachesWithoutDuplicates = new HashSet<Identity>(coaches); coaches = new ArrayList<Identity>(coachesWithoutDuplicates); ContactList cl = new ContactList(translate("form.message.chckbx.coaches")); @@ -227,14 +227,14 @@ public class CORunController extends BasicController { } private ContactList retrieveParticipantsFromGroup(String grpName) { - List<Identity> participiants = cgm.getParticipantsFromLearningGroup(grpName); + List<Identity> participiants = cgm.getParticipantsFromBusinessGroup(grpName); ContactList cl = new ContactList(translate("form.message.chckbx.partips")); cl.addAllIdentites(participiants); return cl; } private ContactList retrieveParticipantsFromGroups(List<Long> groupKeys) { - List<Identity> participiants = cgm.getParticipantsFromLearningGroups(groupKeys); + List<Identity> participiants = cgm.getParticipantsFromBusinessGroups(groupKeys); ContactList cl = new ContactList(translate("form.message.chckbx.partips")); cl.addAllIdentites(participiants); return cl; diff --git a/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java b/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java index 242f55897f1ad235e7e69cf771408df6bb512c1d..1662954ca3ab976db5628269eeb6e344de2813f9 100644 --- a/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java +++ b/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java @@ -61,7 +61,6 @@ import org.olat.course.condition.GroupSelectionController; import org.olat.course.editor.CourseEditorEnv; import org.olat.course.editor.NodeEditController; import org.olat.course.nodes.ENCourseNode; -import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupShort; import org.olat.group.area.BGArea; @@ -190,23 +189,22 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener String groupInitVal; @SuppressWarnings("unchecked") List<Long> groupKeys = (List<Long>)moduleConfig.get(ENCourseNode.CONFIG_GROUP_IDS); - if(groupKeys != null) { - groupInitVal = getGroupNames(groupKeys); - } else { + if(groupKeys == null) { groupInitVal = (String) moduleConfig.get(ENCourseNode.CONFIG_GROUPNAME); if(StringHelper.containsNonWhitespace(groupInitVal)) { - groupInitVal = StringHelper.formatAsSortUniqCSVString(Arrays.asList(groupInitVal.split(","))); - groupKeys = getGroupKeys(groupInitVal); + groupKeys = businessGroupService.toGroupKeys(groupInitVal, cev.getCourseGroupManager().getCourseResource()); } else { groupKeys = new ArrayList<Long>(); } } + groupInitVal = getGroupNames(groupKeys); + easyGroupList = uifactory.addStaticTextElement("group", null, groupInitVal == null ? "" : groupInitVal, groupChooseSubContainer); easyGroupList.setUserObject(groupKeys); chooseGroupsLink = uifactory.addFormLink("choose", groupChooseSubContainer,"b_form_groupchooser"); createGroupsLink = uifactory.addFormLink("create", groupChooseSubContainer,"b_form_groupchooser"); - hasGroups = cev.getCourseGroupManager().getAllLearningGroupsFromAllContexts().size() > 0; + hasGroups = businessGroupService.countBusinessGroups(null, cev.getCourseGroupManager().getCourseResource()) > 0; // areas areaChooseSubContainer = FormLayoutContainer.createHorizontalFormLayout("areaChooseSubContainer", getTranslator()); @@ -219,17 +217,11 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener String areaInitVal; @SuppressWarnings("unchecked") List<Long> areaKeys = (List<Long>)moduleConfig.get(ENCourseNode.CONFIG_AREA_IDS); - if(areaKeys != null) { - areaInitVal = getAreaNames(areaKeys); - } else { + if(areaKeys == null) { areaInitVal = (String) moduleConfig.get(ENCourseNode.CONFIG_AREANAME); - if(StringHelper.containsNonWhitespace(areaInitVal)) { - areaInitVal = StringHelper.formatAsSortUniqCSVString(Arrays.asList(areaInitVal.split(","))); - areaKeys = this.getAreaKeys(areaInitVal); - } else { - areaKeys = new ArrayList<Long>(); - } + areaKeys = areaManager.toAreaKeys(areaInitVal, cev.getCourseGroupManager().getCourseResource()); } + areaInitVal = getAreaNames(areaKeys); easyAreaList = uifactory.addStaticTextElement("area", null, areaInitVal == null ? "" : areaInitVal, areaChooseSubContainer); easyAreaList.setUserObject(areaKeys); @@ -243,7 +235,7 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener subm = uifactory.addFormSubmitButton("submit", formLayout); - validateGroupFields (); + validateGroupFields(); updateGroupsAndAreasCheck(); } @@ -252,7 +244,7 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener return validateGroupFields(); } - private boolean validateGroupFields () { + private boolean validateGroupFields() { boolean retVal = true; List<Long> activeGroupSelection = null; List<Long> activeAreaSelection = null; @@ -414,7 +406,7 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener // no groups in group management -> directly show group create dialog OLATResource courseResource = cev.getCourseGroupManager().getCourseResource(); - groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), true, courseResource, true, null); + groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), courseResource, true, null); listenTo(groupCreateCntrllr); cmc = new CloseableModalController(getWindowControl(), "close", groupCreateCntrllr.getInitialComponent()); @@ -456,10 +448,7 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener easyGroupList.setEnabled(false); removeAsListenerAndDispose(groupCreateCntrllr); OLATResource courseResource = this.cev.getCourseGroupManager().getCourseResource(); - groupCreateCntrllr = BGControllerFactory.getInstance().createNewBGController( - ureq, getWindowControl(), true, - courseResource, true, csvGroupName[0] - ); + groupCreateCntrllr = new NewBGController(ureq, getWindowControl(), courseResource, true, csvGroupName[0]); listenTo(groupCreateCntrllr); removeAsListenerAndDispose(cmc); @@ -630,53 +619,12 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener private String getAreaNames(List<Long> keys) { StringBuilder sb = new StringBuilder(); - for(Long key:keys) { - BGArea area = areaManager.loadArea(key); - if(area != null) { - if(sb.length() > 0) sb.append(", "); - sb.append(area.getName()); - } + List<BGArea> areas = areaManager.loadAreas(keys); + for(BGArea area:areas) { + if(sb.length() > 0) sb.append(", "); + sb.append(area.getName()); } return sb.toString(); } - - private List<Long> getGroupKeys(String groupNames) { - List<Long> groupKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(groupNames)) { - String[] groupNameArr = groupNames.split(","); - List<BusinessGroup> groups = cev.getCourseGroupManager().getAllLearningGroupsFromAllContexts(); - for(String groupName:groupNameArr) { - groupName = groupName.trim(); - for(BusinessGroup group:groups) { - if(groupName.equalsIgnoreCase(group.getName())) { - groupKeys.add(group.getKey()); - break; - } - } - } - } - return groupKeys; - } - - private List<Long> getAreaKeys(String areaNames) { - List<Long> areaKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(areaNames)) { - List<BGArea> areas = cev.getCourseGroupManager().getAllAreasFromAllContexts(); - String[] areaNameArr = areaNames.split(","); - StringBuilder sb = new StringBuilder(); - for(String areaName:areaNameArr) { - areaName = areaName.trim(); - for(BGArea area:areas) { - if(areaName.equalsIgnoreCase(area.getName())) { - if(sb.length() > 0) { - sb.append(','); - } - sb.append(area.getKey()); - break; - } - } - } - } - return areaKeys; - } + } 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 3fff6497749fb9685ec38ff0aa27b7afce50193c..7e87379ee5954b3dc55228ef2427f92fcddb1863 100644 --- a/src/main/java/org/olat/course/nodes/en/ENRunController.java +++ b/src/main/java/org/olat/course/nodes/en/ENRunController.java @@ -25,7 +25,6 @@ package org.olat.course.nodes.en; -import java.util.ArrayList; import java.util.List; import org.olat.core.CoreSpringFactory; @@ -45,7 +44,6 @@ import org.olat.core.gui.control.controller.BasicController; import org.olat.core.id.Identity; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; -import org.olat.core.util.StringHelper; import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.event.GenericEventListener; import org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent; @@ -55,7 +53,8 @@ import org.olat.course.nodes.ObjectivesHelper; import org.olat.course.properties.CoursePropertyManager; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.group.BusinessGroup; -import org.olat.group.area.BGArea; +import org.olat.group.BusinessGroupService; +import org.olat.group.area.BGAreaManager; import org.olat.group.ui.BusinessGroupTableModelWithMaxSize; import org.olat.modules.ModuleConfiguration; import org.olat.util.logging.activity.LoggingResourceable; @@ -89,8 +88,10 @@ public class ENRunController extends BasicController implements GenericEventList private TableController tableCtr; // Managers + private final BGAreaManager areaManager; private final EnrollmentManager enrollmentManager; private final CourseGroupManager courseGroupManager; + private final BusinessGroupService businessGroupService; private final CoursePropertyManager coursePropertyManager; // workflow variables @@ -114,9 +115,10 @@ public class ENRunController extends BasicController implements GenericEventList this.enNode = enNode; addLoggingResourceable(LoggingResourceable.wrap(enNode)); - //this.trans = new PackageTranslator(PACKAGE, ureq.getLocale()); // init managers + areaManager = CoreSpringFactory.getImpl(BGAreaManager.class); enrollmentManager = CoreSpringFactory.getImpl(EnrollmentManager.class); + businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); courseGroupManager = userCourseEnv.getCourseEnvironment().getCourseGroupManager(); coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager(); @@ -124,21 +126,13 @@ public class ENRunController extends BasicController implements GenericEventList enrollableGroupKeys = (List<Long>)moduleConfig.get(ENCourseNode.CONFIG_GROUP_IDS); if(enrollableGroupKeys == null) { String groupNamesConfig = (String)moduleConfig.get(ENCourseNode.CONFIG_GROUPNAME); - if(StringHelper.containsNonWhitespace(groupNamesConfig)) { - enrollableGroupKeys = getGroupKeys(groupNamesConfig); - } else { - enrollableGroupKeys = new ArrayList<Long>(); - } + enrollableGroupKeys = businessGroupService.toGroupKeys(groupNamesConfig, courseGroupManager.getCourseResource()); } enrollableAreaKeys = (List<Long>)moduleConfig.get(ENCourseNode.CONFIG_AREA_IDS); if(enrollableAreaKeys != null) { String areaInitVal = (String) moduleConfig.get(ENCourseNode.CONFIG_AREANAME); - if(StringHelper.containsNonWhitespace(areaInitVal)) { - enrollableAreaKeys = getAreaKeys(areaInitVal); - } else { - enrollableAreaKeys = new ArrayList<Long>(); - } + enrollableAreaKeys = areaManager.toAreaKeys(areaInitVal, courseGroupManager.getCourseResource()); } cancelEnrollEnabled = ((Boolean) moduleConfig.get(ENCourseNode.CONF_CANCEL_ENROLL_ENABLED)).booleanValue(); @@ -310,49 +304,4 @@ public class ENRunController extends BasicController implements GenericEventList CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, group); } } - - - ////////////////// - // Helper Methods - ////////////////// - private List<Long> getGroupKeys(String groupNames) { - List<Long> groupKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(groupNames)) { - String[] groupNameArr = groupNames.split(","); - List<BusinessGroup> groups = courseGroupManager.getAllLearningGroupsFromAllContexts(); - for(String groupName:groupNameArr) { - groupName = groupName.trim(); - for(BusinessGroup group:groups) { - if(groupName.equalsIgnoreCase(group.getName())) { - groupKeys.add(group.getKey()); - break; - } - } - } - } - return groupKeys; - } - - private List<Long> getAreaKeys(String areaNames) { - List<Long> areaKeys = new ArrayList<Long>(); - if(StringHelper.containsNonWhitespace(areaNames)) { - List<BGArea> areas = courseGroupManager.getAllAreasFromAllContexts(); - String[] areaNameArr = areaNames.split(","); - StringBuilder sb = new StringBuilder(); - for(String areaName:areaNameArr) { - areaName = areaName.trim(); - for(BGArea area:areas) { - if(areaName.equalsIgnoreCase(area.getName())) { - if(sb.length() > 0) { - sb.append(','); - } - sb.append(area.getKey()); - break; - } - } - } - } - return areaKeys; - } - } \ No newline at end of file diff --git a/src/main/java/org/olat/course/nodes/en/ENWebService.java b/src/main/java/org/olat/course/nodes/en/ENWebService.java index bf91211ff6b79609d75f76c6e7779904987b9205..f7105da433841e42e9543004b05dd8470500a19e 100644 --- a/src/main/java/org/olat/course/nodes/en/ENWebService.java +++ b/src/main/java/org/olat/course/nodes/en/ENWebService.java @@ -182,7 +182,7 @@ public class ENWebService extends AbstractCourseNodeWebService { String[] groupeNameArr = groupeNames.split(","); CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); for(String groupeName:groupeNameArr) { - List<BusinessGroup> groups = cgm.getLearningGroupsFromAllContexts(groupeName); + List<BusinessGroup> groups = cgm.getBusinessGroups(groupeName); for(BusinessGroup group:groups) { voes.add(get(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 1b61b5a7bd388f42d90511a04a94e1b7b014a656..e9bef180e8435230de8aa828296ba90dbeb07c6a 100644 --- a/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java +++ b/src/main/java/org/olat/course/nodes/en/EnrollmentManager.java @@ -48,7 +48,6 @@ import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.area.BGAreaManager; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGMailHelper; import org.olat.properties.Property; import org.olat.testutils.codepoints.server.Codepoint; @@ -138,13 +137,12 @@ public class EnrollmentManager extends BasicManager { final CoursePropertyManager coursePropertyManager, WindowControl wControl, Translator trans) { if (isLogDebugEnabled()) logDebug("doCancelEnrollment"); // 1. Remove group membership, fire events, do loggin etc. - final BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(enrolledGroup, new SyncerExecutor(){ public void execute() { // Remove participant. This will also check if a waiting-list with auto-close-ranks is configurated // and move the users accordingly - businessGroupService.removeParticipant(identity, identity, enrolledGroup, flags); + businessGroupService.removeParticipant(identity, identity, enrolledGroup); logInfo("doCancelEnrollment in group " + enrolledGroup, identity.getName()); // 2. Remove enrollmentdate property // only remove last time date, not firsttime @@ -221,7 +219,7 @@ public class EnrollmentManager extends BasicManager { if(areaKeys != null && !areaKeys.isEmpty()) { for (Long areaKey:areaKeys) { String areaName = areaKey.toString();//TODO gm - List<BusinessGroup> groups = cgm.getParticipatingLearningGroupsInAreaFromAllContexts(identity, areaName); + List<BusinessGroup> groups = cgm.getParticipatingBusinessGroupsInArea(identity, areaName); if (groups.size() > 0) { // Usually it is only possible to be in one group. However, // theoretically the @@ -295,8 +293,7 @@ public class EnrollmentManager extends BasicManager { CoursePropertyManager coursePropertyManager, WindowControl wControl, Translator trans) { CoordinatorManager.getInstance().getCoordinator().getSyncer().assertAlreadyDoInSyncFor(group); // 1. Add user to group, fire events, do loggin etc. - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - businessGroupService.addParticipant(identity, identity, group, flags); + businessGroupService.addParticipant(identity, identity, group); // 2. Set first enrollment date String nowString = Long.toString(System.currentTimeMillis()); Property firstTime = coursePropertyManager diff --git a/src/main/java/org/olat/course/nodes/info/SendMembersMailOption.java b/src/main/java/org/olat/course/nodes/info/SendMembersMailOption.java index e51cf59377e7f7d56059353819c741d10883c27a..22cebdb1f6fd5d9f785363275796887c0015cadc 100644 --- a/src/main/java/org/olat/course/nodes/info/SendMembersMailOption.java +++ b/src/main/java/org/olat/course/nodes/info/SendMembersMailOption.java @@ -72,11 +72,11 @@ public class SendMembersMailOption implements SendMailOption { public List<Identity> getSelectedIdentities() { Set<Identity> identities = new HashSet<Identity>(); CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); - List<BusinessGroup> learningGroups = cgm.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> learningGroups = cgm.getAllBusinessGroups(); for(BusinessGroup bg:learningGroups) { - List<Identity> participants = cgm.getParticipantsFromLearningGroup(bg.getName()); + List<Identity> participants = cgm.getParticipantsFromBusinessGroup(bg.getName()); identities.addAll(participants); - List<Identity> coaches = cgm.getCoachesFromLearningGroup(bg.getName()); + List<Identity> coaches = cgm.getCoachesFromBusinessGroup(bg.getName()); identities.addAll(coaches); } //fxdiff VCRP-1,2: access control of resources diff --git a/src/main/java/org/olat/course/nodes/members/MembersCourseNodeRunController.java b/src/main/java/org/olat/course/nodes/members/MembersCourseNodeRunController.java index af1c6657b724e4cb31528f23287483c73e5dd2c4..02e16180b086f809be575336e263e838b93b5d0c 100644 --- a/src/main/java/org/olat/course/nodes/members/MembersCourseNodeRunController.java +++ b/src/main/java/org/olat/course/nodes/members/MembersCourseNodeRunController.java @@ -116,10 +116,10 @@ public class MembersCourseNodeRunController extends FormBasicController { ICourse course = CourseFactory.loadCourse(courseResId); RepositoryEntry courseRepositoryEntry = rm.lookupRepositoryEntry(course, true); List<Identity> owners = securityManager.getIdentitiesOfSecurityGroup(courseRepositoryEntry.getOwnerGroup()); - List<Identity> coaches = cgm.getCoachesFromLearningGroup(null); + List<Identity> coaches = cgm.getCoachesFromBusinessGroup(null); //fxdiff VCRP-1,2: access control of resources coaches.addAll(cgm.getCoaches()); - List<Identity> participants = cgm.getParticipantsFromLearningGroup(null); + List<Identity> participants = cgm.getParticipantsFromBusinessGroup(null); participants.addAll(cgm.getParticipants()); Comparator<Identity> idComparator = new IdentityComparator(); Collections.sort(owners, idComparator); diff --git a/src/main/java/org/olat/course/nodes/projectbroker/ProjectBrokerCourseEditorController.java b/src/main/java/org/olat/course/nodes/projectbroker/ProjectBrokerCourseEditorController.java index 09110164db0c3eaa10583ce521c408c1a033a1b1..532c061aec51f894b15caf4bef1a89451e19bb5c 100644 --- a/src/main/java/org/olat/course/nodes/projectbroker/ProjectBrokerCourseEditorController.java +++ b/src/main/java/org/olat/course/nodes/projectbroker/ProjectBrokerCourseEditorController.java @@ -75,7 +75,6 @@ import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupAddResponse; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGMailHelper; import org.olat.modules.ModuleConfiguration; @@ -299,17 +298,16 @@ public class ProjectBrokerCourseEditorController extends ActivateableTabbableDef fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT); return; } else if (source == accountManagerGroupController) { - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); if (event instanceof IdentitiesAddEvent) { IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent)event; - BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), accountManagerGroup, flags); + BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), accountManagerGroup); identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities()); identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission()); identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup()); getLogger().info("Add users as account-managers"); fireEvent(urequest, Event.CHANGED_EVENT ); } else if (event instanceof IdentitiesRemoveEvent) { - businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), accountManagerGroup, flags); + businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), accountManagerGroup); getLogger().info("Remove users as account-managers"); fireEvent(urequest, Event.CHANGED_EVENT ); } diff --git a/src/main/java/org/olat/course/nodes/projectbroker/ProjectGroupController.java b/src/main/java/org/olat/course/nodes/projectbroker/ProjectGroupController.java index 5bbc149e362d3deb26fb21be8a55c39c224a56c9..23593a96223b491177d07f0a8c40d053a3343907 100644 --- a/src/main/java/org/olat/course/nodes/projectbroker/ProjectGroupController.java +++ b/src/main/java/org/olat/course/nodes/projectbroker/ProjectGroupController.java @@ -54,7 +54,6 @@ import org.olat.course.nodes.projectbroker.service.ProjectBrokerManagerFactory; import org.olat.course.nodes.projectbroker.service.ProjectBrokerModuleConfiguration; import org.olat.group.BusinessGroupAddResponse; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; /** * @@ -181,34 +180,32 @@ public class ProjectGroupController extends BasicController { } private void handleProjectMemberGroupEvent(UserRequest urequest, Event event) { - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); if (event instanceof IdentitiesAddEvent) { IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent)event; - BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup(), flags); + BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup()); identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities()); identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission()); identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup()); getLogger().info("Add users as project-members"); fireEvent(urequest, Event.CHANGED_EVENT ); } else if (event instanceof IdentitiesRemoveEvent) { - businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup(), flags); + businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup()); getLogger().info("Remove users as account-managers"); fireEvent(urequest, Event.CHANGED_EVENT ); } } private void handleProjectLeaderGroupEvent(UserRequest urequest, Event event) { - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); if (event instanceof IdentitiesAddEvent) { IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent)event; - BusinessGroupAddResponse response = businessGroupService.addOwners(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup(), flags); + BusinessGroupAddResponse response = businessGroupService.addOwners(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup()); identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities()); identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission()); identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup()); getLogger().info("Add users as project-leader"); fireEvent(urequest, Event.CHANGED_EVENT ); } else if (event instanceof IdentitiesRemoveEvent) { - businessGroupService.removeOwners(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup(), flags); + businessGroupService.removeOwners(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup()); getLogger().info("Remove users as account-managers"); fireEvent(urequest, Event.CHANGED_EVENT ); } diff --git a/src/main/java/org/olat/course/nodes/projectbroker/service/ProjectGroupManagerImpl.java b/src/main/java/org/olat/course/nodes/projectbroker/service/ProjectGroupManagerImpl.java index af238855539961e08c864db95b0381374632eb2c..565214868579e559439e3c2612771f3a3ced1855 100644 --- a/src/main/java/org/olat/course/nodes/projectbroker/service/ProjectGroupManagerImpl.java +++ b/src/main/java/org/olat/course/nodes/projectbroker/service/ProjectGroupManagerImpl.java @@ -51,7 +51,6 @@ import org.olat.course.run.environment.CourseEnvironment; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupAddResponse; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.edit.BusinessGroupModifiedEvent; import org.olat.properties.Property; import org.olat.repository.RepositoryEntry; @@ -267,8 +266,7 @@ public class ProjectGroupManagerImpl extends BasicManager implements ProjectGrou for (final Identity identity : identities) { if (!BaseSecurityManager.getInstance().isIdentityInSecurityGroup(identity, reloadedProject.getProjectGroup().getPartipiciantGroup())) { BaseSecurityManager.getInstance().removeIdentityFromSecurityGroup(identity, reloadedProject.getCandidateGroup()); - final BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); - bgs.addParticipant(actionIdentity, identity, reloadedProject.getProjectGroup(), flags); + bgs.addParticipant(actionIdentity, identity, reloadedProject.getProjectGroup()); logAudit("ProjectBroker: Accept candidate, identity=" + identity + " project=" + reloadedProject); response.getAddedIdentities().add(identity); } else { diff --git a/src/main/java/org/olat/course/repository/ImportCourseController.java b/src/main/java/org/olat/course/repository/ImportCourseController.java index 9abb61c8d5f69a5384fb30ad450d7cd2065bd21e..b7ab3049d1a7af2e21f35e79e09625652786c3b6 100644 --- a/src/main/java/org/olat/course/repository/ImportCourseController.java +++ b/src/main/java/org/olat/course/repository/ImportCourseController.java @@ -125,8 +125,7 @@ public class ImportCourseController extends BasicController implements IAddContr // create group management CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); // import groups - cgm.importCourseLearningGroups(getExportDataDir(course)); - cgm.importCourseRightGroups(getExportDataDir(course)); + cgm.importCourseBusinessGroups(getExportDataDir(course)); return true; } diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index c60e3c2efbeb2d46c42eeb17a735ac3cc38dce10..02631eb46a0317180cf55648e956bd80b3a34f8f 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -1278,9 +1278,9 @@ public class RunMainController extends MainLayoutBasicController implements Gene */ private void initGroupMemberships(Identity identity) { CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); - ownedGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity); - participatedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity); - waitingListGroups = cgm.getWaitingListGroupsFromAllContexts(identity); + ownedGroups = cgm.getOwnedBusinessGroups(identity); + participatedGroups = cgm.getParticipatingBusinessGroups(identity); + waitingListGroups = cgm.getWaitingListGroups(identity); } /** diff --git a/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java b/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java index 933d0051278c5ce4d919587e222593c2ddb13d46..d50320c635248ea16680bd5a9e93e3f73554aca9 100644 --- a/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java +++ b/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java @@ -100,9 +100,9 @@ public class CourseCalendarController extends BasicController { // add course group calendars // learning groups - List<BusinessGroup> ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity); + List<BusinessGroup> ownerGroups = cgm.getOwnedBusinessGroups(identity); addCalendars(ureq, ownerGroups, true, clpc, calendars); - List<BusinessGroup> attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity); + List<BusinessGroup> attendedGroups = cgm.getParticipatingBusinessGroups(identity); for (Iterator<BusinessGroup> ownerGroupsIterator = ownerGroups.iterator(); ownerGroupsIterator.hasNext();) { BusinessGroup ownerGroup = (BusinessGroup) ownerGroupsIterator.next(); if (attendedGroups.contains(ownerGroup)) diff --git a/src/main/java/org/olat/course/run/preview/PreviewCourseGroupManager.java b/src/main/java/org/olat/course/run/preview/PreviewCourseGroupManager.java index 8c93913fe881d2599f83659fc72aa7a45fbcf79a..1e5852d988420aaa39dfb2c477d58ffbc99876bf 100644 --- a/src/main/java/org/olat/course/run/preview/PreviewCourseGroupManager.java +++ b/src/main/java/org/olat/course/run/preview/PreviewCourseGroupManager.java @@ -66,13 +66,6 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou return null; } - /** - * @see org.olat.course.groupsandrights.CourseGroupManager#initGroupContextsList() - */ - public void initGroupContextsList() { - throw new AssertException("unsupported"); - } - /** * @see org.olat.course.groupsandrights.CourseGroupManager#hasRight(org.olat.core.id.Identity, java.lang.String) */ @@ -181,75 +174,62 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou /** * @see org.olat.course.groupsandrights.CourseGroupManager#getAllLearningGroupsFromAllContexts() */ - public List<BusinessGroup> getAllLearningGroupsFromAllContexts() { + public List<BusinessGroup> getAllBusinessGroups() { return groups; } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningGroupsFromAllContexts(java.lang.String) - */ - public List<BusinessGroup> getLearningGroupsFromAllContexts(String groupName) { - throw new AssertException("unsupported"); - } - - /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningGroupsInAreaFromAllContexts(java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getBusinessGroups(java.lang.String) */ - public List<BusinessGroup> getLearningGroupsInAreaFromAllContexts(String areaName) { + public List<BusinessGroup> getBusinessGroups(String groupName) { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity, java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getBusinessGroupsInArea(java.lang.String) */ - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity, String groupName) { + public List<BusinessGroup> getBusinessGroupsInArea(String areaName) { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsInAreaFromAllContexts(org.olat.core.id.Identity, java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroups(org.olat.core.id.Identity, java.lang.String) */ - public List<BusinessGroup> getParticipatingLearningGroupsInAreaFromAllContexts(Identity identity, String araName) { + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity, String groupName) { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedLearningGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroupsInArea(org.olat.core.id.Identity, java.lang.String) */ - public List<BusinessGroup> getOwnedLearningGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getParticipatingBusinessGroupsInArea(Identity identity, String araName) { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedBusinessGroups(org.olat.core.id.Identity) */ - public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getOwnedBusinessGroups(Identity identity) { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingRightGroupsFromAllContexts(org.olat.core.id.Identity) + * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingBusinessGroups(org.olat.core.id.Identity) */ - public List<BusinessGroup> getParticipatingRightGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getParticipatingBusinessGroups(Identity identity) { throw new AssertException("unsupported"); } - - /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getAllRightGroupsFromAllContexts() - */ - public List<BusinessGroup> getAllRightGroupsFromAllContexts() { - return groups; - } - + /** * @see org.olat.course.groupsandrights.CourseGroupManager#getAllAreasFromAllContexts() */ - public List<BGArea> getAllAreasFromAllContexts() { + @Override + public List<BGArea> getAllAreas() { return areas; } @Override - public List<BGArea> getAreasFromContext(String areaname) { + public List<BGArea> getAreas(String areaname) { return areas; } @@ -268,27 +248,27 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueLearningGroupNamesFromAllContexts() + * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueBusinessGroupNames() */ - public List<String> getUniqueLearningGroupNamesFromAllContexts() { + public List<String> getUniqueBusinessGroupNames() { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueAreaNamesFromAllContexts() + * @see org.olat.course.groupsandrights.CourseGroupManager#getUniqueAreaNames() */ - public List<String> getUniqueAreaNamesFromAllContexts() { + public List<String> getUniqueAreaNames() { throw new AssertException("unsupported"); } /** - * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningAreasOfGroupFromAllContexts(java.lang.String) + * @see org.olat.course.groupsandrights.CourseGroupManager#getAreasOfBusinessGroup(java.lang.String) */ - public List<BGArea> getLearningAreasOfGroupFromAllContexts(String groupName) { + public List<BGArea> getAreasOfBusinessGroup(String groupName) { throw new AssertException("unsupported"); } - public List<Identity> getCoachesFromLearningGroup(String groupName) { + public List<Identity> getCoachesFromBusinessGroup(String groupName) { throw new AssertException("unsupported"); } @@ -296,12 +276,12 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou throw new AssertException("unsupported"); } - public List<Identity> getParticipantsFromLearningGroup(String groupName) { + public List<Identity> getParticipantsFromBusinessGroup(String groupName) { throw new AssertException("unsupported"); } @Override - public List<Identity> getCoachesFromLearningGroups(List<Long> groupKeys) { + public List<Identity> getCoachesFromBusinessGroups(List<Long> groupKeys) { throw new AssertException("unsupported"); } @@ -311,7 +291,7 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou } @Override - public List<Identity> getParticipantsFromLearningGroups(List<Long> groupKeys) { + public List<Identity> getParticipantsFromBusinessGroups(List<Long> groupKeys) { throw new AssertException("unsupported"); } @@ -347,15 +327,15 @@ final class PreviewCourseGroupManager extends BasicManager implements CourseGrou throw new AssertException("unsupported"); } - public void exportCourseLeaningGroups(File fExportDirectory) { + public void exportCourseBusinessGroups(File fExportDirectory) { throw new AssertException("unsupported"); } - public void importCourseLearningGroups(File fImportDirectory) { + public void importCourseBusinessGroups(File fImportDirectory) { throw new AssertException("unsupported"); } - public List<BusinessGroup> getWaitingListGroupsFromAllContexts(Identity identity) { + public List<BusinessGroup> getWaitingListGroups(Identity identity) { throw new AssertException("unsupported"); } diff --git a/src/main/java/org/olat/course/run/preview/PreviewRunController.java b/src/main/java/org/olat/course/run/preview/PreviewRunController.java index dc504bd5066c88bf1aec2ae8860d212a950f33d0..f566c8746b2217ff27518e76ea7364efe3b6d8a7 100644 --- a/src/main/java/org/olat/course/run/preview/PreviewRunController.java +++ b/src/main/java/org/olat/course/run/preview/PreviewRunController.java @@ -120,8 +120,8 @@ public class PreviewRunController extends MainLayoutBasicController { detail.contextPut("time", DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale()) .format(new Date(uce.getCourseEnvironment().getCurrentTimeMillis()))); CourseGroupManager cgm = uce.getCourseEnvironment().getCourseGroupManager(); - detail.contextPut("groups", assembleNamesFromGroupList(cgm.getAllLearningGroupsFromAllContexts())); - detail.contextPut("areas", assembleNamesFromAreaList(cgm.getAllAreasFromAllContexts())); + detail.contextPut("groups", assembleNamesFromGroupList(cgm.getAllBusinessGroups())); + detail.contextPut("areas", assembleNamesFromAreaList(cgm.getAllAreas())); detail.contextPut("asRole",role); previewLayoutCtr.setCol3(detail); } diff --git a/src/main/java/org/olat/group/BusinessGroupService.java b/src/main/java/org/olat/group/BusinessGroupService.java index 704ba5e7d2ac27509b56ae6c033c1a9b2253b0a8..d52483e839b32c9f5aa223067b2afabb76764728 100644 --- a/src/main/java/org/olat/group/BusinessGroupService.java +++ b/src/main/java/org/olat/group/BusinessGroupService.java @@ -36,7 +36,6 @@ import org.olat.group.model.AddToGroupsEvent; import org.olat.group.model.BGRepositoryEntryRelation; import org.olat.group.model.DisplayMembers; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.repository.RepositoryEntry; import org.olat.resource.OLATResource; @@ -73,7 +72,7 @@ public interface BusinessGroupService { * @return */ public BusinessGroup createBusinessGroup(Identity creator, String name, String description, - int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, + Integer minParticipants, Integer maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, OLATResource resource); /** @@ -88,7 +87,7 @@ public interface BusinessGroupService { * @param resource * @return */ - public Set<BusinessGroup> createUniqueBusinessGroupsFor(Set<String> allNames, String description, int minParticipants, int maxParticipants, + public Set<BusinessGroup> createUniqueBusinessGroupsFor(Set<String> allNames, String description, Integer minParticipants, Integer maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, OLATResource resource); /** @@ -254,6 +253,8 @@ public interface BusinessGroupService { public List<BusinessGroup> findBusinessGroups(SearchBusinessGroupParams params, OLATResource resource, int firstResult, int maxResults); + public List<Long> toGroupKeys(String groupNames, OLATResource resource); + //check public boolean checkIfOneOrMoreNameExists(Set<String> names, OLATResource resource); @@ -301,7 +302,7 @@ public interface BusinessGroupService { * @param flags * @return */ - public BusinessGroupAddResponse addOwners(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup group, BGConfigFlags flags); + public BusinessGroupAddResponse addOwners(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup group); /** * Remove a list of users from a group as owner and does all the magic that needs to be @@ -312,7 +313,7 @@ public interface BusinessGroupService { * @param group * @param flags */ - public void removeOwners(Identity ureqIdentity, Collection<Identity> identitiesToRemove, BusinessGroup group, BGConfigFlags flags); + public void removeOwners(Identity ureqIdentity, Collection<Identity> identitiesToRemove, BusinessGroup group); /** * Adds a user to a group as participant and does all the magic that needs to @@ -323,7 +324,7 @@ public interface BusinessGroupService { * @param group * @param flags */ - public void addParticipant(Identity ureqIdentity, Identity identityToAdd, BusinessGroup group, BGConfigFlags flags); + public void addParticipant(Identity ureqIdentity, Identity identityToAdd, BusinessGroup group); /** * Adds a list of users to a group as participant and does all the magic that needs to @@ -335,7 +336,7 @@ public interface BusinessGroupService { * @param flags * @return */ - public BusinessGroupAddResponse addParticipants(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup currBusinessGroup, BGConfigFlags flags); + public BusinessGroupAddResponse addParticipants(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup currBusinessGroup); /** * Remove a user from a group as participant and does all the magic that needs @@ -346,7 +347,7 @@ public interface BusinessGroupService { * @param group * @param flags */ - public void removeParticipant(Identity ureqIdentity, Identity identity, BusinessGroup group, BGConfigFlags flags); + public void removeParticipant(Identity ureqIdentity, Identity identity, BusinessGroup group); /** * Remove a list of users from a group as participant and does all the magic that needs @@ -357,7 +358,7 @@ public interface BusinessGroupService { * @param group * @param flags */ - public void removeParticipants(Identity ureqIdentity, List<Identity> identities, BusinessGroup group, BGConfigFlags flags); + public void removeParticipants(Identity ureqIdentity, List<Identity> identities, BusinessGroup group); /** * Adds a user to a waiting-list of a group and does all the magic that needs to @@ -379,7 +380,7 @@ public interface BusinessGroupService { * @param flags * @return */ - public BusinessGroupAddResponse addToWaitingList(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup currBusinessGroup, BGConfigFlags flags); + public BusinessGroupAddResponse addToWaitingList(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup currBusinessGroup); @@ -406,7 +407,7 @@ public interface BusinessGroupService { * @param currBusinessGroup * @param flags */ - public void removeFromWaitingList(Identity ureqIdentity, List<Identity> identities, BusinessGroup currBusinessGroup, BGConfigFlags flags); + public void removeFromWaitingList(Identity ureqIdentity, List<Identity> identities, BusinessGroup currBusinessGroup); /** * Move users from a waiting-list to participant-list. @@ -416,7 +417,7 @@ public interface BusinessGroupService { * @param flags * @return */ - public BusinessGroupAddResponse moveIdentityFromWaitingListToParticipant(List<Identity> identities, Identity ureqIdentity, BusinessGroup currBusinessGroup, BGConfigFlags flags); + public BusinessGroupAddResponse moveIdentityFromWaitingListToParticipant(List<Identity> identities, Identity ureqIdentity, BusinessGroup currBusinessGroup); public BusinessGroupAddResponse addToSecurityGroupAndFireEvent(Identity ureqIdentity, List<Identity> addIdentities, SecurityGroup secGroup); diff --git a/src/main/java/org/olat/group/area/BGAreaManager.java b/src/main/java/org/olat/group/area/BGAreaManager.java index bdd251cd8965cd98de793ba3514df13a16501680..3aaad692b00bf8124bbb9b85235c379ee426fd45 100644 --- a/src/main/java/org/olat/group/area/BGAreaManager.java +++ b/src/main/java/org/olat/group/area/BGAreaManager.java @@ -230,6 +230,13 @@ public interface BGAreaManager { */ public boolean existArea(String nameOrKey, OLATResource resource); + /** + * Retrieve the area's primary keys from the name + * @param areaNames + * @return + */ + public List<Long> toAreaKeys(String areaNames, OLATResource resource); + public File archiveAreaMembers(OLATResource resource, List<String> columnList, List<BGArea> areaList, String archiveType, Locale locale, String charset); } \ No newline at end of file diff --git a/src/main/java/org/olat/group/area/BGAreaManagerImpl.java b/src/main/java/org/olat/group/area/BGAreaManagerImpl.java index c612cbdd57cb7b6b7ea9984d35d5bd5a5cb6aac9..b2eebfa5760302049eb9ec020ca6d4ece2b5d90e 100644 --- a/src/main/java/org/olat/group/area/BGAreaManagerImpl.java +++ b/src/main/java/org/olat/group/area/BGAreaManagerImpl.java @@ -422,6 +422,32 @@ public class BGAreaManagerImpl extends BasicManager implements BGAreaManager { .getSingleResult(); return count.intValue() > 0; } + + + + @Override + public List<Long> toAreaKeys(String areaNames, OLATResource resource) { + if(!StringHelper.containsNonWhitespace(areaNames)) return Collections.emptyList(); + + String[] areaNameArr = areaNames.split(","); + List<String> areaNameList = new ArrayList<String>(); + for(String areaName:areaNameArr) { + areaNameList.add(areaName.trim()); + } + + if(areaNameList.isEmpty()) return Collections.emptyList(); + + StringBuilder sb = new StringBuilder(); + sb.append("select area.key from ").append(BGAreaImpl.class.getName()).append(" area") + .append(" where area.resource.key=:resourceKey and area.name in (:names)"); + + List<Long> keys = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Long.class) + .setParameter("resourceKey", resource.getKey()) + .setParameter("names", areaNameList) + .setHint("org.hibernate.cacheable", Boolean.TRUE) + .getResultList(); + return keys; + } /** * Creates an area object and persists the object in the database diff --git a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java index d64ebb1f728f60b6c533623e3ca3e8a2ea85c9d7..500cc6ed45701ae89bc64feaa609e0d9cdfe34ee 100644 --- a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java +++ b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java @@ -77,7 +77,7 @@ public class BusinessGroupDAO { private BusinessGroupPropertyDAO businessGroupPropertyManager; public BusinessGroup createAndPersist(Identity creator, String name, String description, - int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, + Integer minParticipants, Integer maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, boolean showOwners, boolean showParticipants, boolean showWaitingList) { BusinessGroupImpl businessgroup = null; @@ -87,10 +87,10 @@ public class BusinessGroupDAO { SecurityGroup waitingGroup = securityManager.createAndPersistSecurityGroup(); businessgroup = new BusinessGroupImpl(name, description, ownerGroup, participantGroup, waitingGroup); - if(minParticipants >= 0) { + if(minParticipants != null && minParticipants.intValue() >= 0) { businessgroup.setMinParticipants(minParticipants); } - if(maxParticipants > 0) { + if(maxParticipants != null && maxParticipants.intValue() > 0) { businessgroup.setMaxParticipants(maxParticipants); } @@ -343,7 +343,7 @@ public class BusinessGroupDAO { return res.get(0); } - public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(Identity identity, OLATResource resource) { + public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(Identity identity, OLATResource resource) { StringBuilder sb = new StringBuilder(); if(resource == null) { sb.append("select bgs from ").append(BusinessGroupImpl.class.getName()).append(" as bgs ") @@ -374,6 +374,29 @@ public class BusinessGroupDAO { return groups; } + public List<Long> toGroupKeys(String groupNames, OLATResource resource) { + if(!StringHelper.containsNonWhitespace(groupNames)) return Collections.emptyList(); + + String[] groupNameArr = groupNames.split(","); + List<String> names = new ArrayList<String>(); + for(String name:groupNameArr) { + names.add(name.trim()); + } + + if(names.isEmpty()) return Collections.emptyList(); + + StringBuilder sb = new StringBuilder(); + sb.append("select bgs.key from ").append(BusinessGroupImpl.class.getName()).append(" as bgs ") + .append(" where bgs.resource.key =:resourceKey and bgs.name in (:names)"); + + List<Long> keys = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Long.class) + .setParameter("resourceKey", resource.getKey()) + .setParameter("names", names) + .setHint("org.hibernate.cacheable", Boolean.TRUE) + .getResultList(); + return keys; + } + public int countBusinessGroups(SearchBusinessGroupParams params, OLATResource resource) { TypedQuery<Number> query = createFindDBQuery(params, resource, Number.class) .setHint("org.hibernate.cacheable", Boolean.TRUE); diff --git a/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java index 94fca7312239a5c30d0b472ee4f5ce4fb9cf5853..6ea1eb90d6484db3bcf9b44b8633ee74ac8b8fa7 100644 --- a/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java +++ b/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java @@ -136,8 +136,9 @@ public class BusinessGroupRelationDAO { public int countMembersOf(OLATResource resource, boolean owner, boolean attendee) { if(!owner && !attendee) return 0; - TypedQuery<Number> query = createMembersDBQuery(resource, owner, attendee, Number.class); - Number count = query.getSingleResult(); + Number count = createMembersDBQuery(resource, owner, attendee, Number.class) + .setHint("org.hibernate.cacheable", Boolean.TRUE) + .getSingleResult(); return count.intValue(); } @@ -223,6 +224,7 @@ public class BusinessGroupRelationDAO { Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class) .setParameter("groupKey", group.getKey()) + .setHint("org.hibernate.cacheable", Boolean.TRUE) .getSingleResult(); return count.intValue(); } diff --git a/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java b/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java index 20f5da30c8b077af2f9195050b942d618146f4b9..eebad09a92cdbf2f7aa30f0e537800702b1ae874 100644 --- a/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java +++ b/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java @@ -79,7 +79,6 @@ import org.olat.group.model.BGRepositoryEntryRelation; import org.olat.group.model.DisplayMembers; import org.olat.group.model.SearchBusinessGroupParams; import org.olat.group.right.BGRightManager; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGMailHelper; import org.olat.group.ui.edit.BusinessGroupModifiedEvent; import org.olat.instantMessaging.InstantMessagingModule; @@ -182,7 +181,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public BusinessGroup createBusinessGroup(Identity creator, String name, String description, - int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, + Integer minParticipants, Integer maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled, OLATResource resource) { if(resource != null) { @@ -208,7 +207,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public Set<BusinessGroup> createUniqueBusinessGroupsFor(final Set<String> allNames, final String description, - final int minParticipants, final int maxParticipants, final boolean waitingListEnabled, final boolean autoCloseRanksEnabled, + final Integer minParticipants, final Integer maxParticipants, final boolean waitingListEnabled, final boolean autoCloseRanksEnabled, final OLATResource resource) { //o_clusterOK by:cg @@ -264,7 +263,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD bg.setMaxParticipants(new Integer(minParticipants)); bg.setMinParticipants(new Integer(maxParticipants)); bg.setWaitingListEnabled(waitingList); - if (waitingList.booleanValue() && (bg.getWaitingGroup() == null) ) { + if (waitingList != null && waitingList.booleanValue() && bg.getWaitingGroup() == null) { // Waitinglist is enabled but not created => Create waitingGroup SecurityGroup waitingGroup = securityManager.createAndPersistSecurityGroup(); bg.setWaitingGroup(waitingGroup); @@ -479,6 +478,12 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD return businessGroupDAO.findBusinessGroups(params, resource, firstResult, maxResults); } + @Override + @Transactional(readOnly=true) + public List<Long> toGroupKeys(String groupNames, OLATResource resource) { + return businessGroupDAO.toGroupKeys(groupNames, resource); + } + @Override @Transactional(readOnly=true) public int countContacts(Identity identity) { @@ -678,7 +683,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } @Override - public BusinessGroupAddResponse addOwners(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup group, BGConfigFlags flags) { + public BusinessGroupAddResponse addOwners(Identity ureqIdentity, List<Identity> addIdentities, BusinessGroup group) { BusinessGroupAddResponse response = new BusinessGroupAddResponse(); for (Identity identity : addIdentities) { group = loadBusinessGroup(group); // reload business group @@ -692,7 +697,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD response.getIdentitiesAlreadyInGroup().add(identity); } else { // identity has permission and is not already in group => add it - addOwner(ureqIdentity, identity, group, flags); + addOwner(ureqIdentity, identity, group); response.getAddedIdentities().add(identity); log.audit("added identity '" + identity.getName() + "' to securitygroup with key " + group.getOwnerGroup().getKey()); } @@ -700,7 +705,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD return response; } - private void addOwner(Identity ureqIdentity, Identity identity, BusinessGroup group, BGConfigFlags flags) { + private void addOwner(Identity ureqIdentity, Identity identity, BusinessGroup group) { //fxdiff VCRP-1,2: access control of resources List<RepositoryEntry> res = businessGroupRelationDAO.findRepositoryEntries(Collections.singletonList(group), 0, 1); for(RepositoryEntry re:res) { @@ -715,7 +720,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD securityManager.addIdentityToSecurityGroup(identity, group.getOwnerGroup()); // add user to buddies rosters - addToRoster(ureqIdentity, identity, group, flags); + addToRoster(ureqIdentity, identity, group); // notify currently active users of this business group BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, group, identity); // do logging @@ -724,7 +729,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } @Override - public void addParticipant(Identity ureqIdentity, Identity identityToAdd, BusinessGroup group, BGConfigFlags flags) { + public void addParticipant(Identity ureqIdentity, Identity identityToAdd, BusinessGroup group) { CoordinatorManager.getInstance().getCoordinator().getSyncer().assertAlreadyDoInSyncFor(group); //fxdiff VCRP-1,2: access control of resources @@ -741,7 +746,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD securityManager.addIdentityToSecurityGroup(identityToAdd, group.getPartipiciantGroup()); // add user to buddies rosters - addToRoster(ureqIdentity, identityToAdd, group, flags); + addToRoster(ureqIdentity, identityToAdd, group); // notify currently active users of this business group BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, group, identityToAdd); // do logging @@ -751,7 +756,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public BusinessGroupAddResponse addParticipants(final Identity ureqIdentity, final List<Identity> addIdentities, - final BusinessGroup group, final BGConfigFlags flags) { + final BusinessGroup group) { final BusinessGroupAddResponse response = new BusinessGroupAddResponse(); CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerExecutor(){ @@ -768,7 +773,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD response.getIdentitiesAlreadyInGroup().add(identity); } else { // identity has permission and is not already in group => add it - addParticipant(ureqIdentity, identity, currBusinessGroup, flags); + addParticipant(ureqIdentity, identity, currBusinessGroup); response.getAddedIdentities().add(identity); log.audit("added identity '" + identity.getName() + "' to securitygroup with key " + currBusinessGroup.getPartipiciantGroup().getKey()); } @@ -778,7 +783,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } @Override - public void removeParticipant(Identity ureqIdentity, Identity identity, BusinessGroup group, BGConfigFlags flags) { + public void removeParticipant(Identity ureqIdentity, Identity identity, BusinessGroup group) { CoordinatorManager.getInstance().getCoordinator().getSyncer().assertAlreadyDoInSyncFor(group); //fxdiff VCRP-2: access control @@ -791,7 +796,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD securityManager.removeIdentityFromSecurityGroup(identity, group.getPartipiciantGroup()); // remove user from buddies rosters - removeFromRoster(identity, group, flags); + removeFromRoster(identity, group); //remove subsciptions if user gets removed removeSubscriptions(identity, group); @@ -803,18 +808,18 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD // Check if a waiting-list with auto-close-ranks is configurated if ( group.getWaitingListEnabled().booleanValue() && group.getAutoCloseRanksEnabled().booleanValue() ) { // even when doOnlyPostRemovingStuff is set to true we really transfer the first Identity here - transferFirstIdentityFromWaitingToParticipant(ureqIdentity, group, flags); + transferFirstIdentityFromWaitingToParticipant(ureqIdentity, group); } // send notification mail in your controller! } @Override - public void removeParticipants(final Identity ureqIdentity, final List<Identity> identities, final BusinessGroup group, final BGConfigFlags flags) { + public void removeParticipants(final Identity ureqIdentity, final List<Identity> identities, final BusinessGroup group) { CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerExecutor(){ public void execute() { for (Identity identity : identities) { - removeParticipant(ureqIdentity, identity, group, flags); + removeParticipant(ureqIdentity, identity, group); log.audit("removed identiy '" + identity.getName() + "' from securitygroup with key " + group.getPartipiciantGroup().getKey()); } } @@ -835,7 +840,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public BusinessGroupAddResponse addToWaitingList(final Identity ureqIdentity, final List<Identity> addIdentities, - final BusinessGroup group, final BGConfigFlags flags) { + final BusinessGroup group) { final BusinessGroupAddResponse response = new BusinessGroupAddResponse(); final BusinessGroup currBusinessGroup = loadBusinessGroup(group); // reload business group @@ -873,8 +878,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } @Override - public void removeFromWaitingList(final Identity ureqIdentity, final List<Identity> identities, final BusinessGroup currBusinessGroup, - final BGConfigFlags flags) { + public void removeFromWaitingList(final Identity ureqIdentity, final List<Identity> identities, final BusinessGroup currBusinessGroup) { CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(currBusinessGroup, new SyncerExecutor(){ public void execute() { for (Identity identity : identities) { @@ -902,7 +906,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public BusinessGroupAddResponse moveIdentityFromWaitingListToParticipant(final List<Identity> identities, final Identity ureqIdentity, - final BusinessGroup currBusinessGroup, final BGConfigFlags flags) { + final BusinessGroup currBusinessGroup) { final BusinessGroupAddResponse response = new BusinessGroupAddResponse(); CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(currBusinessGroup,new SyncerExecutor(){ @@ -911,7 +915,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD // check if idenity is allready in participant if (!securityManager.isIdentityInSecurityGroup(identity,currBusinessGroup.getPartipiciantGroup()) ) { // Idenity is not in participant-list => move idenity from waiting-list to participant-list - addParticipant(ureqIdentity, identity, currBusinessGroup, flags); + addParticipant(ureqIdentity, identity, currBusinessGroup); removeFromWaitingList(ureqIdentity, identity, currBusinessGroup); response.getAddedIdentities().add(identity); // notification mail is handled in controller @@ -957,7 +961,6 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD @Override public String[] addIdentityToGroups(final AddToGroupsEvent groupsEv, final Identity ident, final Identity addingIdentity) { - final BGConfigFlags flags = BGConfigFlags.createBuddyGroupDefaultFlags(); String[] resultTextArgs = new String[2]; boolean addToAnyGroup = false; @@ -974,7 +977,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD if (group != null && !securityManager.isIdentityInSecurityGroup(ident, group.getOwnerGroup())){ // seems not to work, but would be the way to go! // ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(group)); - addOwner(addingIdentity, ident, group, flags); + addOwner(addingIdentity, ident, group); ownerGroupnames += group.getName() + ", "; addToAnyGroup = true; if (!notifyAboutAdd.contains(group.getKey()) && mailKeys.contains(group.getKey())) notifyAboutAdd.add(group.getKey()); @@ -993,7 +996,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD // ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(group)); CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerExecutor(){ public void execute() { - addParticipant(addingIdentity, ident, toAddGroup, flags); + addParticipant(addingIdentity, ident, toAddGroup); }}); participantGroupnames += group.getName() + ", "; addToAnyGroup = true; @@ -1023,7 +1026,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } - private void transferFirstIdentityFromWaitingToParticipant(Identity ureqIdentity, BusinessGroup group, BGConfigFlags flags) { + private void transferFirstIdentityFromWaitingToParticipant(Identity ureqIdentity, BusinessGroup group) { CoordinatorManager.getInstance().getCoordinator().getSyncer().assertAlreadyDoInSyncFor(group); // Check if waiting-list is enabled and auto-rank-up if (group.getWaitingListEnabled().booleanValue() && group.getAutoCloseRanksEnabled().booleanValue()) { @@ -1051,7 +1054,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD // that get triggered in the next two methods to be of ActionType admin // This is needed to make sure the targetIdentity ends up in the o_loggingtable ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin); - addParticipant(ureqIdentity, firstWaitingListIdentity, group, flags); + addParticipant(ureqIdentity, firstWaitingListIdentity, group); removeFromWaitingList(ureqIdentity, firstWaitingListIdentity, group); } finally { ThreadLocalUserActivityLogger.setStickyActionType(formerStickyActionType); @@ -1075,8 +1078,8 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } } - private void addToRoster(Identity ureqIdentity, Identity identity, BusinessGroup group, BGConfigFlags flags) { - if (flags.isEnabled(BGConfigFlags.BUDDYLIST) && InstantMessagingModule.isEnabled()) { + private void addToRoster(Identity ureqIdentity, Identity identity, BusinessGroup group) { + if (InstantMessagingModule.isEnabled()) { //evaluate whether to sync or not boolean syncGroup = InstantMessagingModule.getAdapter().getConfig().isSyncLearningGroups(); //only sync when a group is a certain type and this type is configured that you want to sync it @@ -1090,7 +1093,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } @Override - public void removeOwners(Identity ureqIdentity, Collection<Identity> identitiesToRemove, BusinessGroup group, BGConfigFlags flags) { + public void removeOwners(Identity ureqIdentity, Collection<Identity> identitiesToRemove, BusinessGroup group) { //fxdiff VCRP-2: access control List<RepositoryEntry> entries = businessGroupRelationDAO.findRepositoryEntries(Collections.singletonList(group), 0, -1); for(RepositoryEntry entry:entries) { @@ -1106,7 +1109,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD for(Identity identity:identitiesToRemove) { securityManager.removeIdentityFromSecurityGroup(identity, group.getOwnerGroup()); // remove user from buddies rosters - removeFromRoster(identity, group, flags); + removeFromRoster(identity, group); //remove subsciptions if user gets removed removeSubscriptions(identity, group); @@ -1136,8 +1139,8 @@ public class BusinessGroupServiceImpl implements BusinessGroupService, UserDataD } } - private void removeFromRoster(Identity identity, BusinessGroup group, BGConfigFlags flags) { - if (flags.isEnabled(BGConfigFlags.BUDDYLIST) && InstantMessagingModule.isEnabled()) { + private void removeFromRoster(Identity identity, BusinessGroup group) { + if (InstantMessagingModule.isEnabled()) { // only remove user from roster if not in other security group if (!isIdentityInBusinessGroup(identity, group)) { String groupID = InstantMessagingModule.getAdapter().createChatRoomString(group); diff --git a/src/main/java/org/olat/group/ui/BGConfigFlags.java b/src/main/java/org/olat/group/ui/BGConfigFlags.java deleted file mode 100644 index b1ffc492548ccece3023689ab1c7f849316568cf..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/group/ui/BGConfigFlags.java +++ /dev/null @@ -1,239 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ - -package org.olat.group.ui; - -import java.util.HashMap; -import java.util.Map; - -import org.olat.instantMessaging.InstantMessagingModule; - -/** - * Description:<BR> - * Objects of this class contain configration flags for the various business - * group controllers. See the BGControllerFactory to see which group type has - * which configuration. - * <P> - * Initial Date: Aug 25, 2004 - * - * @author gnaegi - */ -public class BGConfigFlags { - - /** owner group of group enabled */ - public static final String GROUP_OWNERS = "group_owners"; - /** at least one owner is required */ - public static final String GROUP_OWNER_REQURED = "group_owner_required"; - /** group areas enabled */ - public static final String AREAS = "areas"; - /** group rights enabled */ - public static final String RIGHTS = "rights"; - /** group min / max number of participants enabled */ - public static final String GROUP_MINMAX_SIZE = "group_minmax_size"; - /** collaboration tools for goups enabled */ - public static final String GROUP_COLLABTOOLS = "group_collabtools"; - - /** create group functionality enabled */ - public static final String GROUPS_CREATE = "groups_create"; - /** modify group functionality enabled */ - public static final String GROUPS_MODIFY = "groups_modify"; - /** delete group functionality enabled */ - public static final String GROUPS_DELETE = "groups_delete"; - - /** create area functionality enabled */ - public static final String AREAS_CREATE = "areas_create"; - /** modify area functionality enabled */ - public static final String AREAS_MODIFY = "areas_modify"; - /** delete area functionality enabled */ - public static final String AREAS_DELETE = "areas_delete"; - - /** modify rights functionality enabled */ - public static final String RIGHTS_MODIFY = "rights_modify"; - - /** true if the current user is group management administrator */ - public static final String IS_GM_ADMIN = "is.gm.admin"; - - /** - * true if the current admin user is allowed to see all userdata. If set to - * true the user can change the table columns of the user tables and for - * example see the users institutional id. If set to false, only the name, - * firstname, login and email is revealed - */ - public static final String ADMIN_SEE_ALL_USER_DATA = "admin.see.all.user.data"; - - /** GUI option: show or hide back-link in tools * */ - public static final String BACK_SWITCH = "back_switch"; - - /** instant messaging option: synchronize users as buddylist * */ - public static final String BUDDYLIST = "buddylist"; - - /** runtime option: show associated resources / courses * */ - public static final String SHOW_RESOURCES = "show_resources"; - - private Map<String, Boolean> flags; - - /** - * Constructor for a business group configuration flag object - */ - private BGConfigFlags() { - super(); - flags = new HashMap<String, Boolean>(); - } - - /** - * @param flag The configuration flag name - * @param enabled true: enabled, flase: disabled - */ - public void setEnabled(String flag, boolean enabled) { - flags.put(flag, Boolean.valueOf(enabled)); - } - - /** - * @param flag The configuration flag name - * @return true if enabled, false otherwhise - */ - public boolean isEnabled(String flag) { - Boolean result = flags.get(flag); - if (result == null) return false; - return result.booleanValue(); - } - - /** - * Factory method to create the default group configuration object - * - * @return BGConfigFlags - */ - public static BGConfigFlags createBuddyGroupDefaultFlags() { - BGConfigFlags bgFlags = new BGConfigFlags(); - bgFlags.setEnabled(BGConfigFlags.BUDDYLIST, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNERS, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNER_REQURED, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_MINMAX_SIZE, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_COLLABTOOLS, true); - bgFlags.setEnabled(BGConfigFlags.AREAS, false); - bgFlags.setEnabled(BGConfigFlags.RIGHTS, false); - bgFlags.setEnabled(BGConfigFlags.SHOW_RESOURCES, false); - - // security flags - // TODO use callback here to make this right dependent - bgFlags.setEnabled(BGConfigFlags.GROUPS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_CREATE, false); - bgFlags.setEnabled(BGConfigFlags.AREAS_MODIFY, false); - bgFlags.setEnabled(BGConfigFlags.AREAS_DELETE, false); - bgFlags.setEnabled(BGConfigFlags.RIGHTS_MODIFY, false); - bgFlags.setEnabled(BGConfigFlags.ADMIN_SEE_ALL_USER_DATA, false); - - return bgFlags; - } - - /** - * Factory method to create the default group configuration object - * - * @return BGConfigFlags - */ - public static BGConfigFlags createLearningGroupDefaultFlags() { - BGConfigFlags bgFlags = new BGConfigFlags(); - //only sync learning groups with IM server if enabled in olat config file - bgFlags.setEnabled(BGConfigFlags.BUDDYLIST, InstantMessagingModule.isSyncLearningGroups()); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNERS, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNER_REQURED, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_MINMAX_SIZE, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_COLLABTOOLS, true); - bgFlags.setEnabled(BGConfigFlags.AREAS, true); - bgFlags.setEnabled(BGConfigFlags.RIGHTS, false); - bgFlags.setEnabled(BGConfigFlags.SHOW_RESOURCES, true); - - // security flags - // TODO use callback here to make this right dependent - bgFlags.setEnabled(BGConfigFlags.GROUPS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.RIGHTS_MODIFY, false); - bgFlags.setEnabled(BGConfigFlags.ADMIN_SEE_ALL_USER_DATA, true); - - return bgFlags; - } - - /** - * Factory method to create the default group configuration object - * - * @return BGConfigFlags - */ - public static BGConfigFlags createRightGroupDefaultFlags() { - BGConfigFlags bgFlags = new BGConfigFlags(); - bgFlags.setEnabled(BGConfigFlags.BUDDYLIST, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNERS, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNER_REQURED, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_MINMAX_SIZE, false); - bgFlags.setEnabled(BGConfigFlags.GROUP_COLLABTOOLS, true); - bgFlags.setEnabled(BGConfigFlags.AREAS, false); - bgFlags.setEnabled(BGConfigFlags.RIGHTS, true); - bgFlags.setEnabled(BGConfigFlags.SHOW_RESOURCES, true); - - // security flags - // TODO use callback here to make this right dependent - bgFlags.setEnabled(BGConfigFlags.GROUPS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_CREATE, false); - bgFlags.setEnabled(BGConfigFlags.AREAS_MODIFY, false); - bgFlags.setEnabled(BGConfigFlags.AREAS_DELETE, false); - bgFlags.setEnabled(BGConfigFlags.RIGHTS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.ADMIN_SEE_ALL_USER_DATA, false); - - return bgFlags; - } - - - public static BGConfigFlags createGroupDefaultFlags() { - BGConfigFlags bgFlags = new BGConfigFlags(); - bgFlags.setEnabled(BGConfigFlags.BUDDYLIST, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNERS, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_OWNER_REQURED, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_MINMAX_SIZE, true); - bgFlags.setEnabled(BGConfigFlags.GROUP_COLLABTOOLS, true); - bgFlags.setEnabled(BGConfigFlags.AREAS, true); - bgFlags.setEnabled(BGConfigFlags.RIGHTS, true); - bgFlags.setEnabled(BGConfigFlags.SHOW_RESOURCES, true); - - // security flags - // TODO use callback here to make this right dependent - bgFlags.setEnabled(BGConfigFlags.GROUPS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.GROUPS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_CREATE, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.AREAS_DELETE, true); - bgFlags.setEnabled(BGConfigFlags.RIGHTS_MODIFY, true); - bgFlags.setEnabled(BGConfigFlags.ADMIN_SEE_ALL_USER_DATA, true); - - return bgFlags; - } -} diff --git a/src/main/java/org/olat/group/ui/BGControllerFactory.java b/src/main/java/org/olat/group/ui/BGControllerFactory.java index 6ad28605e5f2862330ed59487dfc027949093b34..3df72bce1bce1571f822244f54478e434b25f540 100644 --- a/src/main/java/org/olat/group/ui/BGControllerFactory.java +++ b/src/main/java/org/olat/group/ui/BGControllerFactory.java @@ -87,20 +87,7 @@ public class BGControllerFactory { * @return an edit controller for this busines group */ public BusinessGroupEditController createEditControllerFor(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup) { - //String bgTyp = businessGroup.getType(); - /*if (BusinessGroup.TYPE_BUDDYGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createBuddyGroupDefaultFlags(); - return new BusinessGroupEditController(ureq, wControl, businessGroup, flags); - } else if (BusinessGroup.TYPE_LEARNINGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - return new BusinessGroupEditController(ureq, wControl, businessGroup, flags); - } else if (BusinessGroup.TYPE_RIGHTGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); - return new BusinessGroupEditController(ureq, wControl, businessGroup, flags); - } else {*/ - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - return new BusinessGroupEditController(ureq, wControl, businessGroup, flags); - //} + return new BusinessGroupEditController(ureq, wControl, businessGroup); } // @@ -120,7 +107,6 @@ public class BGControllerFactory { public BusinessGroupMainRunController createRunControllerFor(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean isGMAdmin, String initialViewIdentifier) { - // build up the context path WindowControl bwControl; OLATResourceable businessOres = businessGroup; @@ -131,26 +117,7 @@ public class BGControllerFactory { } else { bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, wControl); } - - - /*String bgTyp = businessGroup.getType(); - if (BusinessGroup.TYPE_BUDDYGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, false); - return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, flags, initialViewIdentifier); - } else if (BusinessGroup.TYPE_LEARNINGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, isGMAdmin); - return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, flags, initialViewIdentifier); - } else if (BusinessGroup.TYPE_RIGHTGROUP.equals(bgTyp)) { - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, isGMAdmin); - return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, flags, initialViewIdentifier); - } else {*/ - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, isGMAdmin); - return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, flags, initialViewIdentifier); - + return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, initialViewIdentifier); } /** @@ -238,8 +205,8 @@ public class BGControllerFactory { * @param groupManager * @return */ - public NewBGController createNewBGController(UserRequest ureq, WindowControl wControl, boolean minMaxEnabled, OLATResource resource){ - return createNewBGController(ureq, wControl, minMaxEnabled, resource, true, null); + public NewBGController createNewBGController(UserRequest ureq, WindowControl wControl, OLATResource resource){ + return createNewBGController(ureq, wControl, resource, true, null); } /** * create controller for (mass) creation of business groups (bulkmode) with @@ -253,26 +220,16 @@ public class BGControllerFactory { * @param csvGroupNames * @return */ - public NewBGController createNewBGController(UserRequest ureq, WindowControl wControl, boolean minMaxEnabled, OLATResource resource, boolean bulkMode, String csvGroupNames){ + public NewBGController createNewBGController(UserRequest ureq, WindowControl wControl, OLATResource resource, boolean bulkMode, String csvGroupNames){ if (resource == null) throw new AssertException("Group context must not be null"); - NewBGController retVal = new NewBGController(ureq, wControl, minMaxEnabled, resource, bulkMode, csvGroupNames); + NewBGController retVal = new NewBGController(ureq, wControl, resource, bulkMode, csvGroupNames); return retVal; } - private BGManagementController createLearningGroupManagementController(UserRequest ureq, WindowControl wControl, OLATResource resource, boolean useBackLink) { // controller configuration - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.BACK_SWITCH, useBackLink); - return new BGManagementController(ureq, wControl, resource, flags); - } - - private BGManagementController createRightGroupManagementController(UserRequest ureq, WindowControl wControl, OLATResource resource, - boolean useBackLink) { - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); - flags.setEnabled(BGConfigFlags.BACK_SWITCH, useBackLink); - return new BGManagementController(ureq, wControl, resource, flags); + return new BGManagementController(ureq, wControl, resource, useBackLink); } /** diff --git a/src/main/java/org/olat/group/ui/BusinessGroupFormController.java b/src/main/java/org/olat/group/ui/BusinessGroupFormController.java index 28e3105481d1a34331ae34b5cfc870651a0c1ca2..0dea7ac77cab177a35302a74245f1fa1fbbab03e 100644 --- a/src/main/java/org/olat/group/ui/BusinessGroupFormController.java +++ b/src/main/java/org/olat/group/ui/BusinessGroupFormController.java @@ -73,7 +73,6 @@ public class BusinessGroupFormController extends FormBasicController { /** * Decides whether minimum and maximum number of group members can be applied. */ - private boolean minMaxEnabled = false; private MultipleSelectionElement enableWaitingList; private MultipleSelectionElement enableAutoCloseRanks; @@ -108,10 +107,9 @@ public class BusinessGroupFormController extends FormBasicController { * @param businessGroup The group object which will be modified by this dialog. * @param minMaxEnabled Decides whether to limit the number of people that can enrol to a group or not */ - public BusinessGroupFormController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean minMaxEnabled) { + public BusinessGroupFormController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup) { super(ureq, wControl, FormBasicController.LAYOUT_DEFAULT); this.businessGroup = businessGroup; - this.minMaxEnabled = minMaxEnabled; businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); initForm(ureq); } @@ -124,10 +122,9 @@ public class BusinessGroupFormController extends FormBasicController { * @param minMaxEnabled Decides whether to limit the number of people that can enrol to a group or not * @param bulkMode when passing group names as CSV you have to set this to true and all groups will be created at once */ - public BusinessGroupFormController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean minMaxEnabled, boolean bulkMode) { + public BusinessGroupFormController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean bulkMode) { super(ureq, wControl, FormBasicController.LAYOUT_DEFAULT); this.businessGroup = businessGroup; - this.minMaxEnabled = minMaxEnabled; this.bulkMode = bulkMode; businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); initForm(ureq); // depends on bulkMode flag @@ -179,17 +176,10 @@ public class BusinessGroupFormController extends FormBasicController { autoCloseValues, null); // Enable only if specification of min and max members is possible - if (minMaxEnabled) { - businessGroupMinimumMembers.setVisible(false); // currently the minimum feature is not enabled - businessGroupMaximumMembers.setVisible(true); - enableWaitingList.setVisible(true); - enableAutoCloseRanks.setVisible(true); - } else { - businessGroupMinimumMembers.setVisible(false); - businessGroupMaximumMembers.setVisible(false); - enableWaitingList.setVisible(false); - enableAutoCloseRanks.setVisible(false); - } + businessGroupMinimumMembers.setVisible(false); // currently the minimum feature is not enabled + businessGroupMaximumMembers.setVisible(true); + enableWaitingList.setVisible(true); + enableAutoCloseRanks.setVisible(true); if ((businessGroup != null) && (!bulkMode)) { businessGroupName.setValue(businessGroup.getName()); @@ -285,14 +275,16 @@ public class BusinessGroupFormController extends FormBasicController { } enableAutoCloseRanks.clearError(); - if (minMaxEnabled && disableWaitingListOk) { + if (disableWaitingListOk) { // 4) Check min / max settings String maxValue = null; - if (StringHelper.containsNonWhitespace(businessGroupMaximumMembers.getValue())) maxValue = businessGroupMaximumMembers - .getValue(); + if (StringHelper.containsNonWhitespace(businessGroupMaximumMembers.getValue())) { + maxValue = businessGroupMaximumMembers.getValue(); + } String minValue = null; - if (StringHelper.containsNonWhitespace(businessGroupMinimumMembers.getValue())) minValue = businessGroupMinimumMembers - .getValue(); + if (StringHelper.containsNonWhitespace(businessGroupMinimumMembers.getValue())){ + minValue = businessGroupMinimumMembers.getValue(); + } if (isWaitingListEnabled() && (maxValue == null || minValue == "")) { enableWaitingList.setErrorKey("create.form.error.enableWaitinglist", new String[] {}); return false; @@ -378,26 +370,26 @@ public class BusinessGroupFormController extends FormBasicController { /** * @return */ - public int getGroupMax() { + public Integer getGroupMax() { String result = businessGroupMaximumMembers.getValue(); if (StringHelper.containsNonWhitespace(result)) { result = result.replaceAll(" ", ""); return Integer.parseInt(result); } else { - return -1; + return null; } } /** * @return */ - public int getGroupMin() { + public Integer getGroupMin() { String result = businessGroupMinimumMembers.getValue(); if (StringHelper.containsNonWhitespace(result)) { result = result.replaceAll(" ", ""); return Integer.parseInt(result); } else { - return -1; + return null; } } @@ -424,7 +416,9 @@ public class BusinessGroupFormController extends FormBasicController { * @param enableAutoCloseRanks */ public void setEnableAutoCloseRanks(Boolean enableAutoCloseRanks) { - this.enableAutoCloseRanks.select("create.form.enableAutoCloseRanks", enableAutoCloseRanks); + if(enableAutoCloseRanks != null) { + this.enableAutoCloseRanks.select("create.form.enableAutoCloseRanks", enableAutoCloseRanks.booleanValue()); + } } /** @@ -438,7 +432,9 @@ public class BusinessGroupFormController extends FormBasicController { * @param enableWaitingList */ public void setEnableWaitingList(Boolean enableWaitingList) { - this.enableWaitingList.select("create.form.enableWaitinglist", enableWaitingList); + if(enableWaitingList != null) { + this.enableWaitingList.select("create.form.enableWaitinglist", enableWaitingList.booleanValue()); + } } /** diff --git a/src/main/java/org/olat/group/ui/BusinessGroupTableModel.java b/src/main/java/org/olat/group/ui/BusinessGroupTableModel.java index eaf48cfc64929e847aa806ce17d0d48b6263c81e..4891fe40dcfbab0a00a3582d0866b57d5d1ea983 100644 --- a/src/main/java/org/olat/group/ui/BusinessGroupTableModel.java +++ b/src/main/java/org/olat/group/ui/BusinessGroupTableModel.java @@ -40,14 +40,14 @@ import org.olat.group.BusinessGroup; * @author patrick */ -public class BusinessGroupTableModel extends DefaultTableDataModel { +public class BusinessGroupTableModel extends DefaultTableDataModel<BusinessGroup> { private static final int COLUMN_COUNT = 3; /** * @param owned list of business groups */ - public BusinessGroupTableModel(List owned) { - super(owned); + public BusinessGroupTableModel(List<BusinessGroup> groups) { + super(groups); } /** @@ -61,7 +61,7 @@ public class BusinessGroupTableModel extends DefaultTableDataModel { * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int) */ public Object getValueAt(int row, int col) { - BusinessGroup businessGroup = (BusinessGroup) objects.get(row); + BusinessGroup businessGroup = objects.get(row); switch (col) { case 0: String name = businessGroup.getName(); @@ -77,19 +77,13 @@ public class BusinessGroupTableModel extends DefaultTableDataModel { } } - /** - * @param owned - */ - public void setEntries(List owned) { - this.objects = owned; - } /** * @param row * @return the business group at the given row */ public BusinessGroup getBusinessGroupAt(int row) { - return (BusinessGroup) objects.get(row); + return objects.get(row); } public void removeBusinessGroup(BusinessGroup businessGroup) { diff --git a/src/main/java/org/olat/group/ui/NewBGController.java b/src/main/java/org/olat/group/ui/NewBGController.java index 3d3927cabf969d3c4677880ac5b745d40984c690..38a7d6bef98fb94eb678f85c34e5e4875ed74531 100644 --- a/src/main/java/org/olat/group/ui/NewBGController.java +++ b/src/main/java/org/olat/group/ui/NewBGController.java @@ -71,8 +71,8 @@ public class NewBGController extends BasicController { * @param bgContext * @param bulkMode */ - NewBGController(UserRequest ureq, WindowControl wControl, boolean minMaxEnabled, OLATResource resource){ - this(ureq,wControl,minMaxEnabled,resource,true,null); + public NewBGController(UserRequest ureq, WindowControl wControl, OLATResource resource) { + this(ureq, wControl, resource, true, null); } /** * @@ -83,7 +83,7 @@ public class NewBGController extends BasicController { * @param bulkMode * @param csvGroupNames */ - public NewBGController(UserRequest ureq, WindowControl wControl, boolean minMaxEnabled, OLATResource resource, boolean bulkMode, String csvGroupNames) { + public NewBGController(UserRequest ureq, WindowControl wControl, OLATResource resource, boolean bulkMode, String csvGroupNames) { super(ureq, wControl); this.resource = resource; this.bulkMode = bulkMode; @@ -92,7 +92,7 @@ public class NewBGController extends BasicController { contentVC = createVelocityContainer("bgform"); contentVC.contextPut("bulkMode", bulkMode ? Boolean.TRUE : Boolean.FALSE); - groupCreateController = new BusinessGroupFormController(ureq, wControl, null, minMaxEnabled, bulkMode); + groupCreateController = new BusinessGroupFormController(ureq, wControl, null, bulkMode); listenTo(groupCreateController); contentVC.put("groupForm", groupCreateController.getInitialComponent()); if (csvGroupNames != null) { @@ -119,8 +119,8 @@ public class NewBGController extends BasicController { String bgDesc = groupCreateController.getGroupDescription(); Integer bgMax = groupCreateController.getGroupMax(); Integer bgMin = groupCreateController.getGroupMin(); - Boolean enableWaitingList = groupCreateController.isWaitingListEnabled(); - Boolean enableAutoCloseRanks = groupCreateController.isAutoCloseRanksEnabled(); + boolean enableWaitingList = groupCreateController.isWaitingListEnabled(); + boolean enableAutoCloseRanks = groupCreateController.isAutoCloseRanksEnabled(); Set<String> allNames = new HashSet<String>(); if (bulkMode) { diff --git a/src/main/java/org/olat/group/ui/edit/BusinessGroupEditController.java b/src/main/java/org/olat/group/ui/edit/BusinessGroupEditController.java index 61ec990bc3bbf70156738dea5bd11dc6a0bbf43b..9d0d7e08936a6dfa628f16feb65e4b825a90bdaf 100644 --- a/src/main/java/org/olat/group/ui/edit/BusinessGroupEditController.java +++ b/src/main/java/org/olat/group/ui/edit/BusinessGroupEditController.java @@ -55,6 +55,7 @@ import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.gui.control.generic.modal.DialogBoxController; import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; import org.olat.core.id.Identity; +import org.olat.core.id.Roles; import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.StateEntry; @@ -82,7 +83,6 @@ import org.olat.group.area.BGAreaManager; import org.olat.group.model.DisplayMembers; import org.olat.group.right.BGRightManager; import org.olat.group.right.BGRights; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGMailHelper; import org.olat.group.ui.BGTranslatorFactory; import org.olat.group.ui.BusinessGroupFormController; @@ -133,7 +133,6 @@ public class BusinessGroupEditController extends BasicController implements Cont //fxdiff VCRP-1,2: access control of resources private int tabAccessIndex; private BusinessGroupEditAccessController tabAccessCtrl; - private BGConfigFlags flags; private DisplayMemberSwitchForm dmsForm; private LockResult lockEntry; @@ -152,8 +151,7 @@ public class BusinessGroupEditController extends BasicController implements Cont * controller does no type specific stuff implicit just by looking at * the group type. Type specifig features must be flagged. */ - public BusinessGroupEditController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, - BGConfigFlags configurationFlags) { + public BusinessGroupEditController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup) { super(ureq, wControl); // OLAT-4955: setting the stickyActionType here passes it on to any controller defined in the scope of the editor, @@ -167,8 +165,6 @@ public class BusinessGroupEditController extends BasicController implements Cont businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); // Initialize other members - // group - flags = configurationFlags; // Initialize translator: // package translator with default group fallback translators and type // translator @@ -199,29 +195,7 @@ public class BusinessGroupEditController extends BasicController implements Cont //fxdiff VCRP-1,2: access control of resources tabbedPane = new TabbedPane("bgTabbs", ureq.getLocale()); tabbedPane.addListener(this); - vc_tab_bgDetails = createTabDetails(ureq, currBusinessGroup);// modifies vc_tab_bgDetails - tabbedPane.addTab(translate("group.edit.tab.details"), vc_tab_bgDetails); - - vc_tab_bgCTools = createTabCollabTools(ureq, flags); - tabbedPane.addTab(translate("group.edit.tab.collabtools"), vc_tab_bgCTools); - - vc_tab_bgAreas = createTabAreas(); - tabbedPane.addTab(translate("group.edit.tab.areas"), vc_tab_bgAreas); - - vc_tab_bgRights = createTabRights(); - tabbedPane.addTab(translate("group.edit.tab.rights"), vc_tab_bgRights); - - vc_tab_grpmanagement = createTabGroupManagement(ureq); - tabbedPane.addTab(translate("group.edit.tab.members"), vc_tab_grpmanagement); - - resourceController = new BusinessGroupEditResourceController(ureq, getWindowControl(), currBusinessGroup); - listenTo(resourceController); - tabbedPane.addTab(translate("group.edit.tab.resources"), resourceController.getInitialComponent()); - - tabAccessCtrl = new BusinessGroupEditAccessController(ureq, getWindowControl(), currBusinessGroup); - listenTo(tabAccessCtrl); - tabAccessIndex = tabbedPane.addTab(translate("group.edit.tab.accesscontrol"), tabAccessCtrl.getInitialComponent()); - + setAllTabs(ureq); vc_edit = createVelocityContainer("edit"); vc_edit.put("tabbedpane", tabbedPane); String[] title = new String[] { StringEscapeUtils.escapeHtml(currBusinessGroup.getName()) }; @@ -241,6 +215,46 @@ public class BusinessGroupEditController extends BasicController implements Cont tabbedPane.addToHistory(ureq, wControl); } } + + private void setAllTabs(UserRequest ureq) { + vc_tab_bgDetails = createTabDetails(ureq, currBusinessGroup);// modifies vc_tab_bgDetails + tabbedPane.addTab(translate("group.edit.tab.details"), vc_tab_bgDetails); + + vc_tab_bgCTools = createTabCollabTools(ureq); + tabbedPane.addTab(translate("group.edit.tab.collabtools"), vc_tab_bgCTools); + + vc_tab_bgAreas = createTabAreas(); + tabbedPane.addTab(translate("group.edit.tab.areas"), vc_tab_bgAreas); + + vc_tab_bgRights = createTabRights(); + tabbedPane.addTab(translate("group.edit.tab.rights"), vc_tab_bgRights); + + vc_tab_grpmanagement = createTabGroupManagement(ureq); + tabbedPane.addTab(translate("group.edit.tab.members"), vc_tab_grpmanagement); + + resourceController = new BusinessGroupEditResourceController(ureq, getWindowControl(), currBusinessGroup); + listenTo(resourceController); + tabbedPane.addTab(translate("group.edit.tab.resources"), resourceController.getInitialComponent()); + + tabAccessCtrl = new BusinessGroupEditAccessController(ureq, getWindowControl(), currBusinessGroup); + listenTo(tabAccessCtrl); + tabAccessIndex = tabbedPane.addTab(translate("group.edit.tab.accesscontrol"), tabAccessCtrl.getInitialComponent()); + } + + /** + * Refresh Member-tab when waiting-list configuration change. + * @param ureq + */ + private void refreshAllTabs(UserRequest ureq) { + tabbedPane.removeAll(); + tabbedPane.addTab(translate("group.edit.tab.details"), vc_tab_bgDetails); + tabbedPane.addTab(translate("group.edit.tab.collabtools"), vc_tab_bgCTools); + tabbedPane.addTab(translate("group.edit.tab.areas"), vc_tab_bgAreas); + tabbedPane.addTab(translate("group.edit.tab.rights"), vc_tab_bgRights); + tabbedPane.addTab(translate("group.edit.tab.members"), createTabGroupManagement(ureq)); + tabbedPane.addTab(translate("group.edit.tab.resources"), resourceController.getInitialComponent()); + tabbedPane.addTab(translate("group.edit.tab.accesscontrol"), tabAccessCtrl.getInitialComponent()); + } /** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, @@ -311,11 +325,11 @@ public class BusinessGroupEditController extends BasicController implements Cont BusinessGroupAddResponse response = null; addLoggingResourceable(LoggingResourceable.wrap(currBusinessGroup)); if (source == ownerGrpCntrllr) { - response = businessGroupService.addOwners(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags); + response = businessGroupService.addOwners(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup); } else if (source == partipGrpCntrllr) { - response = businessGroupService.addParticipants(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags); + response = businessGroupService.addParticipants(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup); } else if (source == waitingGruppeController) { - response = businessGroupService.addToWaitingList(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags); + response = businessGroupService.addToWaitingList(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup); } identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities()); identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission()); @@ -324,22 +338,22 @@ public class BusinessGroupEditController extends BasicController implements Cont } else if (event instanceof IdentitiesRemoveEvent) { List<Identity> identities = ((IdentitiesRemoveEvent) event).getRemovedIdentities(); if (source == ownerGrpCntrllr) { - businessGroupService.removeOwners(ureq.getIdentity(), identities, currBusinessGroup, flags); + businessGroupService.removeOwners(ureq.getIdentity(), identities, currBusinessGroup); } else if (source == partipGrpCntrllr) { - businessGroupService.removeParticipants(ureq.getIdentity(), identities, currBusinessGroup, flags); + businessGroupService.removeParticipants(ureq.getIdentity(), identities, currBusinessGroup); if (currBusinessGroup.getWaitingListEnabled().booleanValue()) { // It is possible that a user is transfered from waiting-list to participants => reload data to see transfered user in right group. partipGrpCntrllr.reloadData(); waitingGruppeController.reloadData(); } } else if (source == waitingGruppeController) { - businessGroupService.removeFromWaitingList(ureq.getIdentity(), identities, currBusinessGroup, flags); + businessGroupService.removeFromWaitingList(ureq.getIdentity(), identities, currBusinessGroup); } fireEvent(ureq, Event.CHANGED_EVENT ); } else if (source == waitingGruppeController) { if (event instanceof IdentitiesMoveEvent) { IdentitiesMoveEvent identitiesMoveEvent = (IdentitiesMoveEvent) event; - BusinessGroupAddResponse response = businessGroupService.moveIdentityFromWaitingListToParticipant(identitiesMoveEvent.getChosenIdentities(), ureq.getIdentity(), currBusinessGroup, flags); + BusinessGroupAddResponse response = businessGroupService.moveIdentityFromWaitingListToParticipant(identitiesMoveEvent.getChosenIdentities(), ureq.getIdentity(), currBusinessGroup); identitiesMoveEvent.setNotMovedIdentities(response.getIdentitiesAlreadyInGroup()); identitiesMoveEvent.setMovedIdentities(response.getAddedIdentities()); // Participant and waiting-list were changed => reload both @@ -368,12 +382,12 @@ public class BusinessGroupEditController extends BasicController implements Cont BusinessGroupModifiedEvent .fireModifiedGroupEvents(BusinessGroupModifiedEvent.CONFIGURATION_MODIFIED_EVENT, this.currBusinessGroup, null); // rename the group also in the IM servers group list - if (this.flags.isEnabled(BGConfigFlags.BUDDYLIST)) { - if (InstantMessagingModule.isEnabled()) { - String groupID = InstantMessagingModule.getAdapter().createChatRoomString(this.currBusinessGroup); - InstantMessagingModule.getAdapter().renameRosterGroup(groupID, this.modifyBusinessGroupController.getGroupName()); - } + + if (InstantMessagingModule.isEnabled()) { + String groupID = InstantMessagingModule.getAdapter().createChatRoomString(this.currBusinessGroup); + InstantMessagingModule.getAdapter().renameRosterGroup(groupID, this.modifyBusinessGroupController.getGroupName()); } + // do logging ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_CONFIGURATION_CHANGED, getClass()); //fxdiff VCRP-1,2: access control of resources @@ -388,7 +402,7 @@ public class BusinessGroupEditController extends BasicController implements Cont if (this.modifyBusinessGroupController != null) { removeAsListenerAndDispose(this.modifyBusinessGroupController); } - modifyBusinessGroupController = new BusinessGroupFormController(ureq, getWindowControl(), currBusinessGroup, flags.isEnabled(BGConfigFlags.GROUP_MINMAX_SIZE)); + modifyBusinessGroupController = new BusinessGroupFormController(ureq, getWindowControl(), currBusinessGroup); listenTo(modifyBusinessGroupController); vc_tab_bgDetails.put("businessGroupForm", this.modifyBusinessGroupController.getInitialComponent()); @@ -404,8 +418,8 @@ public class BusinessGroupEditController extends BasicController implements Cont String bgDesc = modifyBusinessGroupController.getGroupDescription(); Integer bgMax = modifyBusinessGroupController.getGroupMax(); Integer bgMin = modifyBusinessGroupController.getGroupMin(); - Boolean waitingListEnabled = modifyBusinessGroupController.isWaitingListEnabled(); - Boolean autoCloseRanksEnabled = modifyBusinessGroupController.isAutoCloseRanksEnabled(); + boolean waitingListEnabled = modifyBusinessGroupController.isWaitingListEnabled(); + boolean autoCloseRanksEnabled = modifyBusinessGroupController.isAutoCloseRanksEnabled(); vc_tab_grpmanagement.contextPut("hasWaitingGrp", waitingListEnabled); return businessGroupService.updateBusinessGroup(currBusinessGroup, bgName, bgDesc, bgMin, bgMax, waitingListEnabled, autoCloseRanksEnabled); @@ -462,10 +476,10 @@ public class BusinessGroupEditController extends BasicController implements Cont * * @param ureq */ - private VelocityContainer createTabCollabTools(UserRequest ureq, BGConfigFlags flags) { + private VelocityContainer createTabCollabTools(UserRequest ureq) { VelocityContainer tmp = createVelocityContainer("tab_bgCollabTools"); CollaborationTools ctsm = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(currBusinessGroup); - ctc = ctsm.createCollaborationToolsSettingsController(ureq, getWindowControl(), flags); + ctc = ctsm.createCollaborationToolsSettingsController(ureq, getWindowControl()); // we are listening on CollaborationToolsSettingsController events // which are just propagated to our attached controllerlistener... // e.g. the BusinessGroupMainRunController, updating the MenuTree @@ -493,7 +507,7 @@ public class BusinessGroupEditController extends BasicController implements Cont areasChoice.addListener(this); tmp.put("areasChoice", areasChoice); tmp.contextPut("noAreasFound", (allAreas.size() > 0 ? Boolean.FALSE : Boolean.TRUE)); - tmp.contextPut("isGmAdmin", Boolean.valueOf(flags.isEnabled(BGConfigFlags.IS_GM_ADMIN))); + tmp.contextPut("isGmAdmin", Boolean.TRUE); tmp.contextPut("type", currBusinessGroup.getType()); return tmp; } @@ -523,8 +537,7 @@ public class BusinessGroupEditController extends BasicController implements Cont VelocityContainer tmp = createVelocityContainer("tab_bgDetail"); removeAsListenerAndDispose(modifyBusinessGroupController); - modifyBusinessGroupController = new BusinessGroupFormController(ureq, getWindowControl(), businessGroup, this.flags - .isEnabled(BGConfigFlags.GROUP_MINMAX_SIZE)); + modifyBusinessGroupController = new BusinessGroupFormController(ureq, getWindowControl(), businessGroup); listenTo(this.modifyBusinessGroupController); tmp.put("businessGroupForm", modifyBusinessGroupController.getInitialComponent()); @@ -538,8 +551,7 @@ public class BusinessGroupEditController extends BasicController implements Cont * @param ureq */ private VelocityContainer createTabGroupManagement(UserRequest ureq) { - boolean hasOwners = flags.isEnabled(BGConfigFlags.GROUP_OWNERS); - boolean hasPartips = true;// + boolean hasWaitingList = currBusinessGroup.getWaitingListEnabled().booleanValue(); // VelocityContainer tmp = createVelocityContainer("tab_bgGrpMngmnt"); @@ -550,34 +562,31 @@ public class BusinessGroupEditController extends BasicController implements Cont // configure the form with checkboxes for owners and/or partips according // the booleans removeAsListenerAndDispose(dmsForm); - dmsForm = new DisplayMemberSwitchForm(ureq, getWindowControl(), hasOwners, hasPartips, hasWaitingList); + dmsForm = new DisplayMemberSwitchForm(ureq, getWindowControl(), true, true, hasWaitingList); listenTo(dmsForm); // set if the checkboxes are checked or not. - if (hasOwners) dmsForm.setShowOwnersChecked(displayMembers.isShowOwners()); - if (hasPartips) dmsForm.setShowPartipsChecked(displayMembers.isShowParticipants()); + dmsForm.setShowOwnersChecked(displayMembers.isShowOwners()); + dmsForm.setShowPartipsChecked(displayMembers.isShowParticipants()); if (hasWaitingList) dmsForm.setShowWaitingListChecked(displayMembers.isShowWaitingList()); tmp.put("displayMembers", dmsForm.getInitialComponent()); - boolean enableTablePreferences = flags.isEnabled(BGConfigFlags.ADMIN_SEE_ALL_USER_DATA); - - if (hasOwners) { - boolean requiresOwner = flags.isEnabled(BGConfigFlags.GROUP_OWNER_REQURED); - // groupcontroller which allows to remove all members depending on - // configuration. - removeAsListenerAndDispose(ownerGrpCntrllr); - ownerGrpCntrllr = new GroupController(ureq, getWindowControl(), true, requiresOwner, enableTablePreferences, currBusinessGroup.getOwnerGroup()); - listenTo(ownerGrpCntrllr); - // add mail templates used when adding and removing users - MailTemplate ownerAddUserMailTempl = BGMailHelper.createAddParticipantMailTemplate(currBusinessGroup, ureq.getIdentity()); - ownerGrpCntrllr.setAddUserMailTempl(ownerAddUserMailTempl,true); - MailTemplate ownerAremoveUserMailTempl = BGMailHelper.createRemoveParticipantMailTemplate(currBusinessGroup, ureq.getIdentity()); - ownerGrpCntrllr.setRemoveUserMailTempl(ownerAremoveUserMailTempl,true); - // expose to velocity - tmp.put("ownerGrpMngmnt", ownerGrpCntrllr.getInitialComponent()); - tmp.contextPut("hasOwnerGrp", Boolean.TRUE); - } else { - tmp.contextPut("hasOwnerGrp", Boolean.FALSE); - } + Roles roles = ureq.getUserSession().getRoles(); + boolean enableTablePreferences = roles.isOLATAdmin() || roles.isGroupManager(); + boolean requiresOwner = true; + // groupcontroller which allows to remove all members depending on + // configuration. + removeAsListenerAndDispose(ownerGrpCntrllr); + ownerGrpCntrllr = new GroupController(ureq, getWindowControl(), true, requiresOwner, enableTablePreferences, currBusinessGroup.getOwnerGroup()); + listenTo(ownerGrpCntrllr); + // add mail templates used when adding and removing users + MailTemplate ownerAddUserMailTempl = BGMailHelper.createAddParticipantMailTemplate(currBusinessGroup, ureq.getIdentity()); + ownerGrpCntrllr.setAddUserMailTempl(ownerAddUserMailTempl,true); + MailTemplate ownerAremoveUserMailTempl = BGMailHelper.createRemoveParticipantMailTemplate(currBusinessGroup, ureq.getIdentity()); + ownerGrpCntrllr.setRemoveUserMailTempl(ownerAremoveUserMailTempl,true); + // expose to velocity + tmp.put("ownerGrpMngmnt", ownerGrpCntrllr.getInitialComponent()); + tmp.contextPut("hasOwnerGrp", Boolean.TRUE); + // groupcontroller which allows to remove all members removeAsListenerAndDispose(partipGrpCntrllr); partipGrpCntrllr = new GroupController(ureq, getWindowControl(), true, false, enableTablePreferences, currBusinessGroup.getPartipiciantGroup()); @@ -663,21 +672,4 @@ public class BusinessGroupEditController extends BasicController implements Cont alreadyLockedDialogController.dispose(); } } - - /** - * Refresh Member-tab when waiting-list configuration change. - * @param ureq - */ - private void refreshAllTabs(UserRequest ureq) { - tabbedPane.removeAll(); - tabbedPane.addTab(translate("group.edit.tab.details"), vc_tab_bgDetails); - tabbedPane.addTab(translate("group.edit.tab.collabtools"), vc_tab_bgCTools); - tabbedPane.addTab(translate("group.edit.tab.areas"), vc_tab_bgAreas); - tabbedPane.addTab(translate("group.edit.tab.rights"), vc_tab_bgRights); - tabbedPane.addTab(translate("group.edit.tab.members"), createTabGroupManagement(ureq)); - if(tabAccessCtrl != null) { - tabbedPane.addTab(translate("group.edit.tab.accesscontrol"), tabAccessCtrl.getInitialComponent()); - } - } - } \ No newline at end of file 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 56e1ef1c8d6f7e27cceee1cbcf7e7616d824c842..0bcc24dd7c63a432779468ed2493989a14ac9275 100644 --- a/src/main/java/org/olat/group/ui/main/BGMainController.java +++ b/src/main/java/org/olat/group/ui/main/BGMainController.java @@ -87,11 +87,9 @@ import org.olat.core.util.resource.OresHelper; import org.olat.core.util.tree.TreeHelper; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; -import org.olat.group.BusinessGroupShort; import org.olat.group.GroupLoggingAction; import org.olat.group.delete.TabbedPaneController; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGControllerFactory; import org.olat.group.ui.BGTranslatorFactory; import org.olat.group.ui.BusinessGroupFormController; @@ -433,10 +431,8 @@ public class BGMainController extends MainLayoutBasicController implements Activ * */ private void initAddGroupWorkflow(UserRequest ureq) { - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); - removeAsListenerAndDispose(createBuddyGroupController); - createBuddyGroupController = new BusinessGroupFormController(ureq, getWindowControl(), null, flags.isEnabled(BGConfigFlags.GROUP_MINMAX_SIZE)); + createBuddyGroupController = new BusinessGroupFormController(ureq, getWindowControl(), null); listenTo(createBuddyGroupController); cmc = new CloseableModalController(getWindowControl(), translate("close"), this.createBuddyGroupController.getInitialComponent(), true, translate("create.form.title")); cmc.activate(); @@ -480,13 +476,12 @@ public class BGMainController extends MainLayoutBasicController implements Activ */ private void doBuddyGroupLeave(UserRequest ureq) { BaseSecurity securityManager = BaseSecurityManager.getInstance(); - BGConfigFlags flags = BGConfigFlags.createBuddyGroupDefaultFlags(); // 1) remove as owner SecurityGroup owners = currBusinessGroup.getOwnerGroup(); if (securityManager.isIdentityInSecurityGroup(identity, owners)) { List<Identity> ownerList = securityManager.getIdentitiesOfSecurityGroup(owners); if (ownerList.size() > 1) { - businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(ureq.getIdentity()), currBusinessGroup, flags); + businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(ureq.getIdentity()), currBusinessGroup); // update model updateGroupList(); } else { @@ -502,7 +497,7 @@ public class BGMainController extends MainLayoutBasicController implements Activ // 2) remove as participant List<Identity> identities = new ArrayList<Identity>(1); identities.add(ureq.getIdentity()); - businessGroupService.removeParticipants(ureq.getIdentity(), identities, currBusinessGroup, flags); + businessGroupService.removeParticipants(ureq.getIdentity(), identities, currBusinessGroup); // update Tables doGroupList(ureq, getWindowControl()); @@ -517,8 +512,8 @@ public class BGMainController extends MainLayoutBasicController implements Activ private BusinessGroup createGroup(UserRequest ureq) { String bgName = createBuddyGroupController.getGroupName(); String bgDesc = createBuddyGroupController.getGroupDescription(); - int bgMin = createBuddyGroupController.getGroupMin(); - int bgMax = createBuddyGroupController.getGroupMax(); + Integer bgMin = createBuddyGroupController.getGroupMin(); + Integer bgMax = createBuddyGroupController.getGroupMax(); /* * this creates a BusinessGroup as BuddyGroup with the specified name and * description and also the CollaborationTools are enabled during creation. 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 2be31f338ebe2b4e98473e15d6b0a08190a1965f..225aae12f97f278912f6a1d52773883bf44b1415 100644 --- a/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java +++ b/src/main/java/org/olat/group/ui/main/BusinessGroupListController.java @@ -58,7 +58,6 @@ import org.olat.group.BusinessGroupService; import org.olat.group.GroupLoggingAction; import org.olat.group.model.BGRepositoryEntryRelation; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.resource.accesscontrol.manager.ACFrontendManager; import org.olat.resource.accesscontrol.model.OLATResourceAccess; import org.olat.resource.accesscontrol.model.PriceMethodBundle; @@ -209,12 +208,11 @@ public class BusinessGroupListController extends BasicController { * @param ureq */ private void doGroupLeave(UserRequest ureq, BusinessGroup group) { - BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags(); // 1) remove as owner if (securityManager.isIdentityInSecurityGroup(getIdentity(), group.getOwnerGroup())) { List<Identity> ownerList = securityManager.getIdentitiesOfSecurityGroup(group.getOwnerGroup()); if (ownerList.size() > 1) { - businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(getIdentity()), group, flags); + businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(getIdentity()), group); } else { // he is the last owner, but there must be at least one oner // give him a warning, as long as he tries to leave, he gets @@ -227,7 +225,7 @@ public class BusinessGroupListController extends BasicController { // now remove the identity also as participant. // 2) remove as participant List<Identity> identities = Collections.singletonList(getIdentity()); - businessGroupService.removeParticipants(ureq.getIdentity(), identities, group, flags); + businessGroupService.removeParticipants(ureq.getIdentity(), identities, group); } /** diff --git a/src/main/java/org/olat/group/ui/management/BGManagementController.java b/src/main/java/org/olat/group/ui/management/BGManagementController.java index 0dc6ebbbd3eb794843b2685c5335126a4bdc7030..c591a9861e985bb00f876cddc3a24dc1da844a99 100644 --- a/src/main/java/org/olat/group/ui/management/BGManagementController.java +++ b/src/main/java/org/olat/group/ui/management/BGManagementController.java @@ -27,7 +27,6 @@ package org.olat.group.ui.management; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -87,7 +86,6 @@ import org.olat.group.BusinessGroupService; import org.olat.group.GroupLoggingAction; import org.olat.group.area.BGArea; import org.olat.group.area.BGAreaManager; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGControllerFactory; import org.olat.group.ui.BGTranslatorFactory; import org.olat.group.ui.BusinessGroupTableModel; @@ -103,8 +101,6 @@ import org.olat.group.ui.wizard.BGCopyWizardController; import org.olat.group.ui.wizard.BGMultipleCopyWizardController; import org.olat.group.ui.wizard.MemberListWizardController; import org.olat.modules.co.ContactFormController; -import org.olat.repository.RepositoryEntry; -import org.olat.repository.RepositoryTableModel; import org.olat.resource.OLATResource; import org.olat.user.HomePageConfig; import org.olat.user.HomePageConfigManagerImpl; @@ -155,9 +151,6 @@ public class BGManagementController extends MainLayoutBasicController implements private static final String CMD_LIST_MEMBERS_WITH_GROUPS = "cmd.list.members.with.groups"; private static final String CMD_LIST_MEMBERS_WITH_AREAS = "cmd.list.members.with.areas"; - private Translator userTrans; - private final OLATResource resource; - private BGConfigFlags flags; private static final int STATE_OVERVIEW = 1; private static final int STATE_CONTEXT_REMOVED = 3; private static final int STATE_GROUP_CREATE_FORM = 100; @@ -188,6 +181,8 @@ public class BGManagementController extends MainLayoutBasicController implements private BGMultipleCopyWizardController bgMultipleCopyWizardCtr; private TableController resourcesCtr; private GroupController contextOwnersCtr; + + private final boolean backLink; // Layout components and controllers private Panel content; @@ -196,10 +191,14 @@ public class BGManagementController extends MainLayoutBasicController implements private ToolController toolC; // Managers + private final UserManager userManager; private final BGAreaManager areaManager; + private final BaseSecurity securityManager; private final BusinessGroupService businessGroupService; // Workflow variables + private final OLATResource resource; + private List<ShortName> areaFilters; private BGArea currentAreaFilter; private Component backComponent, currentComponent; @@ -222,13 +221,15 @@ public class BGManagementController extends MainLayoutBasicController implements * @param bgContext * @param controllerFlags */ - public BGManagementController(UserRequest ureq, WindowControl wControl, OLATResource resource, BGConfigFlags controllerFlags) { + public BGManagementController(UserRequest ureq, WindowControl wControl, OLATResource resource, boolean backLink) { super(ureq, wControl); this.resource = resource; - this.flags = controllerFlags; + this.backLink = backLink; // Initialize managers + userManager = CoreSpringFactory.getImpl(UserManager.class); areaManager = CoreSpringFactory.getImpl(BGAreaManager.class); + securityManager = CoreSpringFactory.getImpl(BaseSecurity.class); businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); businessGroupTranslator = Util.createPackageTranslator(BusinessGroupMainRunController.class, ureq.getLocale()); @@ -237,7 +238,6 @@ public class BGManagementController extends MainLayoutBasicController implements // translator setTranslator(BGTranslatorFactory.createBGPackageTranslator(PACKAGE, "LearningGroup", ureq.getLocale())); // user translator - this.userTrans = Util.createPackageTranslator(UserManager.class, ureq.getLocale()); // initialize all velocity containers initVC(); @@ -307,47 +307,27 @@ public class BGManagementController extends MainLayoutBasicController implements * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event) */ public void event(Event event) { - /*if (event instanceof BGContextEvent) { - BGContextEvent contextEvent = (BGContextEvent) event; - if (contextEvent.getBgContextKey().equals(this.bgContext.getKey())) { - if (contextEvent.getCommand().equals(BGContextEvent.CONTEXT_DELETED) - || contextEvent.getCommand().equals(BGContextEvent.RESOURCE_REMOVED)) { - //this results in a screen where the BGManagementController - //is no longer functional -> hence only closeable - dispose();//disposed message is defined in constructor! - } - } - - } else */ - - if (event instanceof BusinessGroupModifiedEvent) { + if (event instanceof BusinessGroupModifiedEvent) { if (event.getCommand().equals(BusinessGroupModifiedEvent.CONFIGURATION_MODIFIED_EVENT)) { // update reference to updated business group object - BusinessGroup modifiedGroup = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(currentGroup); + BusinessGroup modifiedGroup = businessGroupService.loadBusinessGroup(currentGroup); if (groupListModel != null) { - List groups = groupListModel.getObjects(); - if (groups.contains(this.currentGroup)) { - int i = groups.indexOf(this.currentGroup); + List<BusinessGroup> groups = groupListModel.getObjects(); + if (groups.contains(currentGroup)) { + int i = groups.indexOf(currentGroup); groups.set(i, modifiedGroup); } } - this.currentGroup = modifiedGroup; + currentGroup = modifiedGroup; } } } private void doGroupMessage(UserRequest ureq) { - List list = new ArrayList(); - BaseSecurity securityManager = BaseSecurityManager.getInstance(); - list.addAll(securityManager.getIdentitiesOfSecurityGroup(currentGroup.getPartipiciantGroup())); - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) list - .addAll(securityManager.getIdentitiesOfSecurityGroup(currentGroup.getOwnerGroup())); - // right group has a different groupname in the to field. - String groupMailToName; - if (flags.isEnabled(BGConfigFlags.RIGHTS)) groupMailToName = translate("rightgroup.message.to"); - else groupMailToName = translate("group.message.to"); + List<Identity> list = securityManager.getIdentitiesOfSecurityGroup(currentGroup.getPartipiciantGroup()); + list.addAll(securityManager.getIdentitiesOfSecurityGroup(currentGroup.getOwnerGroup())); doContactForm(ureq); - sendMessageVC.contextPut("title", translate("group.message", this.currentGroup.getName())); + sendMessageVC.contextPut("title", translate("group.message", currentGroup.getName())); } /**removeAsListenerAndDispose @@ -369,34 +349,33 @@ public class BGManagementController extends MainLayoutBasicController implements * @return */ private boolean getIsGMAdminOwner(UserRequest ureq) { - boolean isOwner = false; - if (this.currentGroup != null) { - isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(ureq.getIdentity(), Constants.PERMISSION_ACCESS, this.currentGroup); - } - isGMAdminOwner = isOwner || flags.isEnabled(BGConfigFlags.IS_GM_ADMIN); + isGMAdminOwner = ureq.getUserSession().getRoles().isOLATAdmin() + || ureq.getUserSession().getRoles().isGroupManager() + || (currentGroup != null && securityManager.isIdentityPermittedOnResourceable(ureq.getIdentity(), Constants.PERMISSION_ACCESS, currentGroup)); return isGMAdminOwner; } private void doOwnersMessage(UserRequest ureq) { - List owners = ownerListModel.getObjects(); + List<Identity> owners = ownerListModel.getObjects(); doSendMessage(owners, translate("owners.message.to"), ureq); sendMessageVC.contextPut("title", translate("owners.message")); } private void doParticipantsMessage(UserRequest ureq) { - List participants = participantListModel.getObjects(); + List<Identity> participants = participantListModel.getObjects(); doSendMessage(participants, translate("participants.message.to"), ureq); sendMessageVC.contextPut("title", translate("participants.message")); } private void doUserMessage(UserRequest ureq) { List<Identity> users = new ArrayList<Identity>(); - users.add(this.currentIdentity); - User user = this.currentIdentity.getUser(); + users.add(currentIdentity); + User user = currentIdentity.getUser(); Locale loc = I18nManager.getInstance().getLocaleOrDefault(user.getPreferences().getLanguage()); doSendMessage(users, user.getProperty(UserConstants.FIRSTNAME, loc) + " " + user.getProperty(UserConstants.LASTNAME, loc), ureq); - sendMessageVC.contextPut("title", getTranslator().translate("user.message", new String[] { this.currentIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()), - this.currentIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) })); + + String fullName = userManager.getUserDisplayName(user); + sendMessageVC.contextPut("title", getTranslator().translate("user.message", new String[] { fullName })); } private void doSendMessage(List<Identity> identities, String mailToName, UserRequest ureq) { @@ -709,13 +688,11 @@ public class BGManagementController extends MainLayoutBasicController implements gtn.setAltText(translate("menu.allgroups.alt")); root.addChild(gtn); - if (flags.isEnabled(BGConfigFlags.AREAS)) { - gtn = new GenericTreeNode(); - gtn.setTitle(translate("menu.allareas")); - gtn.setUserObject(CMD_AREALIST); - gtn.setAltText(translate("menu.allareas.alt")); - root.addChild(gtn); - } + gtn = new GenericTreeNode(); + gtn.setTitle(translate("menu.allareas")); + gtn.setUserObject(CMD_AREALIST); + gtn.setAltText(translate("menu.allareas.alt")); + root.addChild(gtn); gtn = new GenericTreeNode(); gtn.setTitle(translate("menu.allusers")); @@ -737,21 +714,15 @@ public class BGManagementController extends MainLayoutBasicController implements return; } - // header for generic action. if groups have rights, assueme - // rightsmanagement - // otherwhise groupmanagement - if (flags.isEnabled(BGConfigFlags.RIGHTS)) toolC.addHeader(translate("tools.title.rightmanagement")); - else toolC.addHeader(translate("tools.title.groupmanagement")); + toolC.addHeader(translate("tools.title.groupmanagement")); // Generic actions - if (flags.isEnabled(BGConfigFlags.GROUPS_CREATE)) toolC.addLink(CMD_GROUP_CREATE, translate(CMD_GROUP_CREATE)); - if (flags.isEnabled(BGConfigFlags.AREAS)) toolC.addLink(CMD_AREA_CREATE, translate(CMD_AREA_CREATE)); - if (flags.isEnabled(BGConfigFlags.BACK_SWITCH)) toolC.addLink(CMD_BACK, translate(CMD_BACK)); + toolC.addLink(CMD_GROUP_CREATE, translate(CMD_GROUP_CREATE)); + toolC.addLink(CMD_AREA_CREATE, translate(CMD_AREA_CREATE)); + if (backLink) toolC.addLink(CMD_BACK, translate(CMD_BACK)); toolC.addLink(CMD_CLOSE, translate(CMD_CLOSE), null, "b_toolbox_close"); - //TODO: (LD) check where is this displayable. toolC.addHeader(translate("tools.title.listmembers")); - //TODO: (LD) check flags toolC.addLink(CMD_LIST_MEMBERS_WITH_GROUPS, translate(CMD_LIST_MEMBERS_WITH_GROUPS)); toolC.addLink(CMD_LIST_MEMBERS_WITH_AREAS, translate(CMD_LIST_MEMBERS_WITH_AREAS)); @@ -761,17 +732,17 @@ public class BGManagementController extends MainLayoutBasicController implements toolC.addLink(CMD_GROUP_RUN, translate(CMD_GROUP_RUN)); toolC.addLink(CMD_GROUP_COPY, translate(CMD_GROUP_COPY)); toolC.addLink(CMD_GROUP_COPY_MULTIPLE, translate(CMD_GROUP_COPY_MULTIPLE)); - if (flags.isEnabled(BGConfigFlags.GROUPS_DELETE)) toolC.addLink(CMD_GROUP_DELETE, translate(CMD_GROUP_DELETE)); + toolC.addLink(CMD_GROUP_DELETE, translate(CMD_GROUP_DELETE)); } - if (state == STATE_AREA_EDIT && flags.isEnabled(BGConfigFlags.AREAS_DELETE)) { + if (state == STATE_AREA_EDIT) { toolC.addHeader(translate("tools.title.area")); toolC.addLink(CMD_AREA_DELETE, translate(CMD_AREA_DELETE)); } if (state == STATE_USER_LIST) { toolC.addHeader(translate("tools.title.userlist")); - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) toolC.addLink(CMD_OWNERS_MESSAGE, translate(CMD_OWNERS_MESSAGE)); + toolC.addLink(CMD_OWNERS_MESSAGE, translate(CMD_OWNERS_MESSAGE)); toolC.addLink(CMD_PARTICIPANTS_MESSAGE, translate(CMD_PARTICIPANTS_MESSAGE)); } @@ -786,19 +757,17 @@ public class BGManagementController extends MainLayoutBasicController implements // push group type as 'type' for type specific help pages // Overview page overviewVC = createVelocityContainer("overview"); - overviewVC.contextPut("flags", flags); // Create new group form newGroupVC = createVelocityContainer("newgroup"); // Group list groupListVC = createVelocityContainer("grouplist"); // Group message sendMessageVC = createVelocityContainer("sendmessage"); - if (flags.isEnabled(BGConfigFlags.AREAS)) { - // Create new area form - newAreaVC = createVelocityContainer("newarea"); - // Area list - areaListVC = createVelocityContainer("arealist"); - } + + newAreaVC = createVelocityContainer("newarea"); + // Area list + areaListVC = createVelocityContainer("arealist"); + // User list userListVC = createVelocityContainer("userlist"); // User details @@ -818,38 +787,13 @@ public class BGManagementController extends MainLayoutBasicController implements // number of groups overviewVC.contextPut("numbGroups", new Integer(numOfGroups)); // number of owners - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) { - overviewVC.contextPut("numbTotal", new Integer(numOfOwners + numOfParticipants)); - overviewVC.contextPut("numbOwners", new Integer(numOfOwners)); - } + overviewVC.contextPut("numbTotal", new Integer(numOfOwners + numOfParticipants)); + overviewVC.contextPut("numbOwners", new Integer(numOfOwners)); overviewVC.contextPut("numbParticipants", new Integer(numOfParticipants)); // number of areas - if (flags.isEnabled(BGConfigFlags.AREAS)) { - overviewVC.contextPut("numbAreas", new Integer(areaManager.countBGAreasInContext(resource))); - } - setTools(STATE_OVERVIEW); - } + overviewVC.contextPut("numbAreas", new Integer(areaManager.countBGAreasInContext(resource))); - //TODO gm - private void doAddOtherResourcesList(UserRequest ureq) { - List<RepositoryEntry> repoTableModelEntries = Collections.emptyList(); - if (repoTableModelEntries.size() > 1) { - Translator resourceTrans = Util.createPackageTranslator(RepositoryTableModel.class, ureq.getLocale(), getTranslator()); - - TableGuiConfiguration tableConfig = new TableGuiConfiguration(); - removeAsListenerAndDispose(resourcesCtr); - resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans); - listenTo(resourcesCtr); - RepositoryTableModel repoTableModel = new RepositoryTableModel(resourceTrans); - repoTableModel.setObjects(repoTableModelEntries); - repoTableModel.addColumnDescriptors(resourcesCtr, null, false); - resourcesCtr.setTableDataModel(repoTableModel); - overviewVC.put("otherResources", resourcesCtr.getInitialComponent()); - overviewVC.contextPut("usedByOtherResources", Boolean.TRUE); - } else { - overviewVC.contextRemove("otherResources"); - overviewVC.contextPut("usedByOtherResources", Boolean.FALSE); - } + setTools(STATE_OVERVIEW); } /* @@ -867,8 +811,7 @@ public class BGManagementController extends MainLayoutBasicController implements private void createNewGroupController(UserRequest ureq, WindowControl wControl) { removeAsListenerAndDispose(groupCreateController); - groupCreateController = BGControllerFactory.getInstance().createNewBGController(ureq, wControl, - flags.isEnabled(BGConfigFlags.GROUP_MINMAX_SIZE), resource); + groupCreateController = new NewBGController(ureq, wControl, resource); listenTo(groupCreateController); newGroupVC.put("groupCreateForm", groupCreateController.getInitialComponent()); @@ -878,7 +821,7 @@ public class BGManagementController extends MainLayoutBasicController implements private void doGroupCopy(UserRequest ureq) { removeAsListenerAndDispose(bgCopyWizardCtr); - bgCopyWizardCtr = new BGCopyWizardController(ureq, getWindowControl(), this.currentGroup, this.flags); + bgCopyWizardCtr = new BGCopyWizardController(ureq, getWindowControl(), currentGroup); listenTo(bgCopyWizardCtr); removeAsListenerAndDispose(closeableModalController); closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), bgCopyWizardCtr.getInitialComponent()); @@ -889,7 +832,7 @@ public class BGManagementController extends MainLayoutBasicController implements private void doMultipleGroupCopy(UserRequest ureq) { removeAsListenerAndDispose(bgMultipleCopyWizardCtr); - bgMultipleCopyWizardCtr = new BGMultipleCopyWizardController(ureq, getWindowControl(), this.currentGroup, this.flags); + bgMultipleCopyWizardCtr = new BGMultipleCopyWizardController(ureq, getWindowControl(), currentGroup); listenTo(bgMultipleCopyWizardCtr); removeAsListenerAndDispose(closeableModalController); closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), bgMultipleCopyWizardCtr.getInitialComponent()); @@ -899,10 +842,10 @@ public class BGManagementController extends MainLayoutBasicController implements private void doGroupEdit(UserRequest ureq) { removeAsListenerAndDispose(groupEditCtr); - groupEditCtr = BGControllerFactory.getInstance().createEditControllerFor(ureq, getWindowControl(), this.currentGroup); + groupEditCtr = BGControllerFactory.getInstance().createEditControllerFor(ureq, getWindowControl(), currentGroup); listenTo(groupEditCtr); // add as listener to BusinessGroup so we are being notified about changes. - CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, ureq.getIdentity(), this.currentGroup); + CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, ureq.getIdentity(), currentGroup); setMainContent(groupEditCtr.getInitialComponent()); if (groupEditCtr.isLockAcquired()) { @@ -941,12 +884,8 @@ public class BGManagementController extends MainLayoutBasicController implements groupListCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.name", 0, CMD_GROUP_RUN, ureq.getLocale())); groupListCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.desc", 1, null, ureq.getLocale())); groupListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_GROUP_EDIT, "grouplist.table.edit", translate(CMD_GROUP_EDIT))); - if (flags.isEnabled(BGConfigFlags.GROUPS_DELETE)) { - groupListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_GROUP_DELETE, "grouplist.table.delete", - translate(CMD_GROUP_DELETE))); - } + groupListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_GROUP_DELETE, "grouplist.table.delete", translate(CMD_GROUP_DELETE))); groupListVC.put("groupListTableCtr", groupListCtr.getInitialComponent()); - } if (groupListModel == null || initializeModel) { // 1. group list model: if area filter is set use only groups from given @@ -962,12 +901,9 @@ public class BGManagementController extends MainLayoutBasicController implements groupListCtr.setTableDataModel(groupListModel); // 2. find areas for group list filter - if (flags.isEnabled(BGConfigFlags.AREAS)) { - List<BGArea> areas = areaManager.findBGAreasInContext(resource); - areaFilters = new ArrayList<ShortName>(areas); - groupListCtr.setFilters(this.areaFilters, currentAreaFilter); - } - + List<BGArea> areas = areaManager.findBGAreasInContext(resource); + areaFilters = new ArrayList<ShortName>(areas); + groupListCtr.setFilters(this.areaFilters, currentAreaFilter); } setMainContent(groupListVC); setTools(STATE_GROUP_LIST); @@ -1005,10 +941,7 @@ public class BGManagementController extends MainLayoutBasicController implements areaListCtr.addColumnDescriptor(new DefaultColumnDescriptor("arealist.table.name", 0, null, ureq.getLocale())); areaListCtr.addColumnDescriptor(new DefaultColumnDescriptor("arealist.table.desc", 1, null, ureq.getLocale())); areaListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_AREA_EDIT, "arealist.table.edit", translate(CMD_AREA_EDIT))); - if (flags.isEnabled(BGConfigFlags.AREAS_DELETE)) { - areaListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_AREA_DELETE, "arealist.table.delete", - translate(CMD_AREA_DELETE))); - } + areaListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_AREA_DELETE, "arealist.table.delete", translate(CMD_AREA_DELETE))); areaListCtr.setTableDataModel(areaListModel); areaListVC.put("arealisttable", areaListCtr.getInitialComponent()); } @@ -1018,26 +951,23 @@ public class BGManagementController extends MainLayoutBasicController implements private void doUsersList(UserRequest ureq, boolean initializeModel) { // 1. init owners list - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) { - if (ownerListModel == null || initializeModel) { - List<Identity> owners = businessGroupService.getMembersOf(resource, true, false); + if (ownerListModel == null || initializeModel) { + List<Identity> owners = businessGroupService.getMembersOf(resource, true, false); - TableGuiConfiguration tableConfig = new TableGuiConfiguration(); - tableConfig.setPreferencesOffered(true, "ownerListController"); - tableConfig.setTableEmptyMessage(translate("userlist.owners.noOwners")); - - removeAsListenerAndDispose(ownerListCtr); - ownerListCtr = UserControllerFactory.createTableControllerFor(tableConfig, owners, ureq, getWindowControl(), CMD_USER_DETAILS); - listenTo(ownerListCtr); - - ownerListModel = (UserTableDataModel) ownerListCtr.getTableDataModel(); + TableGuiConfiguration tableConfig = new TableGuiConfiguration(); + tableConfig.setPreferencesOffered(true, "ownerListController"); + tableConfig.setTableEmptyMessage(translate("userlist.owners.noOwners")); + + removeAsListenerAndDispose(ownerListCtr); + ownerListCtr = UserControllerFactory.createTableControllerFor(tableConfig, owners, ureq, getWindowControl(), CMD_USER_DETAILS); + listenTo(ownerListCtr); + + ownerListModel = (UserTableDataModel) ownerListCtr.getTableDataModel(); - userListVC.put("ownerlisttable", ownerListCtr.getInitialComponent()); - } - userListVC.contextPut("showOwners", Boolean.TRUE); - } else { - userListVC.contextPut("showOwners", Boolean.FALSE); + userListVC.put("ownerlisttable", ownerListCtr.getInitialComponent()); } + userListVC.contextPut("showOwners", Boolean.TRUE); + // 2. init participants list if (participantListModel == null || initializeModel) { @@ -1063,45 +993,33 @@ public class BGManagementController extends MainLayoutBasicController implements private void doUserDetails(UserRequest ureq) { // 1. expose the identity details userDetailsVC.contextPut("identity", this.currentIdentity); - Translator babel = UserManager.getInstance().getPropertyHandlerTranslator(userTrans); - + HomePageConfig homePageConfig = HomePageConfigManagerImpl.getInstance().loadConfigFor(currentIdentity.getName()); removeAsListenerAndDispose(homePageDisplayController); homePageDisplayController = new HomePageDisplayController(ureq, getWindowControl(), homePageConfig); listenTo(homePageDisplayController); userDetailsVC.put("userdetailsform", homePageDisplayController.getInitialComponent()); // 2. expose the owner groups of the identity - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) { - List<BusinessGroup> ownerGroups = businessGroupService.findBusinessGroupsOwnedBy(currentIdentity, resource); - - Link[] ownerGroupLinks= new Link[ownerGroups.size()]; - int ownerNumber = 0; - - for (Iterator iter = ownerGroups.iterator(); iter.hasNext();) { - BusinessGroup group = (BusinessGroup) iter.next(); - Link tmp = LinkFactory.createCustomLink("cmd.user.remove.group.own." + group.getKey(), "cmd.user.remove.group.own." + group.getKey(), "userdetails.remove", Link.BUTTON_SMALL, userDetailsVC, this); - tmp.setUserObject(group); - ownerGroupLinks[ownerNumber] = tmp; - ownerNumber++; - } - userDetailsVC.contextPut("ownerGroupLinks", ownerGroupLinks); - userDetailsVC.contextPut("noOwnerGroups", (ownerGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE)); - userDetailsVC.contextPut("showOwnerGroups", Boolean.TRUE); - } else { - userDetailsVC.contextPut("showOwnerGroups", Boolean.FALSE); + List<BusinessGroup> ownerGroups = businessGroupService.findBusinessGroupsOwnedBy(currentIdentity, resource); + Link[] ownerGroupLinks= new Link[ownerGroups.size()]; + int ownerNumber = 0; + for (BusinessGroup group:ownerGroups) { + Link tmp = LinkFactory.createCustomLink("cmd.user.remove.group.own." + group.getKey(), "cmd.user.remove.group.own." + group.getKey(), "userdetails.remove", Link.BUTTON_SMALL, userDetailsVC, this); + tmp.setUserObject(group); + ownerGroupLinks[ownerNumber++] = tmp; } + userDetailsVC.contextPut("ownerGroupLinks", ownerGroupLinks); + userDetailsVC.contextPut("noOwnerGroups", (ownerGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE)); + userDetailsVC.contextPut("showOwnerGroups", Boolean.TRUE); + // 3. expose the participant groups of the identity List<BusinessGroup> participantGroups = businessGroupService.findBusinessGroupsAttendedBy(currentIdentity, resource); - Link[] participantGroupLinks= new Link[participantGroups.size()]; int participantNumber = 0; - - for (Iterator iter = participantGroups.iterator(); iter.hasNext();) { - BusinessGroup group = (BusinessGroup) iter.next(); + for (BusinessGroup group: participantGroups) { Link tmp = LinkFactory.createCustomLink("cmd.user.remove.group.part." + group.getKey(), "cmd.user.remove.group.part." + group.getKey(), "userdetails.remove", Link.BUTTON_SMALL, userDetailsVC, this); tmp.setUserObject(group); - participantGroupLinks[participantNumber] = tmp; - participantNumber++; + participantGroupLinks[participantNumber++] = tmp; } userDetailsVC.contextPut("noParticipantGroups", (participantGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE)); userDetailsVC.contextPut("participantGroupLinks", participantGroupLinks); @@ -1116,7 +1034,7 @@ public class BGManagementController extends MainLayoutBasicController implements if(group != null) { List<Identity> identities = new ArrayList<Identity>(1); identities.add(toRemoveIdentity); - businessGroupService.removeParticipants(ureqIdentity, identities, group, flags); + businessGroupService.removeParticipants(ureqIdentity, identities, group); } } @@ -1124,7 +1042,7 @@ public class BGManagementController extends MainLayoutBasicController implements Long key = Long.valueOf(groupKey); BusinessGroup group = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(key); if(group != null) { - businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(currentIdentity), group, flags); + businessGroupService.removeOwners(ureq.getIdentity(), Collections.singletonList(currentIdentity), group); } } @@ -1142,33 +1060,33 @@ public class BGManagementController extends MainLayoutBasicController implements ContactList ownerCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.owners")); ContactList partipCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.partip")); ContactList waitingListContactList = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.waitingList")); - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) { - if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { + + if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { + SecurityGroup owners = this.currentGroup.getOwnerGroup(); + List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); + ownerCntctLst.addAllIdentites(ownerList); + cmsg.addEmailTo(ownerCntctLst); + } else { + if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) { SecurityGroup owners = this.currentGroup.getOwnerGroup(); List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); - ownerCntctLst.addAllIdentites(ownerList); - cmsg.addEmailTo(ownerCntctLst); - } else { - if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) { - SecurityGroup owners = this.currentGroup.getOwnerGroup(); - List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); - for (Identity identity : new ArrayList<Identity>(ownerList)) { - boolean keyIsSelected = false; - for (Long key : sendToChooserForm.getSelectedOwnerKeys()) { - if (key.equals(identity.getKey())) { - keyIsSelected = true; - break; - } - } - if (!keyIsSelected) { - ownerList.remove(identity); + for (Identity identity : new ArrayList<Identity>(ownerList)) { + boolean keyIsSelected = false; + for (Long key : sendToChooserForm.getSelectedOwnerKeys()) { + if (key.equals(identity.getKey())) { + keyIsSelected = true; + break; } } - ownerCntctLst.addAllIdentites(ownerList); - cmsg.addEmailTo(ownerCntctLst); + if (!keyIsSelected) { + ownerList.remove(identity); + } } + ownerCntctLst.addAllIdentites(ownerList); + cmsg.addEmailTo(ownerCntctLst); } } + if (sendToChooserForm != null) { if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { SecurityGroup participants = this.currentGroup.getPartipiciantGroup(); @@ -1232,15 +1150,6 @@ public class BGManagementController extends MainLayoutBasicController implements return cofocntrllr; } - /** - * Use the flags to configure the runtime behaviour of this controller - * - * @return the configuration flags - */ - public BGConfigFlags getControllerFlags() { - return flags; - } - private void setMainContent(Component component) { content.setContent(component); this.backComponent = this.currentComponent; diff --git a/src/main/java/org/olat/group/ui/management/_content/overview.html b/src/main/java/org/olat/group/ui/management/_content/overview.html index 05b19b22dd4b31d7b0316e242df2e984dcadb1af..e213058c6e2e3140426c065c1c76ceefecdd6e06 100644 --- a/src/main/java/org/olat/group/ui/management/_content/overview.html +++ b/src/main/java/org/olat/group/ui/management/_content/overview.html @@ -16,15 +16,11 @@ <h5>$r.translate("overview.overview")</h5> <p> <table class="b_table"> - <tr><td>$r.translate("overview.numb.groups"): </td><td>$numbGroups</td></tr> - #if ($flags.isEnabled("group_owners")) - <tr><td>$r.translate("overview.numb.total"): </td><td>$numbTotal</td></tr> - <tr><td>$r.translate("overview.numb.owners"): </td><td>$numbOwners</td></tr> - #end - <tr><td>$r.translate("overview.numb.participants"): </td><td>$numbParticipants</td></tr> - #if ($flags.isEnabled("areas")) - <tr><td>$r.translate("overview.numb.areas"): </td><td>$numbAreas</td></tr> - #end + <tr><td>$r.translate("overview.numb.groups"):</td><td>$numbGroups</td></tr> + <tr><td>$r.translate("overview.numb.total"):</td><td>$numbTotal</td></tr> + <tr><td>$r.translate("overview.numb.owners"):</td><td>$numbOwners</td></tr> + <tr><td>$r.translate("overview.numb.participants"):</td><td>$numbParticipants</td></tr> + <tr><td>$r.translate("overview.numb.areas"):</td><td>$numbAreas</td></tr> </table> </p> <hr /> diff --git a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java index c376702b6b30c0a5005cfd7dade54a0104dc5e38..87ce0752a990a874d0432964c337497682bc7e0f 100644 --- a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java +++ b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java @@ -85,7 +85,6 @@ import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.GroupLoggingAction; import org.olat.group.model.DisplayMembers; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGControllerFactory; import org.olat.group.ui.BGTranslatorFactory; import org.olat.group.ui.edit.BusinessGroupEditController; @@ -197,8 +196,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im private boolean isAdmin; - private BGConfigFlags flags; - + private final BaseSecurity securityManager; private final BusinessGroupService businessGroupService; private UserSession userSession; private String adminNodeId; // reference to admin menu item @@ -231,15 +229,16 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im * @param flags * @param initialViewIdentifier supported are null, "toolforum", "toolfolder" */ - public BusinessGroupMainRunController(UserRequest ureq, WindowControl control, BusinessGroup bGroup, BGConfigFlags flags, + public BusinessGroupMainRunController(UserRequest ureq, WindowControl control, BusinessGroup bGroup, String initialViewIdentifier) { super(ureq, control); - this.flags = flags; + /* * lastUsage, update lastUsage if group is run if you can acquire the lock * on the group for a very short time. If this is not possible, then the * lastUsage is already up to date within one-day-precision. */ + securityManager = CoreSpringFactory.getImpl(BaseSecurity.class); businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); businessGroup = businessGroupService.setLastUsageFor(bGroup); if(businessGroup == null) { @@ -257,8 +256,9 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im this.userSession = ureq.getUserSession(); this.assessmentEventOres = OresHelper.createOLATResourceableType(AssessmentEvent.class); - boolean isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(getIdentity(), Constants.PERMISSION_ACCESS, businessGroup); - this.isAdmin = isOwner || flags.isEnabled(BGConfigFlags.IS_GM_ADMIN); + isAdmin = ureq.getUserSession().getRoles().isOLATAdmin() + || ureq.getUserSession().getRoles().isGroupManager() + || securityManager.isIdentityPermittedOnResourceable(getIdentity(), Constants.PERMISSION_ACCESS, businessGroup); // Initialize translator: // package translator with default group fallback translators and type @@ -438,7 +438,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im private void exposeGroupDetailsToVC(BusinessGroup currBusinessGroup) { main.contextPut("BuddyGroup", currBusinessGroup); - main.contextPut("hasOwners", new Boolean(flags.isEnabled(BGConfigFlags.GROUP_OWNERS))); + main.contextPut("hasOwners", Boolean.TRUE); } /** @@ -563,36 +563,36 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im ContactList ownerCntctLst;// = new ContactList(translate("sendtochooser.form.chckbx.owners")); ContactList partipCntctLst;// = new ContactList(translate("sendtochooser.form.chckbx.partip")); ContactList waitingListContactList;// = new ContactList(translate("sendtochooser.form.chckbx.waitingList")); - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) { - if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { - ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.all")); + + if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { + ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.all")); + SecurityGroup owners = businessGroup.getOwnerGroup(); + List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); + ownerCntctLst.addAllIdentites(ownerList); + cmsg.addEmailTo(ownerCntctLst); + } else { + if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) { + ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.choose")); SecurityGroup owners = businessGroup.getOwnerGroup(); List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); - ownerCntctLst.addAllIdentites(ownerList); - cmsg.addEmailTo(ownerCntctLst); - } else { - if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) { - ownerCntctLst = new ContactList(translate("sendtochooser.form.radio.owners.choose")); - SecurityGroup owners = businessGroup.getOwnerGroup(); - List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); - List<Identity> changeableOwnerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); - for (Identity identity : ownerList) { - boolean keyIsSelected = false; - for (Long key : sendToChooserForm.getSelectedOwnerKeys()) { - if (key.equals(identity.getKey())) { - keyIsSelected = true; - break; - } - } - if (!keyIsSelected) { - changeableOwnerList.remove(changeableOwnerList.indexOf(identity)); + List<Identity> changeableOwnerList = scrtMngr.getIdentitiesOfSecurityGroup(owners); + for (Identity identity : ownerList) { + boolean keyIsSelected = false; + for (Long key : sendToChooserForm.getSelectedOwnerKeys()) { + if (key.equals(identity.getKey())) { + keyIsSelected = true; + break; } } - ownerCntctLst.addAllIdentites(changeableOwnerList); - cmsg.addEmailTo(ownerCntctLst); + if (!keyIsSelected) { + changeableOwnerList.remove(changeableOwnerList.indexOf(identity)); + } } + ownerCntctLst.addAllIdentites(changeableOwnerList); + cmsg.addEmailTo(ownerCntctLst); } } + if (sendToChooserForm != null) { if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) { partipCntctLst = new ContactList(translate("sendtochooser.form.radio.partip.all")); @@ -821,7 +821,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im VelocityContainer membersVc = createVelocityContainer("ownersandmembers"); // 1. show owners if configured with Owners DisplayMembers displayMembers = businessGroupService.getDisplayMembers(businessGroup); - if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS) && displayMembers.isShowOwners()) { + if (displayMembers.isShowOwners()) { removeAsListenerAndDispose(gownersC); gownersC = new GroupController(ureq, getWindowControl(), false, true, false, businessGroup.getOwnerGroup()); listenTo(gownersC); @@ -1093,19 +1093,17 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im nodeCal = gtnChild; } - if (flags.isEnabled(BGConfigFlags.SHOW_RESOURCES)) { - gtnChild = new GenericTreeNode(); - gtnChild.setTitle(translate("menutree.resources")); - gtnChild.setUserObject(ACTIVITY_MENUSELECT_SHOW_RESOURCES); - gtnChild.setAltText(translate("menutree.resources.alt")); - gtnChild.setIconCssClass("o_course_icon"); - root.addChild(gtnChild); - //fxdiff BAKS-7 Resume function - nodeResources = gtnChild; - } - + gtnChild = new GenericTreeNode(); + gtnChild.setTitle(translate("menutree.resources")); + gtnChild.setUserObject(ACTIVITY_MENUSELECT_SHOW_RESOURCES); + gtnChild.setAltText(translate("menutree.resources.alt")); + gtnChild.setIconCssClass("o_course_icon"); + root.addChild(gtnChild); + //fxdiff BAKS-7 Resume function + nodeResources = gtnChild; + DisplayMembers displayMembers = businessGroupService.getDisplayMembers(businessGroup); - if ((flags.isEnabled(BGConfigFlags.GROUP_OWNERS) && displayMembers.isShowOwners()) || displayMembers.isShowParticipants()) { + if (displayMembers.isShowOwners() || displayMembers.isShowParticipants()) { // either owners or participants, or both are visible // otherwise the node is not visible gtnChild = new GenericTreeNode(); diff --git a/src/main/java/org/olat/group/ui/wizard/BGCopyWizardController.java b/src/main/java/org/olat/group/ui/wizard/BGCopyWizardController.java index a3762710ed6a0e8e2de2e2689524a005967ecf85..7353b269d8ddcd099bb9aea1085446be515f750f 100644 --- a/src/main/java/org/olat/group/ui/wizard/BGCopyWizardController.java +++ b/src/main/java/org/olat/group/ui/wizard/BGCopyWizardController.java @@ -38,7 +38,6 @@ import org.olat.core.util.Util; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.GroupLoggingAction; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGTranslatorFactory; import org.olat.group.ui.BusinessGroupFormController; import org.olat.util.logging.activity.LoggingResourceable; @@ -60,7 +59,6 @@ public class BGCopyWizardController extends WizardController { private BGCopyWizardCopyForm copyForm; private BusinessGroupFormController groupController; private Translator trans; - private BGConfigFlags flags; private BusinessGroup originalGroup, copiedGroup; /** @@ -71,11 +69,10 @@ public class BGCopyWizardController extends WizardController { * @param originalGroup original business group: master that should be copied * @param flags */ - public BGCopyWizardController(UserRequest ureq, WindowControl wControl, BusinessGroup originalGroup, BGConfigFlags flags) { + public BGCopyWizardController(UserRequest ureq, WindowControl wControl, BusinessGroup originalGroup) { super(ureq, wControl, 2); setBasePackage(BGCopyWizardController.class); this.trans = BGTranslatorFactory.createBGPackageTranslator(PACKAGE, originalGroup.getType(), ureq.getLocale()); - this.flags = flags; this.originalGroup = originalGroup; // init wizard step 1 copyForm = new BGCopyWizardCopyForm(ureq, wControl); @@ -105,10 +102,10 @@ public class BGCopyWizardController extends WizardController { else if (source == copyForm) { if (event == Event.DONE_EVENT) { removeAsListenerAndDispose(groupController); - groupController = new BusinessGroupFormController(ureq, getWindowControl(), this.originalGroup, this.flags.isEnabled(BGConfigFlags.GROUP_MINMAX_SIZE)); + groupController = new BusinessGroupFormController(ureq, getWindowControl(), originalGroup); listenTo(groupController); - groupController.setGroupName(this.originalGroup.getName() + " " + this.trans.translate("bgcopywizard.copyform.name.copy")); + groupController.setGroupName(originalGroup.getName() + " " + trans.translate("bgcopywizard.copyform.name.copy")); setNextWizardStep(this.trans.translate("bgcopywizard.detailsform.title"), this.groupController.getInitialComponent()); } @@ -132,11 +129,11 @@ public class BGCopyWizardController extends WizardController { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); this.originalGroup = bgs.loadBusinessGroup(originalGroup); //OLATResource resource = originalGroup.get(); - String bgName = this.groupController.getGroupName(); - String bgDesc = this.groupController.getGroupDescription(); - Integer bgMax = this.groupController.getGroupMax(); - Integer bgMin = this.groupController.getGroupMin(); - boolean copyAreas = (this.flags.isEnabled(BGConfigFlags.AREAS) && this.copyForm.isCopyAreas()); + String bgName = groupController.getGroupName(); + String bgDesc = groupController.getGroupDescription(); + Integer bgMax = groupController.getGroupMax(); + Integer bgMin = groupController.getGroupMin(); + boolean copyAreas = copyForm.isCopyAreas(); BusinessGroup newGroup = bgs.copyBusinessGroup(originalGroup, bgName, bgDesc, bgMin, bgMax, null, null, copyAreas, copyForm.isCopyTools(), copyForm.isCopyRights(), copyForm.isCopyOwners(), copyForm.isCopyParticipants(), copyForm diff --git a/src/main/java/org/olat/group/ui/wizard/BGMultipleCopyWizardController.java b/src/main/java/org/olat/group/ui/wizard/BGMultipleCopyWizardController.java index b0668a75bfb65521be4764a3fad1122ed70e2d21..9db688e262c8dc8d13be01962cbe5cfaee69e3be 100644 --- a/src/main/java/org/olat/group/ui/wizard/BGMultipleCopyWizardController.java +++ b/src/main/java/org/olat/group/ui/wizard/BGMultipleCopyWizardController.java @@ -39,12 +39,8 @@ import org.olat.core.gui.translator.Translator; import org.olat.core.logging.activity.ThreadLocalUserActivityLogger; import org.olat.core.util.Util; import org.olat.group.BusinessGroup; -import org.olat.group.BusinessGroupManager; -import org.olat.group.BusinessGroupManagerImpl; import org.olat.group.BusinessGroupService; import org.olat.group.GroupLoggingAction; -import org.olat.group.context.BGContext; -import org.olat.group.ui.BGConfigFlags; import org.olat.group.ui.BGTranslatorFactory; import org.olat.util.logging.activity.LoggingResourceable; @@ -63,7 +59,6 @@ public class BGMultipleCopyWizardController extends WizardController { private BGCopyWizardCopyForm copyForm; private Translator trans; - private BGConfigFlags flags; private BusinessGroup originalGroup; private GroupNamesForm groupNamesForm; @@ -75,10 +70,9 @@ public class BGMultipleCopyWizardController extends WizardController { * @param originalGroup original business group: master that should be copied * @param flags */ - public BGMultipleCopyWizardController(UserRequest ureq, WindowControl wControl, BusinessGroup originalGroup, BGConfigFlags flags) { + public BGMultipleCopyWizardController(UserRequest ureq, WindowControl wControl, BusinessGroup originalGroup) { super(ureq, wControl, 2); this.trans = BGTranslatorFactory.createBGPackageTranslator(PACKAGE, originalGroup.getType(), ureq.getLocale()); - this.flags = flags; this.originalGroup = originalGroup; // init wizard step 1 this.copyForm = new BGCopyWizardCopyForm(ureq, wControl); @@ -142,9 +136,8 @@ public class BGMultipleCopyWizardController extends WizardController { private BusinessGroup doCopyGroup(String newGroupName, Integer max) { BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class); // reload original group to prevent context proxy problems - this.originalGroup = bgs.loadBusinessGroup(this.originalGroup); - //BGContext bgContext = this.originalGroup.getGroupContext(); - boolean copyAreas = (flags.isEnabled(BGConfigFlags.AREAS) && copyForm.isCopyAreas()); + originalGroup = bgs.loadBusinessGroup(this.originalGroup); + boolean copyAreas = copyForm.isCopyAreas(); //TODO gm copy relations to resources BusinessGroup newGroup = bgs.copyBusinessGroup(originalGroup, newGroupName, originalGroup.getDescription(), null, max, null, null, copyAreas, diff --git a/src/main/java/org/olat/modules/vitero/ui/ViteroUserToGroupController.java b/src/main/java/org/olat/modules/vitero/ui/ViteroUserToGroupController.java index 636ae31a6069ddfb5a77dc8eb6e3f2e58296e1f8..3f3c8875420aedc1ecafd01b7ac67b94e88d6fd6 100644 --- a/src/main/java/org/olat/modules/vitero/ui/ViteroUserToGroupController.java +++ b/src/main/java/org/olat/modules/vitero/ui/ViteroUserToGroupController.java @@ -241,9 +241,9 @@ public class ViteroUserToGroupController extends BasicController { courseGroupManager = course.getCourseEnvironment().getCourseGroupManager(); } coaches.addAll(courseGroupManager.getCoachesFromArea(null)); - coaches.addAll(courseGroupManager.getCoachesFromLearningGroup(null)); + coaches.addAll(courseGroupManager.getCoachesFromBusinessGroup(null)); participants.addAll(courseGroupManager.getParticipantsFromArea(null)); - participants.addAll(courseGroupManager.getParticipantsFromLearningGroup(null)); + participants.addAll(courseGroupManager.getParticipantsFromBusinessGroup(null)); } List<Identity> repoOwners = securityManager.getIdentitiesOfSecurityGroup(repoEntry.getOwnerGroup()); diff --git a/src/main/java/org/olat/repository/RepositoryManager.java b/src/main/java/org/olat/repository/RepositoryManager.java index a993679a0aa4c3cd2b6a37ab78dd51095ac58a76..0e0286a9dd58216bf6026d85f4b26ede8158817d 100644 --- a/src/main/java/org/olat/repository/RepositoryManager.java +++ b/src/main/java/org/olat/repository/RepositoryManager.java @@ -1582,9 +1582,10 @@ public class RepositoryManager extends BasicManager { */ private List<BusinessGroup> getCourseGroups(RepositoryEntry repoEntry) { if("CourseModule".equals(repoEntry.getOlatResource().getResourceableTypeName())) { + //TODO gm ICourse course = CourseFactory.loadCourse(repoEntry.getOlatResource()); CourseGroupManager gm = course.getCourseEnvironment().getCourseGroupManager(); - List<BusinessGroup> groups = gm.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> groups = gm.getAllBusinessGroups(); return groups; } return Collections.emptyList(); diff --git a/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java b/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java index ac636270a87a287d6327ab1f634dfe00879ab409..60c8e781e3439a82b0b4cb0a021ee2ff1f5a0350 100644 --- a/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java +++ b/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java @@ -67,7 +67,6 @@ import org.olat.course.CourseFactory; import org.olat.course.ICourse; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntryStatus; import org.olat.repository.RepositoryManager; @@ -255,20 +254,19 @@ public class WizardCloseCourseController extends WizardController implements Wiz BaseSecurity securityManager = BaseSecurityManager.getInstance(); // LearningGroups - List<BusinessGroup> allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts(); - BGConfigFlags flagsLearning = BGConfigFlags.createLearningGroupDefaultFlags(); + List<BusinessGroup> allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups(); for (BusinessGroup bGroup : allGroups) { SecurityGroup secGroupOwner = bGroup.getOwnerGroup(); SecurityGroup secGroupPartipiciant = bGroup.getPartipiciantGroup(); SecurityGroup secGroupWaiting = bGroup.getWaitingGroup(); if(secGroupOwner != null) { - businessGroupService.removeOwners(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupOwner), bGroup, flagsLearning); + businessGroupService.removeOwners(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupOwner), bGroup); } if(secGroupPartipiciant != null) { - businessGroupService.removeParticipants(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), bGroup, flagsLearning); + businessGroupService.removeParticipants(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), bGroup); } if(secGroupWaiting != null) { - businessGroupService.removeFromWaitingList(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupWaiting), bGroup, flagsLearning); + businessGroupService.removeFromWaitingList(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupWaiting), bGroup); } } @@ -328,13 +326,11 @@ class CloseRessourceOptionForm extends FormBasicController { } @Override - @SuppressWarnings("unused") protected void formOK(UserRequest ureq) { // nothing to do } @Override - @SuppressWarnings("unused") public void event(UserRequest ureq, Component source, Event event) { if(event.getCommand().equals(Form.EVNT_VALIDATION_OK.getCommand())) { fireEvent(ureq, Event.DONE_EVENT); @@ -344,7 +340,6 @@ class CloseRessourceOptionForm extends FormBasicController { } @Override - @SuppressWarnings("unused") protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { String[] keys = new String[] {"form.clean.catalog", "form.clean.groups"}; diff --git a/src/main/java/org/olat/resource/accesscontrol/ui/SecurityGroupsRepositoryMainController.java b/src/main/java/org/olat/resource/accesscontrol/ui/SecurityGroupsRepositoryMainController.java index c13a5484ecdd2f818698be7148f7a891d2c76b32..6ebf95b87949da84871b30f2e056da602ca8e6e4 100644 --- a/src/main/java/org/olat/resource/accesscontrol/ui/SecurityGroupsRepositoryMainController.java +++ b/src/main/java/org/olat/resource/accesscontrol/ui/SecurityGroupsRepositoryMainController.java @@ -335,7 +335,7 @@ public class SecurityGroupsRepositoryMainController extends MainLayoutBasicContr if("CourseModule".equals(repoEntry.getOlatResource().getResourceableTypeName())) { ICourse course = CourseFactory.loadCourse(repoEntry.getOlatResource()); CourseGroupManager gm = course.getCourseEnvironment().getCourseGroupManager(); - List<BusinessGroup> groups = gm.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> groups = gm.getAllBusinessGroups(); return groups; } return Collections.emptyList(); diff --git a/src/main/java/org/olat/restapi/group/LearningGroupWebService.java b/src/main/java/org/olat/restapi/group/LearningGroupWebService.java index e92823d678c5beb4f1450a872da7eab76f5f86f6..7f340f7295761ead23d563642a41038b1d4174cc 100644 --- a/src/main/java/org/olat/restapi/group/LearningGroupWebService.java +++ b/src/main/java/org/olat/restapi/group/LearningGroupWebService.java @@ -68,7 +68,6 @@ import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.model.DisplayMembers; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.modules.fo.Forum; import org.olat.modules.fo.restapi.ForumWebService; import org.olat.modules.wiki.restapi.GroupWikiWebService; @@ -483,9 +482,8 @@ public class LearningGroupWebService { //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerCallback<Boolean>(){ public Boolean execute() { - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); List<Identity> identityToAdd = Collections.singletonList(identity); - bgs.addOwners(ureq.getIdentity(), identityToAdd, group, flags); + bgs.addOwners(ureq.getIdentity(), identityToAdd, group); return Boolean.TRUE; } });// end of doInSync @@ -543,8 +541,7 @@ public class LearningGroupWebService { //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerCallback<Boolean>(){ public Boolean execute() { - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - bgs.removeOwners(ureq.getIdentity(), Collections.singletonList(identity), group, flags); + bgs.removeOwners(ureq.getIdentity(), Collections.singletonList(identity), group); return Boolean.TRUE; } });// end of doInSync @@ -600,8 +597,7 @@ public class LearningGroupWebService { //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerCallback<Boolean>(){ public Boolean execute() { - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - bgs.addParticipant(ureq.getIdentity(), identity, group, flags); + bgs.addParticipant(ureq.getIdentity(), identity, group); return Boolean.TRUE; } });// end of doInSync @@ -657,8 +653,7 @@ public class LearningGroupWebService { //TODO gsync CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(group, new SyncerExecutor(){ public void execute() { - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); - bgs.removeParticipant(ureq.getIdentity(), identity, group, flags); + bgs.removeParticipant(ureq.getIdentity(), identity, group); } }); diff --git a/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java index c0d65e7fb40a472b86540cc0a4f6807d9d2503af..043fb27297737def3b19cea0b93d6b0b7b2b893e 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseAssessmentWebService.java @@ -579,7 +579,7 @@ public class CourseAssessmentWebService { private List<Identity> loadUsers(ICourse course) { List<Identity> identites = new ArrayList<Identity>(); BaseSecurity securityManager = BaseSecurityManager.getInstance(); - List<BusinessGroup> groups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> groups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups(); Set<Long> check = new HashSet<Long>(); for(BusinessGroup group:groups) { diff --git a/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java b/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java index 2d25228b7e176bfd6648cf599c69337122bd4079..0c27c1400684cdf093e854772c6b5160444ee991 100644 --- a/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java @@ -173,7 +173,7 @@ public class CourseGroupWebService { @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getGroupList(@Context HttpServletRequest request) { CourseGroupManager groupManager = PersistingCourseGroupManager.getInstance(course); - List<BusinessGroup> groups = groupManager.getAllLearningGroupsFromAllContexts(); + List<BusinessGroup> groups = groupManager.getAllBusinessGroups(); int count = 0; GroupVO[] vos = new GroupVO[groups.size()]; diff --git a/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java b/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java index 00f7bcb5a3aa519ef257f8c4d7a808c0370363a3..d8c3521b06f9df47e5c2cc764fe27071005474f0 100644 --- a/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java +++ b/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java @@ -221,8 +221,8 @@ public class CourseGroupManagementTest extends OlatTestCase { assertFalse(gm.isIdentityInLearningArea(id3, a3.getName())); DBFactory.getInstance().closeSession(); - Assert.assertEquals(2, gm.getLearningAreasOfGroupFromAllContexts(g1.getName()).size()); - Assert.assertEquals(2, gm.getLearningAreasOfGroupFromAllContexts(g2.getName()).size()); + Assert.assertEquals(2, gm.getAreasOfBusinessGroup(g1.getName()).size()); + Assert.assertEquals(2, gm.getAreasOfBusinessGroup(g2.getName()).size()); // test rights DBFactory.getInstance().closeSession(); diff --git a/src/test/java/org/olat/course/nodes/projectbroker/ProjectBrokerManagerTest.java b/src/test/java/org/olat/course/nodes/projectbroker/ProjectBrokerManagerTest.java index b34aec96de4c1bc1997f95a2c4502875399aeeee..90861e010c70f118c441059d313a8b2049e20b06 100644 --- a/src/test/java/org/olat/course/nodes/projectbroker/ProjectBrokerManagerTest.java +++ b/src/test/java/org/olat/course/nodes/projectbroker/ProjectBrokerManagerTest.java @@ -60,7 +60,6 @@ import org.olat.course.nodes.projectbroker.service.ProjectBrokerModuleConfigurat import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupImpl; import org.olat.group.BusinessGroupService; -import org.olat.group.ui.BGConfigFlags; import org.olat.modules.ModuleConfiguration; import org.olat.repository.RepositoryEntry; import org.olat.test.JunitTestHelper; @@ -264,27 +263,18 @@ public class ProjectBrokerManagerTest extends OlatTestCase { Project testProjectA = createProject("thema A", id1, idProjectBrokerD, resourceableId ); List<Identity> projectManagerList = new ArrayList<Identity>(); projectManagerList.add(id1); - BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags(); Project testProjectB = createProject("thema B", id2, idProjectBrokerD, resourceableId ); // check project leader in ProjectA assertTrue("Must be project-leader of project A", ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManager(id1, testProjectA)); assertFalse("Can not be project leader of project B",ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManager(id1, testProjectB)); assertTrue("Must be project-leader of project A", ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManager(id2, testProjectB)); - CoreSpringFactory.getImpl(BusinessGroupService.class).removeOwners(id1, projectManagerList, testProjectA.getProjectGroup(),flags); + CoreSpringFactory.getImpl(BusinessGroupService.class).removeOwners(id1, projectManagerList, testProjectA.getProjectGroup()); // check no project leader anymore assertFalse("Can not be project leader of project A",ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManager(id1, testProjectA)); assertFalse("Can not be project leader of project B",ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManager(id1, testProjectB)); // cleanup } - - @Test public void testAcceptManuall() throws Exception { -// - } - - @Test public void testAcceptAutomaticly() throws Exception { - // - } @Test public void testExistsProject() throws Exception { // 1. test project does not exists diff --git a/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java b/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java index 095927746ac44861e06639dfd275611f9e130c9b..c59f511f6d2b197fc02cc837fdc32b7f13fcf8d0 100644 --- a/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java +++ b/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java @@ -51,7 +51,6 @@ import org.olat.core.util.Encoder; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.model.SearchBusinessGroupParams; -import org.olat.group.ui.BGConfigFlags; import org.olat.resource.OLATResource; import org.olat.test.JunitTestHelper; import org.olat.test.OlatTestCase; @@ -457,18 +456,17 @@ public class BusinessGroupServiceTest extends OlatTestCase { public void testAddToWaitingListAndFireEvent() throws Exception { System.out.println("testAddToWaitingListAndFireEvent: start..."); // Add wg2 - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); List<Identity> identities = new ArrayList<Identity>(); identities.add(wg2); - businessGroupService.addToWaitingList(wg2, identities, bgWithWaitingList, flags); + businessGroupService.addToWaitingList(wg2, identities, bgWithWaitingList); // Add wg3 identities = new ArrayList<Identity>(); identities.add(wg3); - businessGroupService.addToWaitingList(wg3, identities, bgWithWaitingList, flags); + businessGroupService.addToWaitingList(wg3, identities, bgWithWaitingList); // Add wg4 identities = new ArrayList<Identity>(); identities.add(wg4); - businessGroupService.addToWaitingList(wg4, identities, bgWithWaitingList, flags); + businessGroupService.addToWaitingList(wg4, identities, bgWithWaitingList); System.out.println("testAddToWaitingListAndFireEvent: 3 user added to waiting list"); // Check position of 'wg2' @@ -494,10 +492,9 @@ public class BusinessGroupServiceTest extends OlatTestCase { public void testRemoveFromWaitingListAndFireEvent() throws Exception { System.out.println("testRemoveFromWaitingListAndFireEvent: start..."); // Remove wg3 - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); List<Identity> identities = new ArrayList<Identity>(); identities.add(wg3); - businessGroupService.removeFromWaitingList(wg1, identities, bgWithWaitingList, flags); + businessGroupService.removeFromWaitingList(wg1, identities, bgWithWaitingList); // Check position of 'wg2' int pos = businessGroupService.getPositionInWaitingListFor(wg2, bgWithWaitingList); System.out.println("testRemoveFromWaitingListAndFireEvent: wg2 pos=" + pos); @@ -523,10 +520,9 @@ public class BusinessGroupServiceTest extends OlatTestCase { .isIdentityInBusinessGroup(wg4, bgWithWaitingList)); // Move wg4 from waiting-list to participant - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); List<Identity> identities = new ArrayList<Identity>(); identities.add(wg4); - businessGroupService.moveIdentityFromWaitingListToParticipant(identities, wg1, bgWithWaitingList, flags); + businessGroupService.moveIdentityFromWaitingListToParticipant(identities, wg1, bgWithWaitingList); // Check position of 'wg2' int pos = businessGroupService.getPositionInWaitingListFor(wg2, bgWithWaitingList); System.out.println("testMoveIdenityFromWaitingListToParticipant: wg2 pos=" + pos); @@ -541,13 +537,12 @@ public class BusinessGroupServiceTest extends OlatTestCase { // Add a user to waiting-list which is already in participant-list and try // and try to move this user => user will be removed from waiting-list // Add again wg2 - BGConfigFlags flags = BGConfigFlags.createLearningGroupDefaultFlags(); List<Identity> identities = new ArrayList<Identity>(); identities.add(wg1); - businessGroupService.addToWaitingList(wg4, identities, bgWithWaitingList, flags); + businessGroupService.addToWaitingList(wg4, identities, bgWithWaitingList); identities = new ArrayList<Identity>(); identities.add(wg4); - businessGroupService.moveIdentityFromWaitingListToParticipant(identities, wg1, bgWithWaitingList, flags); + businessGroupService.moveIdentityFromWaitingListToParticipant(identities, wg1, bgWithWaitingList); // Check position of 'wg4' int pos = businessGroupService.getPositionInWaitingListFor(wg4, bgWithWaitingList); System.out.println("testMoveIdenityFromWaitingListToParticipant: wg4 pos=" + pos);