From 7f61cada3c40f0258af8ecc23f1ea492a264cebb Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Thu, 28 Jun 2012 17:07:58 +0200
Subject: [PATCH] OO-291: remove group types, unit test BusinessGroupDAO

---
 .../coursecreation/CourseCreationHelper.java  |   2 +-
 .../InstantMessagingAdminController.java      |   3 +-
 .../SystemRegistrationManager.java            |  16 +-
 .../user/groups/GroupOverviewController.java  |  84 ++-
 .../groups/GroupSearchResultProvider.java     |  16 +-
 .../collaboration/CollaborationTools.java     |  24 +-
 .../java/org/olat/course/CourseFactory.java   |   2 -
 .../org/olat/course/PersistingCourseImpl.java |   2 +-
 .../interpreter/InRightGroupFunction.java     |   2 +-
 .../olat/course/editor/CourseEditorEnv.java   |   2 -
 .../course/editor/CourseEditorEnvImpl.java    |   8 +-
 .../groupsandrights/CourseGroupManager.java   |  20 +-
 .../PersistingCourseGroupManager.java         |  57 +-
 .../CourseGroupManagementMainController.java  |   4 +-
 .../course/nodes/cal/CourseCalendars.java     |  31 +-
 .../service/ProjectGroupManagerImpl.java      |  10 +-
 .../olat/course/run/RunMainController.java    |  28 +-
 .../calendar/CourseCalendarController.java    |  34 +-
 .../java/org/olat/group/BusinessGroup.java    |   6 +-
 .../org/olat/group/BusinessGroupFactory.java  |  20 +-
 .../org/olat/group/BusinessGroupImpl.java     |   4 +-
 .../org/olat/group/BusinessGroupService.java  |  25 +-
 .../group/GroupfoldersWebDAVMergeSource.java  |   2 -
 .../group/context/BGContextManagerImpl.java   |  81 +--
 .../group/delete/ReadyToDeleteController.java |   2 +-
 .../group/delete/SelectionController.java     |   2 +-
 .../olat/group/delete/StatusController.java   |   2 +-
 .../olat/group/manager/BusinessGroupDAO.java  | 185 ++----
 .../manager/BusinessGroupImportExport.java    |   3 +-
 .../manager/BusinessGroupRelationDAO.java     | 123 ++++
 .../manager/BusinessGroupServiceImpl.java     |  46 +-
 .../olat/group/ui/BGControllerFactory.java    |  24 +-
 .../olat/group/ui/BGTranslatorFactory.java    |  11 +-
 .../olat/group/ui/main/BGMainController.java  |  19 +-
 .../ui/management/BGManagementController.java |  15 +-
 .../run/BusinessGroupMainRunController.java   |  29 +-
 .../run/BusinessGroupSendToChooserForm.java   |  37 +-
 .../org/olat/home/HomeCalendarController.java |   1 -
 .../instantMessaging/InstantMessaging.java    |   9 +-
 .../instantMessaging/InstantMessagingJob.java |   2 +-
 .../InstantMessagingModule.java               |   7 +-
 .../SmackInstantMessagingImpl.java            |  36 +-
 .../fo/restapi/MyForumsWebService.java        |   1 -
 .../controllers/RepositoryMainController.java |   2 -
 .../WizardCloseCourseController.java          |  23 +-
 .../olat/restapi/group/MyGroupWebService.java |   4 -
 .../course/CourseGroupWebService.java         |   2 +-
 .../restapi/user/UserFoldersWebService.java   |   3 -
 .../org/olat/upgrade/OLATUpgrade_7_1_1.java   |  43 +-
 .../lifecycle/LifeCycleManagerTest.java       |   2 +-
 .../CourseGroupManagementTest.java            |  16 +-
 .../nodes/en/EnrollmentManagerTest.java       |   2 +-
 .../olat/group/test/BGRightManagerTest.java   |   6 +-
 .../olat/group/test/BusinessGroupDAOTest.java | 596 +++++++++++++++++-
 .../test/BusinessGroupRelationDAOTest.java    |  33 +
 .../test/BusinessGroupServiceImplTest.java    | 104 +--
 .../group/test/BusinessGroupServiceTest.java  |  19 +-
 .../org/olat/properties/PropertyTest.java     |   4 +-
 .../java/org/olat/restapi/ContactsTest.java   |   8 +-
 .../org/olat/restapi/CourseGroupMgmtTest.java |   8 +-
 .../org/olat/restapi/GroupFoldersTest.java    |   4 +-
 .../java/org/olat/restapi/GroupMgmtTest.java  |   8 +-
 .../java/org/olat/restapi/UserMgmtTest.java   |   8 +-
 .../profile/mysql/olat.eclipse.properties     |   2 +-
 64 files changed, 1156 insertions(+), 778 deletions(-)
 create mode 100644 src/test/java/org/olat/group/test/BusinessGroupRelationDAOTest.java

diff --git a/src/main/java/de/tuchemnitz/wizard/workflows/coursecreation/CourseCreationHelper.java b/src/main/java/de/tuchemnitz/wizard/workflows/coursecreation/CourseCreationHelper.java
index d96c150a3a0..050fa99f223 100644
--- a/src/main/java/de/tuchemnitz/wizard/workflows/coursecreation/CourseCreationHelper.java
+++ b/src/main/java/de/tuchemnitz/wizard/workflows/coursecreation/CourseCreationHelper.java
@@ -196,7 +196,7 @@ public class CourseCreationHelper {
 			for (int i = 0; i < courseConfig.getGroupCount(); i++) {
 				// create group
 				BusinessGroup learningGroup = bgs.createBusinessGroup( null, groupBaseName + " "
-						+ (i + 1), null, BusinessGroup.TYPE_LEARNINGROUP, 0, courseConfig.getSubscriberCount(), courseConfig.getEnableWaitlist(), courseConfig.getEnableFollowup(),
+						+ (i + 1), null, 0, courseConfig.getSubscriberCount(), courseConfig.getEnableWaitlist(), courseConfig.getEnableFollowup(),
 						course.getCourseEnvironment().getCourseGroupManager().getCourseResource());
 				// enable the contact collaboration tool
 				CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(learningGroup);
diff --git a/src/main/java/org/olat/admin/instantMessaging/InstantMessagingAdminController.java b/src/main/java/org/olat/admin/instantMessaging/InstantMessagingAdminController.java
index 01c09bed9af..3c93f2da816 100644
--- a/src/main/java/org/olat/admin/instantMessaging/InstantMessagingAdminController.java
+++ b/src/main/java/org/olat/admin/instantMessaging/InstantMessagingAdminController.java
@@ -72,8 +72,7 @@ public class InstantMessagingAdminController extends FormBasicController {
 		InstantMessaging im = InstantMessagingModule.getAdapter();
 		if (source == doSyncButton) {
 			showInfo("imadmin.sync.cmd.dosync.caption");
-			boolean allOk = im.synchronizeAllBuddyGroupsWithIMServer();
-			allOk &= im.synchronizeLearningGroupsWithIMServer();
+			boolean allOk = im.synchronizeBusinessGroupsWithIMServer();
 			if (!allOk) {
 				refreshAndSetConnectionStatus();
 				showError("imadmin.sync.failed");
diff --git a/src/main/java/org/olat/admin/registration/SystemRegistrationManager.java b/src/main/java/org/olat/admin/registration/SystemRegistrationManager.java
index f204aa6f977..a4864764e14 100644
--- a/src/main/java/org/olat/admin/registration/SystemRegistrationManager.java
+++ b/src/main/java/org/olat/admin/registration/SystemRegistrationManager.java
@@ -27,7 +27,6 @@ package org.olat.admin.registration;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.Calendar;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -55,7 +54,6 @@ import org.olat.core.util.StringHelper;
 import org.olat.core.util.httpclient.HttpClientFactory;
 import org.olat.core.util.i18n.I18nModule;
 import org.olat.course.CourseModule;
-import org.olat.group.BusinessGroup;
 import org.olat.group.BusinessGroupService;
 import org.olat.group.model.SearchBusinessGroupParams;
 import org.olat.instantMessaging.InstantMessagingModule;
@@ -306,15 +304,11 @@ public class SystemRegistrationManager extends BasicManager implements Initializ
 		
 		// Groups
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.setTypes(Collections.singletonList(BusinessGroup.TYPE_BUDDYGROUP));
-		int buddyGroups = businessGroupService.countBusinessGroups(params, null, false, false, null);
-		msgProperties.put("buddyGroups", String.valueOf(buddyGroups));
-		params.setTypes(Collections.singletonList(BusinessGroup.TYPE_LEARNINGROUP));
-		int learningGroups = businessGroupService.countBusinessGroups(params, null, false, false, null);
-		msgProperties.put("learningGroups", String.valueOf(learningGroups));
-		params.setTypes(Collections.singletonList(BusinessGroup.TYPE_RIGHTGROUP));
-		int rightGroups = businessGroupService.countBusinessGroups(params, null, false, false, null);
-		msgProperties.put("rightGroups", String.valueOf(rightGroups));
+		int groups = businessGroupService.countBusinessGroups(params, null, false, false, null);
+		msgProperties.put("buddyGroups", String.valueOf(groups));
+		msgProperties.put("learningGroups", String.valueOf(groups));
+		msgProperties.put("rightGroups", String.valueOf(groups));
+		msgProperties.put("groups", String.valueOf(groups));
 			
 		if (website) {
 			// URL
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 199a4a22ca0..c586dc81083 100644
--- a/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java
+++ b/src/main/java/org/olat/admin/user/groups/GroupOverviewController.java
@@ -25,6 +25,7 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.olat.basesecurity.BaseSecurity;
 import org.olat.basesecurity.BaseSecurityManager;
@@ -131,50 +132,47 @@ public class GroupOverviewController extends BasicController {
 
 		BaseSecurity sm = BaseSecurityManager.getInstance();
 		List<Object[]> userGroups = new ArrayList<Object[]>();
-			//loop over all kind of groups with all possible memberships
-			List<String> bgTypes = new ArrayList<String>();
-			bgTypes.add(BusinessGroup.TYPE_BUDDYGROUP);
-			bgTypes.add(BusinessGroup.TYPE_LEARNINGROUP);
-			bgTypes.add(BusinessGroup.TYPE_RIGHTGROUP);
-			for (String bgType : bgTypes) {				
-				List<BusinessGroup> ownedGroups = businessGroupService.findBusinessGroupsOwnedBy(bgType, identity, null);
-				List<BusinessGroup> attendedGroups = businessGroupService.findBusinessGroupsAttendedBy(bgType, identity, null);
-				List<BusinessGroup> waitingGroups = businessGroupService.findBusinessGroupsWithWaitingListAttendedBy(bgType, identity, null);
-				//using HashSet to remove duplicate entries
-				HashSet<BusinessGroup> allGroups = new HashSet<BusinessGroup>();
-				allGroups.addAll(ownedGroups);
-				allGroups.addAll(attendedGroups);
-				allGroups.addAll(waitingGroups);
-				
-				Iterator<BusinessGroup> iter = allGroups.iterator();
-				while (iter.hasNext()) {
-					Object[] groupEntry = new Object[4];
-					BusinessGroup group = iter.next();
-					groupEntry[0] = translate(group.getType());
-					groupEntry[1] = group;
-					Date joinDate = null;
-					if(attendedGroups.contains(group)&&ownedGroups.contains(group)) {
-						groupEntry[2] = translate("attende.and.owner");
-						joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
-					}
-					else if(attendedGroups.contains(group)) {
-						groupEntry[2] = translate("attende");
-						joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
-					}
-					else if(ownedGroups.contains(group)) {
-						groupEntry[2] = translate("owner");
-						joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getOwnerGroup(), identity);
-					}
-					else if(waitingGroups.contains(group)) {
-						int waitingListPosition = businessGroupService.getPositionInWaitingListFor(identity, group);
-						groupEntry[2] = translate("waiting", String.valueOf(waitingListPosition));
-						joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getWaitingGroup(), identity);
-					}
-					groupEntry[3] = joinDate;
-					
-					userGroups.add(groupEntry);
-					}			
+		//loop over all kind of groups with all possible memberships
+
+
+		List<BusinessGroup> ownedGroups = businessGroupService.findBusinessGroupsOwnedBy(identity, null);
+		List<BusinessGroup> attendedGroups = businessGroupService.findBusinessGroupsAttendedBy(identity, null);
+		List<BusinessGroup> waitingGroups = businessGroupService.findBusinessGroupsWithWaitingListAttendedBy(identity, null);
+		//using HashSet to remove duplicate entries
+		Set<BusinessGroup> allGroups = new HashSet<BusinessGroup>();
+		allGroups.addAll(ownedGroups);
+		allGroups.addAll(attendedGroups);
+		allGroups.addAll(waitingGroups);
+		
+		Iterator<BusinessGroup> iter = allGroups.iterator();
+		while (iter.hasNext()) {
+			Object[] groupEntry = new Object[4];
+			BusinessGroup group = iter.next();
+			groupEntry[0] = translate(group.getType());
+			groupEntry[1] = group;
+			Date joinDate = null;
+			if(attendedGroups.contains(group)&&ownedGroups.contains(group)) {
+				groupEntry[2] = translate("attende.and.owner");
+				joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
+			}
+			else if(attendedGroups.contains(group)) {
+				groupEntry[2] = translate("attende");
+				joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
+			}
+			else if(ownedGroups.contains(group)) {
+				groupEntry[2] = translate("owner");
+				joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getOwnerGroup(), identity);
 			}
+			else if(waitingGroups.contains(group)) {
+				int waitingListPosition = businessGroupService.getPositionInWaitingListFor(identity, group);
+				groupEntry[2] = translate("waiting", String.valueOf(waitingListPosition));
+				joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getWaitingGroup(), identity);
+			}
+			groupEntry[3] = joinDate;
+			
+			userGroups.add(groupEntry);
+		}			
+
 		tableDataModel = new GroupOverviewModel(userGroups, 4);
 		tblCtr.setTableDataModel(tableDataModel);
 	}
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 567014a72d2..03af2beaf0d 100644
--- a/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java
+++ b/src/main/java/org/olat/admin/user/groups/GroupSearchResultProvider.java
@@ -125,12 +125,10 @@ public class GroupSearchResultProvider implements ResultMapProvider {
 					if (!tempResult.containsKey(group.getKey())) {
 						tempResult.put(group.getKey(), getCombinedRepoName(group, repoEntry));
 					}
-				}				
-				
-				if (group.getType().equals(BusinessGroup.TYPE_BUDDYGROUP)) {
-					if (!tempResult.containsKey(group.getKey())) {
-						tempResult.put(group.getKey(), prepareGroupName(group));
-					}
+				}
+
+				if (!tempResult.containsKey(group.getKey())) {
+					tempResult.put(group.getKey(), prepareGroupName(group));
 				}
 			}			
 		}
@@ -160,11 +158,7 @@ public class GroupSearchResultProvider implements ResultMapProvider {
 		
 		for (RepositoryEntry repositoryEntry : allRepoEntries) {
 			ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
-			List<BusinessGroup> allCourseGroups = new ArrayList<BusinessGroup>();
-			List<BusinessGroup> courseLGs = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts();
-			List<BusinessGroup> courseRGs = course.getCourseEnvironment().getCourseGroupManager().getAllRightGroupsFromAllContexts();
-			allCourseGroups.addAll(courseLGs);
-			allCourseGroups.addAll(courseRGs);
+			List<BusinessGroup> allCourseGroups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts();
 			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 d30af07d3ca..1565aaad6e4 100644
--- a/src/main/java/org/olat/collaboration/CollaborationTools.java
+++ b/src/main/java/org/olat/collaboration/CollaborationTools.java
@@ -442,20 +442,20 @@ public class CollaborationTools implements Serializable {
 			calRenderWrapper.getKalendarConfig().setVis(config.isVis());
 		}
 		calRenderWrapper.getKalendarConfig().setResId(businessGroup.getKey());
-		if (businessGroup.getType().equals(BusinessGroup.TYPE_LEARNINGROUP)) {
-			// add linking
-			List<OLATResource> resources = CoreSpringFactory.getImpl(BusinessGroupService.class).findResources(Collections.singleton(businessGroup), 0, -1);
-			for (OLATResource resource:resources) {
-				if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
-					ICourse course = CourseFactory.loadCourse(resource);
-					CourseLinkProviderController clp = new CourseLinkProviderController(course, ureq, wControl);
-					calRenderWrapper.setLinkProvider(clp);
-					// for the time being only internal learning groups are supported, therefore we only get
-					// the first course reference.
-					break;
-				}
+
+		// add linking
+		List<OLATResource> resources = CoreSpringFactory.getImpl(BusinessGroupService.class).findResources(Collections.singleton(businessGroup), 0, -1);
+		for (OLATResource resource:resources) {
+			if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
+				ICourse course = CourseFactory.loadCourse(resource);
+				CourseLinkProviderController clp = new CourseLinkProviderController(course, ureq, wControl);
+				calRenderWrapper.setLinkProvider(clp);
+				// for the time being only internal learning groups are supported, therefore we only get
+				// the first course reference.
+				break;
 			}
 		}
+
 		calendars.add(calRenderWrapper);
 		
 		WeeklyCalendarController calendarController = new WeeklyCalendarController(
diff --git a/src/main/java/org/olat/course/CourseFactory.java b/src/main/java/org/olat/course/CourseFactory.java
index b61854e6555..cd022218e8f 100644
--- a/src/main/java/org/olat/course/CourseFactory.java
+++ b/src/main/java/org/olat/course/CourseFactory.java
@@ -426,8 +426,6 @@ public class CourseFactory extends BasicManager {
 		NotificationsManager nfm = NotificationsManager.getInstance();
 		CourseGroupManager courseGroupManager = PersistingCourseGroupManager.getInstance(res);
 		List<BusinessGroup> learningGroups = courseGroupManager.getAllLearningGroupsFromAllContexts();
-		List<BusinessGroup> rightGroups = courseGroupManager.getAllRightGroupsFromAllContexts();
-		learningGroups.addAll(rightGroups);
 		//all learning and right group calendars
 		for (BusinessGroup bg : learningGroups) {
 			KalendarRenderWrapper calRenderWrapper = calMan.getGroupCalendar(bg);
diff --git a/src/main/java/org/olat/course/PersistingCourseImpl.java b/src/main/java/org/olat/course/PersistingCourseImpl.java
index 01346c4b19a..5444911f27d 100644
--- a/src/main/java/org/olat/course/PersistingCourseImpl.java
+++ b/src/main/java/org/olat/course/PersistingCourseImpl.java
@@ -366,7 +366,7 @@ public class PersistingCourseImpl implements ICourse, OLATResourceable, Serializ
 		// export learning groups
 		PersistingCourseGroupManager.getInstance(this).exportCourseLeaningGroups(fExportedDataDir);
 		// export right groups
-		PersistingCourseGroupManager.getInstance(this).exportCourseRightGroups(fExportedDataDir);
+		//PersistingCourseGroupManager.getInstance(this).exportCourseRightGroups(fExportedDataDir);
 		// export repo metadata
 		RepositoryManager rm = RepositoryManager.getInstance();
 		RepositoryEntry myRE = rm.lookupRepositoryEntry(this, true);
diff --git a/src/main/java/org/olat/course/condition/interpreter/InRightGroupFunction.java b/src/main/java/org/olat/course/condition/interpreter/InRightGroupFunction.java
index e6cd6063a05..66faf4d32da 100644
--- a/src/main/java/org/olat/course/condition/interpreter/InRightGroupFunction.java
+++ b/src/main/java/org/olat/course/condition/interpreter/InRightGroupFunction.java
@@ -72,7 +72,7 @@ public class InRightGroupFunction extends AbstractFunction {
 		 */
 		CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
 		if (cev != null) {
-			if (!cev.existsRightGroup(groupName)) { return handleException( new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, groupName,
+			if (!cev.existsGroup(groupName)) { return handleException( new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, groupName,
 					"error.notfound.name", "solution.checkgroupmanagement")); }
 			// remember the reference to the node id for this condtion
 			cev.addSoftReference("groupId", groupName);
diff --git a/src/main/java/org/olat/course/editor/CourseEditorEnv.java b/src/main/java/org/olat/course/editor/CourseEditorEnv.java
index 8cae5e7ee01..93c96bd6f10 100644
--- a/src/main/java/org/olat/course/editor/CourseEditorEnv.java
+++ b/src/main/java/org/olat/course/editor/CourseEditorEnv.java
@@ -65,8 +65,6 @@ public interface CourseEditorEnv {
 	 * @return
 	 */
 	boolean existsGroup(String groupname);
-
-	boolean existsRightGroup(String groupname);
 	
 	/**
 	 * @param areaname
diff --git a/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java b/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java
index 2e3aa93be3e..2b202591b28 100644
--- a/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java
+++ b/src/main/java/org/olat/course/editor/CourseEditorEnvImpl.java
@@ -53,6 +53,7 @@ import org.olat.course.nodes.CourseNode;
 import org.olat.course.nodes.ENCourseNode;
 import org.olat.course.tree.CourseEditorTreeModel;
 import org.olat.course.tree.CourseEditorTreeNode;
+import org.olat.group.BusinessGroup;
 import org.olat.group.area.BGArea;
 
 /**
@@ -167,12 +168,7 @@ public class CourseEditorEnvImpl implements CourseEditorEnv {
 	public boolean existsGroup(String groupname) {
 		// FIXME:fg:b improve performance by adding a special query for the existence
 		// check!
-		List cnt = cgm.getLearningGroupsFromAllContexts(groupname);
-		return (cnt != null && cnt.size() > 0);
-	}
-
-	public boolean existsRightGroup(String groupname) {
-		List cnt = cgm.getRightGroupsFromAllContexts(groupname);
+		List<BusinessGroup> cnt = cgm.getLearningGroupsFromAllContexts(groupname);
 		return (cnt != null && cnt.size() > 0);
 	}
 
diff --git a/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java b/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java
index 2158f84307c..dbf91a20b0a 100644
--- a/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java
+++ b/src/main/java/org/olat/course/groupsandrights/CourseGroupManager.java
@@ -147,7 +147,7 @@ public interface CourseGroupManager {
 	 * @param groupName
 	 * @return
 	 */
-	public List<BusinessGroup> getRightGroupsFromAllContexts(String groupName);
+	//public List<BusinessGroup> getRightGroupsFromAllContexts(String groupName);
 
 	/**
 	 * @param areaName
@@ -191,17 +191,6 @@ public interface CourseGroupManager {
 	 */
 	public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity);
 
-	/**
-	 * @param identity
-	 * @return A list of right groups where this identity is participating
-	 */
-	public List<BusinessGroup> getParticipatingRightGroupsFromAllContexts(Identity identity);
-
-	/**
-	 * @return A list of all right groups from this course
-	 */
-	public List<BusinessGroup> getAllRightGroupsFromAllContexts();
-
 	/**
 	 * @return A list of all group areas from this course
 	 */
@@ -254,13 +243,6 @@ public interface CourseGroupManager {
 	 */
 	public void importCourseLearningGroups(File fImportDirectory);
 
-	/**
-	 * Export all groups which are course internal to a file for later import.
-	 * 
-	 * @param fExportDirectory
-	 */
-	public void exportCourseRightGroups(File fExportDirectory);
-
 	/**
 	 * Import course internal groups fa previous export.
 	 * 
diff --git a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java
index 3b1f56231f9..31750133046 100644
--- a/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java
+++ b/src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java
@@ -128,7 +128,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	 *      java.lang.String, java.lang.String)
 	 */
 	public boolean isIdentityInGroup(Identity identity, String groupName) {
-		return businessGroupService.isIdentityInBusinessGroup(identity, groupName, BusinessGroup.TYPE_LEARNINGROUP, true, true, courseResource);
+		return businessGroupService.isIdentityInBusinessGroup(identity, groupName, true, true, courseResource);
 	}
 	
 	/**
@@ -180,22 +180,11 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 		return areaManager.isIdentityInBGArea(identity, areaName, courseResource);
 	}
 
-	/**
-	 * @see org.olat.course.groupsandrights.CourseGroupManager#getRightGroupsFromAllContexts(java.lang.String)
-	 */
-	public List<BusinessGroup> getRightGroupsFromAllContexts(String groupName) {
-		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_RIGHTGROUP);
-		params.setExactName(groupName);
-		return businessGroupService.findBusinessGroups(params, null, false, false, courseResource, 0, -1);
-	}
-
 	/**
 	 * @see org.olat.course.groupsandrights.CourseGroupManager#getAllLearningGroupsFromAllContexts()
 	 */
 	public List<BusinessGroup> getAllLearningGroupsFromAllContexts() {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
 		return businessGroupService.findBusinessGroups(params, null, false, false, courseResource, 0, -1);
 	}
 
@@ -204,7 +193,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	 */
 	public List<BusinessGroup> getLearningGroupsFromAllContexts(String groupName) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
 		params.setExactName(groupName);
 		return businessGroupService.findBusinessGroups(params, null, false, false, courseResource, 0, -1);
 	}
@@ -242,7 +230,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	 */
 	public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity, String groupName) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
 		return businessGroupService.findBusinessGroups(params, identity, false, true, courseResource, 0, -1);
 	}
 
@@ -255,22 +242,12 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 		return groups;
 	}
 
-	/**
-	 * @see org.olat.course.groupsandrights.CourseGroupManager#getAllRightGroupsFromAllContexts()
-	 */
-	public List<BusinessGroup> getAllRightGroupsFromAllContexts() {
-		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_RIGHTGROUP);
-		return businessGroupService.findBusinessGroups(params, null, false, false, courseResource, 0, -1);
-	}
-
 	/**
 	 * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedLearningGroupsFromAllContexts(org.olat.core.id.Identity)
 	 */
 	@Override
 	public List<BusinessGroup> getOwnedLearningGroupsFromAllContexts(Identity identity) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
 		List<BusinessGroup> allGroups =
 				businessGroupService.findBusinessGroups(params, identity, true, false, courseResource, 0, -1);
 		return allGroups;
@@ -282,19 +259,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	@Override
 	public List<BusinessGroup> getParticipatingLearningGroupsFromAllContexts(Identity identity) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
-		List<BusinessGroup> allGroups =
-				businessGroupService.findBusinessGroups(params, identity, false, true, courseResource, 0, -1);
-		return allGroups;
-	}
-
-	/**
-	 * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingRightGroupsFromAllContexts(org.olat.core.id.Identity)
-	 */
-	@Override
-	public List<BusinessGroup> getParticipatingRightGroupsFromAllContexts(Identity identity) {
-		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_RIGHTGROUP);
 		List<BusinessGroup> allGroups =
 				businessGroupService.findBusinessGroups(params, identity, false, true, courseResource, 0, -1);
 		return allGroups;
@@ -315,7 +279,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 		}
 
 		boolean isParticipant = secManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_COACH, courseResource)
-				|| businessGroupService.isIdentityInBusinessGroup(identity, null, null, true, false, courseResource);
+				|| businessGroupService.isIdentityInBusinessGroup(identity, null, true, false, courseResource);
 		return isParticipant;
 	}
 	
@@ -334,7 +298,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 		}
 
 		boolean isParticipant = secManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_PARTI, courseResource)
-				|| businessGroupService.isIdentityInBusinessGroup(identity, null, null, false, true, courseResource);
+				|| businessGroupService.isIdentityInBusinessGroup(identity, null, false, true, courseResource);
 		return isParticipant;
 	}
 
@@ -352,7 +316,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	 * @see org.olat.course.groupsandrights.CourseGroupManager#isIdentityParticipantInAnyLearningGroup(org.olat.core.id.Identity)
 	 */
 	public boolean isIdentityParticipantInAnyGroup(Identity identity) {
-		return businessGroupService.isIdentityInBusinessGroup(identity, null, BusinessGroup.TYPE_LEARNINGROUP, false, true, courseResource);
+		return businessGroupService.isIdentityInBusinessGroup(identity, null, false, true, courseResource);
 	}
 
 	/**
@@ -438,15 +402,6 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 		businessGroupService.importGroups(courseResource, fGroupExportXML);
 	}
 
-	/**
-	 * @see org.olat.course.groupsandrights.CourseGroupManager#exportCourseRightGroups(java.io.File)
-	 */
-	public void exportCourseRightGroups(File fExportDirectory) {
-		File fExportFile = new File(fExportDirectory, RIGHTGROUPEXPORT_XML);
-		List<BusinessGroup> rightGroups = getAllRightGroupsFromAllContexts();
-		businessGroupService.exportGroups(rightGroups, fExportFile);
-	}
-
 	/**
 	 * @see org.olat.course.groupsandrights.CourseGroupManager#importCourseRightGroups(java.io.File)
 	 */
@@ -558,7 +513,7 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	 * @see org.olat.course.groupsandrights.CourseGroupManager#getWaitingListGroupsFromAllContexts(org.olat.core.id.Identity)
 	 */
 	public List<BusinessGroup> getWaitingListGroupsFromAllContexts(Identity identity) {
-		List<BusinessGroup> groups = businessGroupService.findBusinessGroupsWithWaitingListAttendedBy(null, identity, courseResource);
+		List<BusinessGroup> groups = businessGroupService.findBusinessGroupsWithWaitingListAttendedBy(identity, courseResource);
 		return groups;
 	}
 
@@ -569,7 +524,5 @@ public class PersistingCourseGroupManager extends BasicManager implements Course
 	public void archiveCourseGroups(File exportDirectory) {
 		File exportLearningGroupFile = new File(exportDirectory, "default_" + LEARNINGGROUPARCHIVE_XLS);
 		businessGroupService.archiveGroups(getAllLearningGroupsFromAllContexts(), exportLearningGroupFile);
-		File exportRightGroupsFile = new File(exportDirectory, "default_" + RIGHTGROUPARCHIVE_XLS);
-		businessGroupService.archiveGroups(getAllRightGroupsFromAllContexts(), exportRightGroupsFile);
 	}
 }
\ No newline at end of file
diff --git a/src/main/java/org/olat/course/groupsandrights/ui/CourseGroupManagementMainController.java b/src/main/java/org/olat/course/groupsandrights/ui/CourseGroupManagementMainController.java
index 852dc884527..33382f2ae84 100644
--- a/src/main/java/org/olat/course/groupsandrights/ui/CourseGroupManagementMainController.java
+++ b/src/main/java/org/olat/course/groupsandrights/ui/CourseGroupManagementMainController.java
@@ -34,8 +34,6 @@ import org.olat.core.gui.components.panel.Panel;
 import org.olat.core.gui.components.table.Table;
 import org.olat.core.gui.components.table.TableController;
 import org.olat.core.gui.components.table.TableEvent;
-import org.olat.core.gui.components.tree.MenuTree;
-import org.olat.core.gui.components.velocity.VelocityContainer;
 import org.olat.core.gui.control.Controller;
 import org.olat.core.gui.control.Event;
 import org.olat.core.gui.control.WindowControl;
@@ -81,7 +79,7 @@ public class CourseGroupManagementMainController extends MainLayoutBasicControll
 	 * @param course
 	 * @param groupType
 	 */
-	public CourseGroupManagementMainController(UserRequest ureq, WindowControl wControl, OLATResourceable ores, String groupType) {
+	public CourseGroupManagementMainController(UserRequest ureq, WindowControl wControl, OLATResourceable ores) {
 		super(ureq, wControl);
 		
 		getUserActivityLogger().setStickyActionType(ActionType.admin);
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 31189e6e92d..3b64ed84631 100644
--- a/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java
+++ b/src/main/java/org/olat/course/nodes/cal/CourseCalendars.java
@@ -37,7 +37,6 @@ import org.olat.core.id.OLATResourceable;
 import org.olat.course.CourseFactory;
 import org.olat.course.ICourse;
 import org.olat.course.groupsandrights.CourseGroupManager;
-import org.olat.course.groupsandrights.CourseRights;
 import org.olat.course.nodes.CalCourseNode;
 import org.olat.course.run.calendar.CourseCalendarSubscription;
 import org.olat.course.run.calendar.CourseLinkProviderController;
@@ -108,29 +107,15 @@ public class CourseCalendars {
 		courseKalendarWrapper.setLinkProvider(clpc);
 		calendars.add(courseKalendarWrapper);
 
-		// add course group calendars
-		boolean isGroupManager = cgm.isIdentityCourseAdministrator(identity) || cgm.hasRight(identity, CourseRights.RIGHT_GROUPMANAGEMENT);
-		if (isGroupManager) {
-			// learning groups
-			List<BusinessGroup> allGroups = cgm.getAllLearningGroupsFromAllContexts();
-			addCalendars(ureq, allGroups, true, clpc, calendars);
-			// right groups
-			allGroups = cgm.getAllRightGroupsFromAllContexts();
-			addCalendars(ureq, allGroups, true, clpc, calendars);
-		} else {
-			// learning groups
-			List<BusinessGroup> ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
-			addCalendars(ureq, ownerGroups, true, clpc, calendars);
-			List<BusinessGroup> attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity);
-			for (BusinessGroup ownerGroup : ownerGroups) {
-				if (attendedGroups.contains(ownerGroup)) attendedGroups.remove(ownerGroup);
-			}
-			addCalendars(ureq, attendedGroups, false, clpc, calendars);
-
-			// right groups
-			List<BusinessGroup> rightGroups = cgm.getParticipatingRightGroupsFromAllContexts(identity);
-			addCalendars(ureq, rightGroups, false, clpc, calendars);
+		// learning groups
+		List<BusinessGroup> ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
+		addCalendars(ureq, ownerGroups, true, clpc, calendars);
+		List<BusinessGroup> attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity);
+		for (BusinessGroup ownerGroup : ownerGroups) {
+			if (attendedGroups.contains(ownerGroup)) attendedGroups.remove(ownerGroup);
 		}
+		addCalendars(ureq, attendedGroups, false, clpc, calendars);
+
 		return new CourseCalendars(courseKalendarWrapper, calendars);
 	}
 
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 3a7cc4567fa..d5660cebf69 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
@@ -96,11 +96,11 @@ public class ProjectGroupManagerImpl extends BasicManager implements ProjectGrou
 			logDebug("No group for project-broker exist => create a new one");
 			BusinessGroupService businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class);
 			OLATResource courseResource = cpm.getCourseResource();
-			accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, courseResource);
+			accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, -1, -1, false, false, courseResource);
 			int i = 2;
 			while (accountManagerGroup == null) {
 				// group with this name exist already, try another name
-				accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName + " _" + i, groupDescription, BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, courseResource);
+				accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName + " _" + i, groupDescription, -1, -1, false, false, courseResource);
 				i++;
 			}
 			logDebug("createAndPersistBusinessGroup businessgroup=" + accountManagerGroup);			
@@ -175,13 +175,13 @@ public class ProjectGroupManagerImpl extends BasicManager implements ProjectGrou
 
 		//BGContext context = createGroupContext(CourseFactory.loadCourse(courseId));
 		logDebug("createProjectGroupFor groupName=" + groupName);
-		BusinessGroup projectGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription,BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, resource);
+		BusinessGroup projectGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, -1, -1, false, false, resource);
 		// projectGroup could be null when a group with name already exists
 		int counter = 2;
 		while (projectGroup == null) {
 			// name alreday exist try another one
 			String newGroupName = groupName + " _" + counter ;
-			projectGroup = businessGroupService.createBusinessGroup(identity, newGroupName, groupDescription, BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, resource);
+			projectGroup = businessGroupService.createBusinessGroup(identity, newGroupName, groupDescription, -1, -1, false, false, resource);
 			counter++;
 		}
 		logDebug("Created a new projectGroup=" + projectGroup);
@@ -242,7 +242,7 @@ public class ProjectGroupManagerImpl extends BasicManager implements ProjectGrou
 
 	public void removeCandidates(final List<Identity> addIdentities, final Project project) {
 		Codepoint.codepoint(ProjectBrokerManagerImpl.class, "beforeDoInSync");
-		Boolean result = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(project.getProjectGroup(), new SyncerCallback<Boolean>(){
+		CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(project.getProjectGroup(), new SyncerCallback<Boolean>(){
 			public Boolean execute() {
 				Project reloadedProject = (Project) DBFactory.getInstance().loadObject(project, true);
 				for (Identity identity : addIdentities) {
diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java
index 5130acaba77..4ddf548379b 100644
--- a/src/main/java/org/olat/course/run/RunMainController.java
+++ b/src/main/java/org/olat/course/run/RunMainController.java
@@ -173,7 +173,6 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 	private List<BusinessGroup> ownedGroups;
 	private List<BusinessGroup> participatedGroups;
 	private List<BusinessGroup> waitingListGroups;
-	private List<BusinessGroup> rightGroups;
 
 	private CourseNode currentCourseNode;
 	private TreeModel treeModel;
@@ -811,7 +810,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 
 		} else if (cmd.equals("groupmngt")) {
 			if (hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || isCourseAdmin) {
-				currentToolCtr = new CourseGroupManagementMainController(ureq, getWindowControl(), course, BusinessGroup.TYPE_LEARNINGROUP);
+				currentToolCtr = new CourseGroupManagementMainController(ureq, getWindowControl(), course);
 				listenTo(currentToolCtr);
 				all.setContent(currentToolCtr.getInitialComponent());
 			} else throw new OLATSecurityException("clicked groupmanagement, but no according right");
@@ -824,13 +823,6 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 				all.setContent(currentToolCtr.getInitialComponent());
 			} else throw new OLATSecurityException("clicked groupmanagement, but no according right");
 			
-		} else if (cmd.equals("rightmngt")) {
-			if (isCourseAdmin) {
-				currentToolCtr = new CourseGroupManagementMainController(ureq, getWindowControl(), course, BusinessGroup.TYPE_RIGHTGROUP);
-				listenTo(currentToolCtr);
-				all.setContent(currentToolCtr.getInitialComponent());
-			} else throw new OLATSecurityException("clicked rightmanagement, but no according right");
-
 		} else if (cmd.equals("statistic")) {
 			if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) {
 				currentToolCtr = new StatisticMainController(ureq, getWindowControl(), course);
@@ -1074,7 +1066,8 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 				// check if this affects a right group where the user does participate.
 				// if so, we need
 				// to rebuild the toolboxes
-				if (PersistenceHelper.listContainsObjectByKey(rightGroups, bgme.getModifiedGroupKey())) {
+				if (PersistenceHelper.listContainsObjectByKey(participatedGroups, bgme.getModifiedGroupKey()) ||
+						PersistenceHelper.listContainsObjectByKey(ownedGroups, bgme.getModifiedGroupKey())) {
 					// 1) reinitialize all group memberships
 					initGroupMemberships(identity);
 					// 2) reinitialize the users roles and rights
@@ -1129,9 +1122,6 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 				//
 				myTool.addLink("groupmngt", translate("command.opengroupmngt"));
 			}
-			if (isCourseAdmin) {
-				myTool.addLink("rightmngt", translate("command.openrightmngt"));
-			}
 			if (hasCourseRight(CourseRights.RIGHT_ARCHIVING) || isCourseAdmin) {
 				myTool.addLink("archiver", translate("command.openarchiver"));
 			}
@@ -1144,13 +1134,6 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 			if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) {
 				myTool.addLink("statistic", translate("command.openstatistic"));
 			}
-
-			//
-			/*
-			 * if (isCourseAdmin) { myTool.addLink(TOOLBOX_LINK_COURSECONFIG,
-			 * translate("command.courseconfig")); }
-			 */
-			//
 		}
 
 		// 2) add coached groups
@@ -1170,12 +1153,12 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 		}
 
 		// 4) add right groups
-		if (rightGroups.size() > 0) {
+		/*if (rightGroups.size() > 0) {
 			myTool.addHeader(translate("header.tools.rightGroups"));
 			for (BusinessGroup group : rightGroups) {
 				myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
 			}
-		}
+		}*/
 
 		// 5) add waiting-list groups
 		if (waitingListGroups.size() > 0) {
@@ -1299,7 +1282,6 @@ public class RunMainController extends MainLayoutBasicController implements Gene
 		ownedGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
 		participatedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity);
 		waitingListGroups = cgm.getWaitingListGroupsFromAllContexts(identity);
-		rightGroups = cgm.getParticipatingRightGroupsFromAllContexts(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 a8ca7a78823..933d0051278 100644
--- a/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java
+++ b/src/main/java/org/olat/course/run/calendar/CourseCalendarController.java
@@ -98,30 +98,18 @@ public class CourseCalendarController extends BasicController {
 		calendars.add(courseKalendarWrapper);
 		
 		// add course group calendars
-		boolean isGroupManager = cgm.isIdentityCourseAdministrator(identity) || cgm.hasRight(identity, CourseRights.RIGHT_GROUPMANAGEMENT);
-		if (isGroupManager) {
-			// learning groups
-			List allGroups = cgm.getAllLearningGroupsFromAllContexts();
-			addCalendars(ureq, allGroups, true, clpc, calendars);
-			// right groups
-			allGroups = cgm.getAllRightGroupsFromAllContexts();
-			addCalendars(ureq, allGroups, true, clpc, calendars);
-		} else {
-			// learning groups
-			List ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
-			addCalendars(ureq, ownerGroups, true, clpc, calendars);
-			List attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity);
-			for (Iterator ownerGroupsIterator = ownerGroups.iterator(); ownerGroupsIterator.hasNext();) {
-				BusinessGroup ownerGroup = (BusinessGroup) ownerGroupsIterator.next();
-				if (attendedGroups.contains(ownerGroup))
-					attendedGroups.remove(ownerGroup);
-			}
-			addCalendars(ureq, attendedGroups, false, clpc, calendars);
-
-			// right groups
-			List rightGroups = cgm.getParticipatingRightGroupsFromAllContexts(identity);
-			addCalendars(ureq, rightGroups, false, clpc, calendars);
+		
+		// learning groups
+		List<BusinessGroup> ownerGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
+		addCalendars(ureq, ownerGroups, true, clpc, calendars);
+		List<BusinessGroup> attendedGroups = cgm.getParticipatingLearningGroupsFromAllContexts(identity);
+		for (Iterator<BusinessGroup> ownerGroupsIterator = ownerGroups.iterator(); ownerGroupsIterator.hasNext();) {
+			BusinessGroup ownerGroup = (BusinessGroup) ownerGroupsIterator.next();
+			if (attendedGroups.contains(ownerGroup))
+				attendedGroups.remove(ownerGroup);
 		}
+		addCalendars(ureq, attendedGroups, false, clpc, calendars);
+
 		return calendars;
 	}
 	
diff --git a/src/main/java/org/olat/group/BusinessGroup.java b/src/main/java/org/olat/group/BusinessGroup.java
index 87e67575951..ff9b280dace 100644
--- a/src/main/java/org/olat/group/BusinessGroup.java
+++ b/src/main/java/org/olat/group/BusinessGroup.java
@@ -43,11 +43,11 @@ import org.olat.core.id.Persistable;
 public interface BusinessGroup extends Persistable, CreateInfo, ModifiedInfo, OLATResourceable {
 
 	/** group type: buddygroup * */
-	public final static String TYPE_BUDDYGROUP = "BuddyGroup";
+	//public final static String TYPE_BUDDYGROUP = "BuddyGroup";
 	/** group type: learning group * */
-	public final static String TYPE_LEARNINGROUP = "LearningGroup";
+	//public final static String TYPE_LEARNINGROUP = "LearningGroup";
 	/** group type: course right group * */
-	public final static String TYPE_RIGHTGROUP = "RightGroup";
+	//public final static String TYPE_RIGHTGROUP = "RightGroup";
 	/** regular expression to check for valid group names */
 	// commas are not allowed. name is used in course conditions for weak binding
 	public final static String VALID_GROUPNAME_REGEXP = "^[^,\"]*$";
diff --git a/src/main/java/org/olat/group/BusinessGroupFactory.java b/src/main/java/org/olat/group/BusinessGroupFactory.java
index f284269d596..6808e476261 100644
--- a/src/main/java/org/olat/group/BusinessGroupFactory.java
+++ b/src/main/java/org/olat/group/BusinessGroupFactory.java
@@ -25,16 +25,6 @@
 
 package org.olat.group;
 
-import org.olat.basesecurity.BaseSecurity;
-import org.olat.basesecurity.BaseSecurityManager;
-import org.olat.basesecurity.Constants;
-import org.olat.basesecurity.SecurityGroup;
-import org.olat.core.commons.persistence.DBFactory;
-import org.olat.core.id.Identity;
-import org.olat.core.logging.Tracing;
-import org.olat.group.properties.BusinessGroupPropertyManager;
-import org.olat.resource.OLATResource;
-import org.olat.resource.OLATResourceManager;
 
 /**
  * Description: <BR/> Use the business group factory to create new instances of
@@ -89,7 +79,7 @@ public class BusinessGroupFactory {
 	 * @param name
 	 * @param description
 	 * @return the group
-	 */
+	 *//*
 	private static BusinessGroup createAndPersistBuddyGroup(Identity identity, String name, String description, Integer minParticipants,
 			Integer maxParticipants) {
 		/*
@@ -98,14 +88,14 @@ public class BusinessGroupFactory {
 		 * groups...................................................... [3] create 2
 		 * policies, ownerGroup -> PERMISSION_ACCESS -> buddygroup.
 		 * ....partipiciantGroup -> PERMISSION_READ -> buddygroup ..............
-		 */
+		 *//*
 		BusinessGroupImpl businessgroup = null;
 		BaseSecurity securityManager = BaseSecurityManager.getInstance();
 		// groups
 		SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
 		SecurityGroup partipiciantGroup = securityManager.createAndPersistSecurityGroup();
 
-		businessgroup = new BusinessGroupImpl(BusinessGroup.TYPE_BUDDYGROUP, name, description, ownerGroup, partipiciantGroup,null/* no waitingGroup*/);
+		businessgroup = new BusinessGroupImpl(name, description, ownerGroup, partipiciantGroup, null);
 		businessgroup.setMinParticipants(minParticipants);
 		businessgroup.setMaxParticipants(maxParticipants);
 
@@ -117,7 +107,7 @@ public class BusinessGroupFactory {
 		 * policies: - ownerGroup can do everything on this businessgroup -> is an
 		 * admin, can invite people to owner.- & partipiciantgroup -
 		 * partipiciantGroup can read this businessgroup
-		 */
+		 *//*
 		OLATResource businessgroupOlatResource =  OLATResourceManager.getInstance().createOLATResourceInstance(businessgroup);
 		OLATResourceManager.getInstance().saveOLATResource(businessgroupOlatResource);
 
@@ -133,7 +123,7 @@ public class BusinessGroupFactory {
 		BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessgroup);
 		bgpm.createAndPersistDisplayMembers(true, false, false);
 		return businessgroup;
-	}
+	}*/
 
 	/**
 	 * Create a group of type learning group
diff --git a/src/main/java/org/olat/group/BusinessGroupImpl.java b/src/main/java/org/olat/group/BusinessGroupImpl.java
index 905fd6768c8..6cc5e5d7a3c 100644
--- a/src/main/java/org/olat/group/BusinessGroupImpl.java
+++ b/src/main/java/org/olat/group/BusinessGroupImpl.java
@@ -80,14 +80,14 @@ public class BusinessGroupImpl extends PersistentObject implements BusinessGroup
 	 * @param ownerGroup
 	 * @param partipiciantGroup
 	 */
-	public BusinessGroupImpl(String type, String groupName, String description, SecurityGroup ownerGroup, SecurityGroup partipiciantGroup,
+	public BusinessGroupImpl(String groupName, String description, SecurityGroup ownerGroup, SecurityGroup partipiciantGroup,
 			SecurityGroup waitingGroup) {
 		this.setName(groupName);
 		this.setDescription(description);
 		this.setOwnerGroup(ownerGroup);
 		this.setPartipiciantGroup(partipiciantGroup);
 		this.setWaitingGroup(waitingGroup);
-		this.setType(type);
+		this.setType("LearningGroup");
 		// per default no waiting-list
 		Boolean disabled = new Boolean(false);
 		this.setWaitingListEnabled(disabled);
diff --git a/src/main/java/org/olat/group/BusinessGroupService.java b/src/main/java/org/olat/group/BusinessGroupService.java
index c78f7495e0f..18d7ca391fc 100644
--- a/src/main/java/org/olat/group/BusinessGroupService.java
+++ b/src/main/java/org/olat/group/BusinessGroupService.java
@@ -54,7 +54,7 @@ public interface BusinessGroupService {
 	
 	
 	
-	public BusinessGroup createBusinessGroup(Identity creator, String name, String description, String type,
+	public BusinessGroup createBusinessGroup(Identity creator, String name, String description,
 			int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled,
 			OLATResource resource);
 	
@@ -99,11 +99,11 @@ public interface BusinessGroupService {
 	//search methods
 	public BusinessGroup findBusinessGroup(SecurityGroup secGroup);
 
-	public List<BusinessGroup> findBusinessGroupsOwnedBy(String type, Identity identity, OLATResource resource);
+	public List<BusinessGroup> findBusinessGroupsOwnedBy(Identity identity, OLATResource resource);
 	
-	public List<BusinessGroup> findBusinessGroupsAttendedBy(String type, Identity identity, OLATResource resource);
+	public List<BusinessGroup> findBusinessGroupsAttendedBy(Identity identity, OLATResource resource);
 	
-	public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(String type, Identity identity,OLATResource resource);
+	public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(Identity identity,OLATResource resource);
 	
 	public int countBusinessGroups(SearchBusinessGroupParams params, Identity identity,
 			boolean ownedById, boolean attendedById, OLATResource resource);
@@ -117,6 +117,9 @@ public interface BusinessGroupService {
 	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, BusinessGroup group); 
 
 	//retrieve repository entries
+
+	public boolean hasResources(BusinessGroup group);
+	
 	public void addResourceTo(BusinessGroup group, OLATResource resource);
 	
 	public void removeResourceFrom(BusinessGroup group, OLATResource resource);
@@ -165,14 +168,12 @@ public interface BusinessGroupService {
 	public BusinessGroupAddResponse moveIdentityFromWaitingListToParticipant(List<Identity> identities, Identity ureqIdentity, BusinessGroup currBusinessGroup, BGConfigFlags flags);
 
 	
-	
 	public BusinessGroupAddResponse addToSecurityGroupAndFireEvent(Identity ureqIdentity, List<Identity> addIdentities, SecurityGroup secGroup);
 	
 	public void removeAndFireEvent(Identity ureqIdentity, List<Identity> addIdentities, SecurityGroup secGroup);
 	
 	public String[] addIdentityToGroups(AddToGroupsEvent groupsEv, final Identity ident, final Identity addingIdentity);
 	
-	//public String[] addIdentityToGroups(List<Long> ownGroups, List<Long> partGroups, List<Long> mailGroups, final Identity ident, final Identity addingIdentity);
 	
 	//security
 	public boolean isIdentityInBusinessGroup(Identity identity, BusinessGroup businessGroup);
@@ -183,17 +184,9 @@ public interface BusinessGroupService {
 	 * @param resource
 	 * @return
 	 */
-	public boolean isIdentityInBusinessGroup(Identity identity, String groupName, String groupType, boolean ownedById, boolean attendedById, OLATResource resource);
-
-
-	
-
+	public boolean isIdentityInBusinessGroup(Identity identity, String groupName, boolean ownedById, boolean attendedById, OLATResource resource);
 
 
-
-
-	
-	
 	//export - import
 	public void exportGroups(List<BusinessGroup> groups, File fExportFile);
 
@@ -204,6 +197,4 @@ public interface BusinessGroupService {
 	public File archiveGroupMembers(OLATResource resource, List<String> columnList, List<BusinessGroup> groupList, String archiveType,
 			Locale locale, String charset);
 
-	
-
 }
diff --git a/src/main/java/org/olat/group/GroupfoldersWebDAVMergeSource.java b/src/main/java/org/olat/group/GroupfoldersWebDAVMergeSource.java
index 6af02a3573b..00bc4b6f170 100644
--- a/src/main/java/org/olat/group/GroupfoldersWebDAVMergeSource.java
+++ b/src/main/java/org/olat/group/GroupfoldersWebDAVMergeSource.java
@@ -118,7 +118,6 @@ class GroupfoldersWebDAVMergeSource extends MergeSource {
 
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
 		params.addTools(CollaborationTools.TOOL_FOLDER);
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		List<BusinessGroup> groups = bgs.findBusinessGroups(params, identity, true, true, null, 0, -1);
 		Set<String> addedGroupNames = new HashSet<String>();
@@ -149,7 +148,6 @@ class GroupfoldersWebDAVMergeSource extends MergeSource {
 		
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
 		params.addTools(CollaborationTools.TOOL_FOLDER);
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		List<BusinessGroup> tutorGroups = bgs.findBusinessGroups(params, identity, true, false, null, 0, -1);
 		for (BusinessGroup group : tutorGroups) {
 			addContainer(group, addedGroupKeys, addedGroupNames, true);
diff --git a/src/main/java/org/olat/group/context/BGContextManagerImpl.java b/src/main/java/org/olat/group/context/BGContextManagerImpl.java
index 0bb43f45ac5..253ea6e00bf 100644
--- a/src/main/java/org/olat/group/context/BGContextManagerImpl.java
+++ b/src/main/java/org/olat/group/context/BGContextManagerImpl.java
@@ -25,34 +25,7 @@
 
 package org.olat.group.context;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hibernate.type.StandardBasicTypes;
-import org.hibernate.type.Type;
-import org.olat.basesecurity.BaseSecurity;
-import org.olat.basesecurity.BaseSecurityManager;
-import org.olat.basesecurity.Constants;
-import org.olat.basesecurity.SecurityGroup;
-import org.olat.basesecurity.SecurityGroupMembershipImpl;
-import org.olat.core.commons.persistence.DB;
-import org.olat.core.commons.persistence.DBFactory;
-import org.olat.core.commons.persistence.DBQuery;
-import org.olat.core.id.Identity;
-import org.olat.core.logging.AssertException;
-import org.olat.core.logging.Tracing;
 import org.olat.core.manager.BasicManager;
-import org.olat.course.CorruptedCourseException;
-import org.olat.course.CourseFactory;
-import org.olat.course.CourseModule;
-import org.olat.course.ICourse;
-import org.olat.group.BusinessGroup;
-import org.olat.group.BusinessGroupImpl;
-import org.olat.repository.RepositoryEntry;
-import org.olat.resource.OLATResource;
 
 /**
  * Description: <BR>
@@ -84,7 +57,7 @@ public class BGContextManagerImpl extends BasicManager {
 	 * @see org.olat.group.context.BGContextManager#createAndPersistBGContext(java.lang.String,
 	 *      java.lang.String, java.lang.String, org.olat.core.id.Identity,
 	 *      boolean)
-	 */
+	 *//*
 	public BGContext createAndPersistBGContext(String name, String description, String groupType, Identity owner, boolean defaultContext) {
 		if (name == null) throw new AssertException("Business group context name must not be null");
 		if (groupType == null) throw new AssertException("Business group groupType name must not be null");
@@ -109,7 +82,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#copyAndAddBGContextToResource(java.lang.String,
 	 *      org.olat.resource.OLATResource, org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public BGContext copyAndAddBGContextToResource(String contextName, OLATResource resource, BGContext originalBgContext) {
 		/*
 		BGAreaManager areaManager = BGAreaManagerImpl.getInstance();
@@ -130,13 +103,13 @@ public class BGContextManagerImpl extends BasicManager {
 			BusinessGroup origGroup = (BusinessGroup) iter.next();
 			groupManager.copyBusinessGroup(origGroup, origGroup.getName(), origGroup.getDescription(), origGroup.getMinParticipants(), origGroup
 					.getMaxParticipants(), targetContext, areas, true, true, true, false, false, true, false); 
-		}*/
+		}*//*
 		return null;
 	}
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#updateBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public void updateBGContext(BGContext bgContext) {
 		// 1) update context
 		DBFactory.getInstance().updateObject(bgContext);
@@ -157,7 +130,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#deleteBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public void deleteBGContext(BGContext bgContext) {
 		bgContext = (BGContext) DBFactory.getInstance().loadObject(bgContext);
 		// 1) Delete all groups from group context
@@ -170,7 +143,7 @@ public class BGContextManagerImpl extends BasicManager {
 			BGArea area = (BGArea) iter.next();
 			areaManager.deleteBGArea(area);
 		}
-		*/
+		*//*
 		// 3) Delete group to resource relations
 		List referencingResources = findOLATResourcesForBGContext(bgContext);
 		for (Iterator iter = referencingResources.iterator(); iter.hasNext();) {
@@ -190,7 +163,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#getGroupsOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public List<BusinessGroup> getGroupsOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		DBQuery query;
@@ -230,7 +203,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#countGroupsOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public int countGroupsOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select count(bg) from org.olat.group.BusinessGroupImpl bg where bg.groupContext = :context";
@@ -241,7 +214,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#countGroupsOfType(java.lang.String)
-	 */
+	 *//*
 	public int countGroupsOfType(String groupType) {
 		DB db = DBFactory.getInstance();
 		String q = "select count(bg) from org.olat.group.BusinessGroupImpl bg where bg.type = :type";
@@ -253,7 +226,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#findGroupOfBGContext(java.lang.String,
 	 *      org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public BusinessGroup findGroupOfBGContext(String groupName, BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select bg from org.olat.group.BusinessGroupImpl bg where bg.groupContext = :context and bg.name = :name";
@@ -268,7 +241,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#findGroupAttendedBy(org.olat.core.id.Identity,
 	 *      java.lang.String, org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public BusinessGroup findGroupAttendedBy(Identity identity, String groupName, BGContext bgContext) {
 		String query = "select bgi from " + "  org.olat.group.BusinessGroupImpl as bgi "
 				+ ", org.olat.basesecurity.SecurityGroupMembershipImpl as sgmi" + " where bgi.name = :name "
@@ -287,7 +260,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#getBGOwnersOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public List getBGOwnersOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select distinct id from org.olat.basesecurity.IdentityImpl as id inner join fetch id.user as iuser"
@@ -314,7 +287,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#countBGOwnersOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public int countBGOwnersOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select count(distinct id) from org.olat.basesecurity.IdentityImpl id"
@@ -337,7 +310,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#getBGParticipantsOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public List getBGParticipantsOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select distinct id from org.olat.basesecurity.IdentityImpl as id inner join fetch id.user as iuser"
@@ -364,7 +337,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#countBGParticipantsOfBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public int countBGParticipantsOfBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = "select count(distinct id) from org.olat.basesecurity.IdentityImpl id"
@@ -387,7 +360,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#isIdentityInBGContext(org.olat.core.id.Identity,
 	 *      org.olat.group.context.BGContext, boolean, boolean)
-	 */
+	 *//*
 	public boolean isIdentityInBGContext(Identity identity, List<BGContext> bgContexts, boolean asOwner, boolean asParticipant) {
 		if(bgContexts == null || bgContexts.isEmpty()) return false;
 		
@@ -425,7 +398,7 @@ public class BGContextManagerImpl extends BasicManager {
 	 * @see org.olat.group.context.BGContextManager#createAndAddBGContextToResource(java.lang.String,
 	 *      org.olat.resource.OLATResource, java.lang.String,
 	 *      org.olat.core.id.Identity, boolean)
-	 */
+	 *//*
 	public BGContext createAndAddBGContextToResource(String contextName, OLATResource resource, String groupType, Identity initialOwner,
 			boolean defaultContext) {
 		BGContext context = createAndPersistBGContext(contextName, null, groupType, initialOwner, defaultContext);
@@ -436,7 +409,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#addBGContextToResource(org.olat.group.context.BGContext,
 	 *      org.olat.resource.OLATResource)
-	 */
+	 *//*
 	public void addBGContextToResource(BGContext bgContext, OLATResource resource) {
 		BGContext2Resource courseBgContext = new BGContext2Resource(resource, bgContext);
 		DBFactory.getInstance().saveObject(courseBgContext);
@@ -455,7 +428,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#findBGContextsForResource(org.olat.resource.OLATResource,
 	 *      boolean, boolean)
-	 */
+	 *//*
 	public List<BGContext> findBGContextsForResource(OLATResource resource, boolean defaultContexts, boolean nonDefaultContexts) {
 		return findBGContextsForResource(resource, null, defaultContexts, nonDefaultContexts);
 	}
@@ -463,7 +436,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#findBGContextsForResource(org.olat.resource.OLATResource,
 	 *      java.lang.String, boolean, boolean)
-	 */
+	 *//*
 	public List<BGContext> findBGContextsForResource(OLATResource resource, String groupType, boolean defaultContexts, boolean nonDefaultContexts) {
 		DB db = DBFactory.getInstance();
 		StringBuilder q = new StringBuilder();
@@ -491,7 +464,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#findBGContextsForIdentity(org.olat.core.id.Identity,
 	 *      boolean, boolean)
-	 */
+	 *//*
 	public List<BGContext> findBGContextsForIdentity(Identity identity, boolean defaultContexts, boolean nonDefaultContexts) {
 		DB db = DBFactory.getInstance();
 		StringBuilder q = new StringBuilder();
@@ -517,7 +490,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#findOLATResourcesForBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public List<OLATResource> findOLATResourcesForBGContext(BGContext bgContext) {
 		DB db = DBFactory.getInstance();
 		String q = " select bgcr.resource from org.olat.group.context.BGContext2Resource as bgcr where bgcr.groupContext = :context";
@@ -528,7 +501,7 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#findRepositoryEntriesForBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public List<RepositoryEntry> findRepositoryEntriesForBGContext(BGContext bgContext) {
 		/*List resources = findOLATResourcesForBGContext(bgContext);
 		List entries = new ArrayList();
@@ -541,7 +514,7 @@ public class BGContextManagerImpl extends BasicManager {
 			} else {
 				entries.add(entry);
 			}
-		}*/
+		}*//*
 		//fxdiff VCRP-1,2: access control of resources
 		return findRepositoryEntriesForBGContext(Collections.singletonList(bgContext), 0, -1);
 	}
@@ -625,7 +598,7 @@ public class BGContextManagerImpl extends BasicManager {
 	/**
 	 * @see org.olat.group.context.BGContextManager#removeBGContextFromResource(org.olat.group.context.BGContext,
 	 *      org.olat.resource.OLATResource)
-	 */
+	 *//*
 	public void removeBGContextFromResource(BGContext bgContext, OLATResource resource) {
 		// 1) delete references for this resource
 		String q = " from org.olat.group.context.BGContext2Resource as bgcr where bgcr.groupContext = ? and bgcr.resource = ?";
@@ -650,9 +623,9 @@ public class BGContextManagerImpl extends BasicManager {
 
 	/**
 	 * @see org.olat.group.context.BGContextManager#loadBGContext(org.olat.group.context.BGContext)
-	 */
+	 *//*
 	public BGContext loadBGContext(BGContext bgContext) {
 		return (BGContext) DBFactory.getInstance().loadObject(bgContext);
-	}
+	}*/
 
 }
\ No newline at end of file
diff --git a/src/main/java/org/olat/group/delete/ReadyToDeleteController.java b/src/main/java/org/olat/group/delete/ReadyToDeleteController.java
index f9e130f09d1..553372e1b86 100644
--- a/src/main/java/org/olat/group/delete/ReadyToDeleteController.java
+++ b/src/main/java/org/olat/group/delete/ReadyToDeleteController.java
@@ -98,7 +98,7 @@ public class ReadyToDeleteController extends BasicController {
 		PackageTranslator fallbackTrans = new PackageTranslator(PACKAGE_BG_MAIN_CONTROLLER, ureq.getLocale());
 		this.setTranslator( new PackageTranslator( MY_PACKAGE, ureq.getLocale(), fallbackTrans) );
 		//used to translate the BusinessGroup.getType() String in the table model
-		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(Util.getPackageName(ReadyToDeleteController.class), /*doesnt matter*/BusinessGroup.TYPE_BUDDYGROUP, ureq.getLocale());
+		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(Util.getPackageName(ReadyToDeleteController.class), "BuddyGroup", ureq.getLocale());
 
 		myContent = createVelocityContainer("panel");
 		
diff --git a/src/main/java/org/olat/group/delete/SelectionController.java b/src/main/java/org/olat/group/delete/SelectionController.java
index 18c8113f55d..85e15c20574 100644
--- a/src/main/java/org/olat/group/delete/SelectionController.java
+++ b/src/main/java/org/olat/group/delete/SelectionController.java
@@ -110,7 +110,7 @@ public class SelectionController extends BasicController {
 		myContent = createVelocityContainer("panel");
 
 		//used to translate the BusinessGroup.getType() String in the table model
-		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(MY_PACKAGE, /*doesnt matter*/BusinessGroup.TYPE_BUDDYGROUP, ureq.getLocale());
+		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(MY_PACKAGE, "BuddyGroup", ureq.getLocale());
 		
 		deleteSelectionPanel = new Panel("deleteSelectionPanel");
 		deleteSelectionPanel.addListener(this);
diff --git a/src/main/java/org/olat/group/delete/StatusController.java b/src/main/java/org/olat/group/delete/StatusController.java
index 7f3c3ea89db..62a3d4dde3c 100644
--- a/src/main/java/org/olat/group/delete/StatusController.java
+++ b/src/main/java/org/olat/group/delete/StatusController.java
@@ -88,7 +88,7 @@ public class StatusController extends BasicController {
 		myContent = createVelocityContainer("deletestatus");
 
 		//used to translate the BusinessGroup.getType() String in the table model
-		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(MY_PACKAGE, /*doesnt matter*/BusinessGroup.TYPE_BUDDYGROUP, ureq.getLocale());
+		tableModelTypeTranslator = BGTranslatorFactory.createBGPackageTranslator(MY_PACKAGE, "LearningGroup", ureq.getLocale());
 		
 		repositoryDeleteStatusPanel = new Panel("repositoryDeleteStatusPanel");
 		repositoryDeleteStatusPanel.addListener(this);
diff --git a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
index 997f005bb34..3768d502c66 100644
--- a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
+++ b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
@@ -23,7 +23,6 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 
 import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;
@@ -71,8 +70,9 @@ public class BusinessGroupDAO {
 	@Autowired
 	private OLATResourceManager olatResourceManager;
 	
-	public BusinessGroup createAndPersist(Identity creator, String name, String description, String type,
-			int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled) {
+	public BusinessGroup createAndPersist(Identity creator, String name, String description,
+			int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled,
+			boolean showOwners, boolean showParticipants, boolean showWaitingList) {
 
 		BusinessGroupImpl businessgroup = null;
 		//security groups
@@ -80,8 +80,7 @@ public class BusinessGroupDAO {
 		SecurityGroup participantGroup = securityManager.createAndPersistSecurityGroup();
 		SecurityGroup waitingGroup = securityManager.createAndPersistSecurityGroup();
 		
-		String realType = type == null ? BusinessGroup.TYPE_LEARNINGROUP : type;
-		businessgroup = new BusinessGroupImpl(realType, name, description, ownerGroup, participantGroup, waitingGroup);
+		businessgroup = new BusinessGroupImpl(name, description, ownerGroup, participantGroup, waitingGroup);
 		if(minParticipants >= 0) {
 			businessgroup.setMinParticipants(minParticipants);
 		}
@@ -118,12 +117,7 @@ public class BusinessGroupDAO {
 
 		// group members visibility
 		BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessgroup);
-		if(BusinessGroup.TYPE_RIGHTGROUP.equals(type)) {
-			bgpm.createAndPersistDisplayMembers(false, true, false);
-		} else {
-			bgpm.createAndPersistDisplayMembers(true, false, false);
-		}
-		
+		bgpm.createAndPersistDisplayMembers(showOwners, showParticipants, showWaitingList);
 		return businessgroup;
 	}
 	
@@ -138,7 +132,11 @@ public class BusinessGroupDAO {
 			return Collections.emptyList();
 		}
 		StringBuilder sb = new StringBuilder();
-		sb.append("select grp from ").append(BusinessGroupImpl.class.getName()).append(" grp where grp.id in (:ids)");
+		sb.append("select bgi from ").append(BusinessGroupImpl.class.getName()).append(" bgi ")
+			.append(" left join fetch bgi.ownerGroup ownerGroup")
+			.append(" left join fetch bgi.partipiciantGroup participantGroup")
+			.append(" left join fetch bgi.waitingGroup waitingGroup")
+		  .append(" where bgi.key in (:ids)");
 
 		List<BusinessGroup> groups = dbInstance.getCurrentEntityManager()
 				.createQuery(sb.toString(), BusinessGroup.class)
@@ -148,8 +146,14 @@ public class BusinessGroupDAO {
 	}
 	
 	public List<BusinessGroup> loadAll() {
-		EntityManager em = dbInstance.getCurrentEntityManager();
-		List<BusinessGroup> groups = em.createQuery("select grp from " + BusinessGroupImpl.class.getName() + " grp", BusinessGroup.class)
+		StringBuilder sb = new StringBuilder();
+		sb.append("select bgi from ").append(BusinessGroupImpl.class.getName()).append(" bgi ")
+			.append(" left join fetch bgi.ownerGroup ownerGroup")
+			.append(" left join fetch bgi.partipiciantGroup participantGroup")
+			.append(" left join fetch bgi.waitingGroup waitingGroup");
+
+		List<BusinessGroup> groups = dbInstance.getCurrentEntityManager()
+				.createQuery(sb.toString(), BusinessGroup.class)
 				.getResultList();
 		return groups;
 	}
@@ -166,6 +170,12 @@ public class BusinessGroupDAO {
 		return mergedGroup;
 	}
 	
+	/**
+	 * The method don't reload/reattach the object, make sure that you have
+	 * reloaded the business group before trying to delete it.
+	 * 
+	 * @param group
+	 */
 	public void delete(BusinessGroup group) {
 		EntityManager em = dbInstance.getCurrentEntityManager();
 		em.remove(group);
@@ -246,65 +256,6 @@ public class BusinessGroupDAO {
 		return group;
 	}
 	
-	public boolean isIdentityInBusinessGroup(Identity identity, String name, OLATResource resource) {
-		StringBuilder sb = new StringBuilder();
-		sb.append("select count(bgi) from ").append(BusinessGroupImpl.class.getName()).append(" bgi where")
-		  .append(" bgi.name=:name")
-		  .append(" and (")
-		  .append("   bgi.partipiciantGroup in (")
-		  .append("     select participantMemberShip.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" participantMemberShip ")
-		  .append("       where participantMemberShip.identity.key=:identityKey")
-		  .append("   )")
-		  .append("   or")
-		  .append("   bgi.ownerGroup in (")
-		  .append("     select ownerMemberShip.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" ownerMemberShip ")
-		  .append("       where ownerMemberShip.identity.key=:identityKey")
-		  .append("   )")
-		  .append(" )")
-			.append(" and bgi in (")
-			.append("   select relation.group from ").append(BGResourceRelation.class.getName()).append(" relation where relation.resource.key=:resourceKey")
-			.append(" )");
-
-		Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class)
-				.setParameter("identityKey", identity.getKey())
-				.setParameter("name", name)
-				.setParameter("resourceKey", resource.getKey())
-				.getSingleResult();
-		return count.intValue() > 0;
-	}
-	
-	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, OLATResource resource) {
-		return checkIfOneOrMoreNameExistsInContext(names, Collections.singletonList(resource.getKey()));
-	}
-	
-	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, BusinessGroup group) {
-		StringBuilder sb = new StringBuilder();
-		sb.append("select bgs.key from ").append(BGResourceRelation.class.getName()).append(" as rel ")
-			.append(" inner join rel.group bgs ")
-		  .append(" where bgs.key=:groupKey");
-		
-		List<Long> resourceKeys = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Long.class)
-				.setParameter("groupKey", group.getKey())
-				.setParameter("names", names)
-				.getResultList();
-		
-		return checkIfOneOrMoreNameExistsInContext(names, resourceKeys);
-	}
-	
-	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, List<Long> resourceKeys) {
-		if(resourceKeys == null || resourceKeys.isEmpty()) return false;
-		
-		StringBuilder sb = new StringBuilder();
-		sb.append("select count(bgs) from ").append(BGResourceRelation.class.getName()).append(" as rel ")
-			.append(" inner join rel.group bgs ")
-		  .append(" where rel.resource.key in (:resourceKey) and bgs.name in (:names)");
-		
-		Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class)
-				.setParameter("resourceKey", resourceKeys)
-				.setParameter("names", names)
-				.getSingleResult();
-		return count.intValue() > 0;
-	}
 	
 	public BusinessGroup findBusinessGroup(SecurityGroup secGroup) {
 		StringBuilder sb = new StringBuilder(); 
@@ -326,20 +277,22 @@ public class BusinessGroupDAO {
 		StringBuilder sb = new StringBuilder();
 		if(resource == null) {
 			sb.append("select bgs from ").append(BusinessGroupImpl.class.getName()).append(" as bgs ")
-		    .append(" inner join bgs.waitingGroup waitingList ")
+		    .append(" inner join fetch bgs.waitingGroup waitingList ")
+			  .append(" left join fetch bgs.ownerGroup ownerGroup ")
+			  .append(" left join fetch bgs.partipiciantGroup participantGroup ")
 		    .append(" where ");
 		} else {
 			sb.append("select bgs from ").append(BGResourceRelation.class.getName()).append(" as rel ")
 			  .append(" inner join rel.group bgs ")
-			  .append(" inner join bgs.waitingGroup waitingList ")
+			  .append(" inner join fetch bgs.waitingGroup waitingList ")
+			  .append(" left join fetch bgs.ownerGroup ownerGroup ")
+			  .append(" left join fetch bgs.partipiciantGroup participantGroup ")
 		    .append(" where rel.resource.key=:resourceKey and ");
 		}
 		sb.append(" waitingList in (select memberShip.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" memberShip ")
       .append("   where memberShip.identity.key=:identityKey ")
       .append(" )");
 		
-		System.out.println(sb.toString());
-		
 		TypedQuery<BusinessGroup> query = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), BusinessGroup.class)
 				.setParameter("identityKey", identity.getKey());
 		if(resource != null) {
@@ -349,52 +302,6 @@ public class BusinessGroupDAO {
 		return groups;
 	}
 	
-	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();
-		return count.intValue();
-	}
-
-	public List<Identity> getMembersOf(OLATResource resource, boolean owner, boolean attendee) {
-		if(!owner && !attendee) return Collections.emptyList();
-		TypedQuery<Identity> query = createMembersDBQuery(resource, owner, attendee, Identity.class);
-		List<Identity> members = query.getResultList();
-		return members;
-	}
-	
-	private <T> TypedQuery<T> createMembersDBQuery(OLATResource resource, boolean owner, boolean attendee, Class<T> resultClass) {
-		StringBuilder sb = new StringBuilder();
-		if(Identity.class.equals(resultClass)) {
-			sb.append("select distinct sgmi.identity from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
-		} else {
-			sb.append("select count(distinct sgmi.identity) from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
-		}
-		sb.append(" inner join sgmi.securityGroup as secGroup ")
-		  .append(" where ");
-		
-		if(owner) {
-			sb.append("  secGroup in (")
-		    .append("    select rel1.group.ownerGroup from ").append(BGResourceRelation.class.getName()).append(" as rel1")
-		    .append("      where rel1.resource.key=:resourceKey")
-		    .append("  )");
-		}
-		if(attendee) {
-			if(owner) sb.append(" or ");
-			sb.append("  secGroup in (")
-	      .append("    select rel2.group.partipiciantGroup from ").append(BGResourceRelation.class.getName()).append(" as rel2")
-	      .append("      where rel2.resource.key=:resourceKey")
-	      .append("  )");
-		}  
-		if(Identity.class.equals(resultClass)) {
-			sb.append("order by sgmi.identity.name");
-		}
-
-		TypedQuery<T> db = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), resultClass);
-		db.setParameter("resourceKey", resource.getKey());
-		return db;
-	}
-	
 	public int countBusinessGroups(SearchBusinessGroupParams params, Identity identity,
 			boolean ownedById, boolean attendedById, OLATResource resource) {
 		TypedQuery<Number> query = createFindDBQuery(params, identity, ownedById, attendedById, resource, Number.class);
@@ -543,31 +450,28 @@ public class BusinessGroupDAO {
 			dbq.setParameter("tools", params.getTools());
 		}
 		if(StringHelper.containsNonWhitespace(params.getOwner())) {
-			dbq.setParameter("owner", params.getOwner());
+			dbq.setParameter("owner", makeFuzzyQueryString(params.getOwner()));
 		}
 		if(StringHelper.containsNonWhitespace(params.getNameOrDesc())) {
-			dbq.setParameter("search", params.getNameOrDesc());
+			dbq.setParameter("search", makeFuzzyQueryString(params.getNameOrDesc()));
 		} else {
 			if(StringHelper.containsNonWhitespace(params.getExactName())) {
 				dbq.setParameter("exactName", params.getExactName());
 			}
 			if(StringHelper.containsNonWhitespace(params.getName())) {
-				dbq.setParameter("name", params.getName());
+				dbq.setParameter("name", makeFuzzyQueryString(params.getName()));
 			}
 			if(StringHelper.containsNonWhitespace(params.getDescription())) {
-				dbq.setParameter("description", params.getDescription());
+				dbq.setParameter("description", makeFuzzyQueryString(params.getDescription()));
 			}
 		}
 		return dbq;
 	}
 	
 	public int countContacts(Identity identity) {
-		Number result = createContactsQuery(identity, Number.class).getSingleResult();
-		int numOfContacts = result.intValue();
-		if(numOfContacts > 0) {
-			numOfContacts--;//always a contact of myself with this query
-		}
-		return numOfContacts;
+		List<Long> result = createContactsQuery(identity, Long.class).getResultList();
+		result.remove(identity.getKey());//not always a contact of myself with this query
+		return result.size();
 	}
 
 	public List<Identity> findContacts(Identity identity, int firstResult, int maxResults) {
@@ -588,7 +492,7 @@ public class BusinessGroupDAO {
 		if(Identity.class.equals(resultClass)) {
 			query.append("select distinct sgmi.identity from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
 		} else {
-			query.append("select count(distinct sgmi.identity) from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
+			query.append("select distinct sgmi.identity.key from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
 		}
 		query.append(" inner join sgmi.securityGroup as secGroup ")
 		     .append(" where ")
@@ -641,6 +545,19 @@ public class BusinessGroupDAO {
 		return sb;
 	}
 	
+	private String makeFuzzyQueryString(String string) {
+		// By default only fuzzyfy at the end. Usually it makes no sense to do a
+		// fuzzy search with % at the beginning, but it makes the query very very
+		// slow since it can not use any index and must perform a fulltext search.
+		// User can always use * to make it a really fuzzy search query
+		string = string.replace('*', '%');
+		string = string + "%";
+		// with 'LIKE' the character '_' is a wildcard which matches exactly one character.
+		// To test for literal instances of '_', we have to escape it.
+		string = string.replace("_", "\\_");
+		return string.toLowerCase();
+	}
+	
 	private boolean where(StringBuilder sb, boolean where) {
 		if(where) {
 			sb.append(" and ");
diff --git a/src/main/java/org/olat/group/manager/BusinessGroupImportExport.java b/src/main/java/org/olat/group/manager/BusinessGroupImportExport.java
index 129b7c83d83..6a6de335f8e 100644
--- a/src/main/java/org/olat/group/manager/BusinessGroupImportExport.java
+++ b/src/main/java/org/olat/group/manager/BusinessGroupImportExport.java
@@ -219,8 +219,7 @@ public class BusinessGroupImportExport {
 					enableAutoCloseRanks = group.autoCloseRanks.booleanValue();
 				}
 				
-				String type = BusinessGroup.TYPE_LEARNINGROUP;//TODO gm
-				BusinessGroup newGroup = businessGroupService.createBusinessGroup(null, groupName, groupDesc, type, groupMinParticipants, groupMaxParticipants, waitingList, enableAutoCloseRanks, resource);
+				BusinessGroup newGroup = businessGroupService.createBusinessGroup(null, groupName, groupDesc, groupMinParticipants, groupMaxParticipants, waitingList, enableAutoCloseRanks, resource);
 
 				// get tools config
 				CollabTools toolsConfig = group.tools;
diff --git a/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java
index 0ea0646efc7..9be46ce94c1 100644
--- a/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java
+++ b/src/main/java/org/olat/group/manager/BusinessGroupRelationDAO.java
@@ -23,12 +23,16 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 import javax.persistence.EntityManager;
 import javax.persistence.TypedQuery;
 
+import org.olat.basesecurity.SecurityGroupMembershipImpl;
 import org.olat.core.commons.persistence.DB;
+import org.olat.core.id.Identity;
 import org.olat.group.BusinessGroup;
+import org.olat.group.BusinessGroupImpl;
 import org.olat.group.model.BGResourceRelation;
 import org.olat.repository.RepositoryEntry;
 import org.olat.resource.OLATResource;
@@ -83,6 +87,125 @@ public class BusinessGroupRelationDAO {
 			em.remove(relation);
 		}
 	}
+	
+
+	public boolean isIdentityInBusinessGroup(Identity identity, String name, OLATResource resource) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("select count(bgi) from ").append(BusinessGroupImpl.class.getName()).append(" bgi where")
+		  .append(" bgi.name=:name")
+		  .append(" and (")
+		  .append("   bgi.partipiciantGroup in (")
+		  .append("     select participantMemberShip.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" participantMemberShip ")
+		  .append("       where participantMemberShip.identity.key=:identityKey")
+		  .append("   )")
+		  .append("   or")
+		  .append("   bgi.ownerGroup in (")
+		  .append("     select ownerMemberShip.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" ownerMemberShip ")
+		  .append("       where ownerMemberShip.identity.key=:identityKey")
+		  .append("   )")
+		  .append(" )")
+			.append(" and bgi in (")
+			.append("   select relation.group from ").append(BGResourceRelation.class.getName()).append(" relation where relation.resource.key=:resourceKey")
+			.append(" )");
+
+		Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class)
+				.setParameter("identityKey", identity.getKey())
+				.setParameter("name", name)
+				.setParameter("resourceKey", resource.getKey())
+				.getSingleResult();
+		return count.intValue() > 0;
+	}
+	
+	
+	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();
+		return count.intValue();
+	}
+
+	public List<Identity> getMembersOf(OLATResource resource, boolean owner, boolean attendee) {
+		if(!owner && !attendee) return Collections.emptyList();
+		TypedQuery<Identity> query = createMembersDBQuery(resource, owner, attendee, Identity.class);
+		List<Identity> members = query.getResultList();
+		return members;
+	}
+	
+	private <T> TypedQuery<T> createMembersDBQuery(OLATResource resource, boolean owner, boolean attendee, Class<T> resultClass) {
+		StringBuilder sb = new StringBuilder();
+		if(Identity.class.equals(resultClass)) {
+			sb.append("select distinct sgmi.identity from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
+		} else {
+			sb.append("select count(distinct sgmi.identity) from ").append(SecurityGroupMembershipImpl.class.getName()).append(" as sgmi ");
+		}
+		sb.append(" inner join sgmi.securityGroup as secGroup ")
+		  .append(" where ");
+		
+		if(owner) {
+			sb.append("  secGroup in (")
+		    .append("    select rel1.group.ownerGroup from ").append(BGResourceRelation.class.getName()).append(" as rel1")
+		    .append("      where rel1.resource.key=:resourceKey")
+		    .append("  )");
+		}
+		if(attendee) {
+			if(owner) sb.append(" or ");
+			sb.append("  secGroup in (")
+	      .append("    select rel2.group.partipiciantGroup from ").append(BGResourceRelation.class.getName()).append(" as rel2")
+	      .append("      where rel2.resource.key=:resourceKey")
+	      .append("  )");
+		}  
+		if(Identity.class.equals(resultClass)) {
+			sb.append("order by sgmi.identity.name");
+		}
+
+		TypedQuery<T> db = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), resultClass);
+		db.setParameter("resourceKey", resource.getKey());
+		return db;
+	}
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, OLATResource resource) {
+		return checkIfOneOrMoreNameExistsInContext(names, Collections.singletonList(resource.getKey()));
+	}
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, BusinessGroup group) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("select bgs.key from ").append(BGResourceRelation.class.getName()).append(" as rel ")
+			.append(" inner join rel.group bgs ")
+		  .append(" where bgs.key=:groupKey");
+		
+		List<Long> resourceKeys = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Long.class)
+				.setParameter("groupKey", group.getKey())
+				.setParameter("names", names)
+				.getResultList();
+		
+		return checkIfOneOrMoreNameExistsInContext(names, resourceKeys);
+	}
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, List<Long> resourceKeys) {
+		if(resourceKeys == null || resourceKeys.isEmpty()) return false;
+		
+		StringBuilder sb = new StringBuilder();
+		sb.append("select count(bgs) from ").append(BGResourceRelation.class.getName()).append(" as rel ")
+			.append(" inner join rel.group bgs ")
+		  .append(" where rel.resource.key in (:resourceKey) and bgs.name in (:names)");
+		
+		Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class)
+				.setParameter("resourceKey", resourceKeys)
+				.setParameter("names", names)
+				.getSingleResult();
+		return count.intValue() > 0;
+	}
+	
+	public int countResources(BusinessGroup group) {
+		if(group == null) return 0;
+		StringBuilder sb = new StringBuilder();
+		sb.append("select count(bgcr) from ").append(BGResourceRelation.class.getName()).append(" bgcr where bgcr.group.key=:groupKeys");
+		
+		Number count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Number.class)
+				.setParameter("groupKey", group.getKey())
+				.getSingleResult();
+		return count.intValue();
+	}
 
 	public List<OLATResource> findResources(Collection<BusinessGroup> groups, int firstResult, int maxResults) {
 		if(groups == null || groups.isEmpty()) {
diff --git a/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java b/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java
index 379b5b8dbdf..e426199d84e 100644
--- a/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java
+++ b/src/main/java/org/olat/group/manager/BusinessGroupServiceImpl.java
@@ -138,12 +138,12 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 	}
 	
 	@Override
-	public BusinessGroup createBusinessGroup(Identity creator, String name, String description, String type,
+	public BusinessGroup createBusinessGroup(Identity creator, String name, String description,
 			int minParticipants, int maxParticipants, boolean waitingListEnabled, boolean autoCloseRanksEnabled,
 			OLATResource resource) {
 		
 		if(resource != null) {
-			boolean groupExists = businessGroupDAO.checkIfOneOrMoreNameExistsInContext(Collections.singleton(name), resource);
+			boolean groupExists = businessGroupRelationDAO.checkIfOneOrMoreNameExistsInContext(Collections.singleton(name), resource);
 			if (groupExists) {
 				// there is already a group with this name, return without creating a new group
 				log.warn("A group with this name already exists! You will get null instead of a businessGroup returned!");
@@ -151,8 +151,8 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 			}
 		}
 		
-		BusinessGroup group = businessGroupDAO.createAndPersist(creator, name, description, type,
-				minParticipants, maxParticipants, waitingListEnabled, autoCloseRanksEnabled);
+		BusinessGroup group = businessGroupDAO.createAndPersist(creator, name, description,
+				minParticipants, maxParticipants, waitingListEnabled, autoCloseRanksEnabled, false, false, false);
 		
 		if(resource instanceof OLATResourceImpl) {
 			businessGroupRelationDAO.addRelationToResource(group, resource);
@@ -175,7 +175,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 						// create bulkgroups only if there is no name which already exists.
 						Set<BusinessGroup> newGroups = new HashSet<BusinessGroup>();
 						for (String name : allNames) {
-							BusinessGroup newGroup = createBusinessGroup(null, name, description, null, minParticipants, maxParticipants,
+							BusinessGroup newGroup = createBusinessGroup(null, name, description, minParticipants, maxParticipants,
 									waitingListEnabled, autoCloseRanksEnabled, resource);
 							newGroups.add(newGroup);
 						}
@@ -245,12 +245,12 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 	
 	@Override
 	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, OLATResource resource) {
-		return businessGroupDAO.checkIfOneOrMoreNameExistsInContext(names, resource);
+		return businessGroupRelationDAO.checkIfOneOrMoreNameExistsInContext(names, resource);
 	}
 
 	@Override
 	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, BusinessGroup group) {
-		return businessGroupDAO.checkIfOneOrMoreNameExistsInContext(names, group);
+		return businessGroupRelationDAO.checkIfOneOrMoreNameExistsInContext(names, group);
 	}
 
 	@Override
@@ -259,7 +259,7 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 			boolean copyRights, boolean copyOwners, boolean copyParticipants, boolean copyMemberVisibility, boolean copyWaitingList) {
 
 		// 1. create group, set waitingListEnabled, enableAutoCloseRanks like source business-group
-		BusinessGroup newGroup = createBusinessGroup(null, targetName, targetDescription, null, targetMin, targetMax, 
+		BusinessGroup newGroup = createBusinessGroup(null, targetName, targetDescription, targetMin, targetMax, 
 				sourceBusinessGroup.getWaitingListEnabled(), sourceBusinessGroup.getAutoCloseRanksEnabled(), targetResource);
 		// return immediately with null value to indicate an already take groupname
 		if (newGroup == null) { 
@@ -337,22 +337,20 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 
 	@Override
 	@Transactional(readOnly=true)
-	public List<BusinessGroup> findBusinessGroupsOwnedBy(String type, Identity identity, OLATResource resource) {
+	public List<BusinessGroup> findBusinessGroupsOwnedBy(Identity identity, OLATResource resource) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(type);
 		return businessGroupDAO.findBusinessGroups(params, identity, true, false, resource, 0, -1);
 	}
 	
 	@Override
 	@Transactional(readOnly=true)
-	public List<BusinessGroup> findBusinessGroupsAttendedBy(String type, Identity identity, OLATResource resource) {
+	public List<BusinessGroup> findBusinessGroupsAttendedBy(Identity identity, OLATResource resource) {
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(type);
 		return businessGroupDAO.findBusinessGroups(params, identity, false, true, resource, 0, -1);
 	}
 	
 	@Override
-	public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(String type, Identity identity,  OLATResource resource) {
+	public List<BusinessGroup> findBusinessGroupsWithWaitingListAttendedBy(Identity identity,  OLATResource resource) {
 		return businessGroupDAO.findBusinessGroupsWithWaitingListAttendedBy(identity, resource);
 	}
 	
@@ -566,12 +564,12 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 
 	@Override
 	public int countMembersOf(OLATResource resource, boolean owner, boolean attendee) {
-		return businessGroupDAO.countMembersOf(resource, owner, attendee);
+		return businessGroupRelationDAO.countMembersOf(resource, owner, attendee);
 	}
 
 	@Override
 	public List<Identity> getMembersOf(OLATResource resource, boolean owner, boolean attendee) {
-		return businessGroupDAO.getMembersOf(resource, owner, attendee);
+		return businessGroupRelationDAO.getMembersOf(resource, owner, attendee);
 	}
 
 	@Override
@@ -976,14 +974,9 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 	private void addToRoster(Identity ureqIdentity, Identity identity, BusinessGroup group, BGConfigFlags flags) {
 		if (flags.isEnabled(BGConfigFlags.BUDDYLIST) && InstantMessagingModule.isEnabled()) {
 			//evaluate whether to sync or not
-			boolean syncBuddy = InstantMessagingModule.getAdapter().getConfig().isSyncPersonalGroups();
-			boolean isBuddy = group.getType().equals(BusinessGroup.TYPE_BUDDYGROUP);
-			
-			boolean syncLearn = InstantMessagingModule.getAdapter().getConfig().isSyncLearningGroups();
-			boolean isLearn = group.getType().equals(BusinessGroup.TYPE_LEARNINGROUP);
-			
+			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
-			if ((syncBuddy && isBuddy) || (syncLearn && isLearn)) { 
+			if(syncGroup) { 
 				String groupID = InstantMessagingModule.getAdapter().createChatRoomString(group);
 				String groupDisplayName = group.getName();
 				//course group enrolment is time critial so we move this in an separate thread and catch all failures 
@@ -1048,6 +1041,11 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 			}
 		}
 	}
+	
+	@Override
+	public boolean hasResources(BusinessGroup group) {
+		return businessGroupRelationDAO.countResources(group) > 0;
+	}
 
 	@Override
 	@Transactional
@@ -1086,9 +1084,9 @@ public class BusinessGroupServiceImpl implements BusinessGroupService {
 
 	@Override
 	@Transactional(readOnly=true)
-	public boolean isIdentityInBusinessGroup(Identity identity, String groupName, String groupType,
+	public boolean isIdentityInBusinessGroup(Identity identity, String groupName,
 			boolean ownedById, boolean attendedById, OLATResource resource) {
-		return businessGroupDAO.isIdentityInBusinessGroup(identity, groupName, resource);
+		return businessGroupRelationDAO.isIdentityInBusinessGroup(identity, groupName, resource);
 	}
 	
 	@Override
diff --git a/src/main/java/org/olat/group/ui/BGControllerFactory.java b/src/main/java/org/olat/group/ui/BGControllerFactory.java
index 50cad87888f..6ad28605e5f 100644
--- a/src/main/java/org/olat/group/ui/BGControllerFactory.java
+++ b/src/main/java/org/olat/group/ui/BGControllerFactory.java
@@ -87,8 +87,8 @@ 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)) {
+		//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)) {
@@ -97,10 +97,10 @@ public class BGControllerFactory {
 		} 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);
-		}
+		} else {*/
+		BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags();
+		return new BusinessGroupEditController(ureq, wControl, businessGroup, flags);
+		//}
 	}
 
 	//
@@ -133,7 +133,7 @@ public class BGControllerFactory {
 		}
 		
 		
-		String bgTyp = businessGroup.getType();
+		/*String bgTyp = businessGroup.getType();
 		if (BusinessGroup.TYPE_BUDDYGROUP.equals(bgTyp)) {
 			BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags();
 			flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, false);
@@ -146,11 +146,11 @@ public class BGControllerFactory {
 			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);
-		}
+		} else {*/
+		BGConfigFlags flags = BGConfigFlags.createGroupDefaultFlags();
+		flags.setEnabled(BGConfigFlags.IS_GM_ADMIN, isGMAdmin);
+		return new BusinessGroupMainRunController(ureq, bwControl, businessGroup, flags, initialViewIdentifier);
+
 	}
 
 	/**
diff --git a/src/main/java/org/olat/group/ui/BGTranslatorFactory.java b/src/main/java/org/olat/group/ui/BGTranslatorFactory.java
index 46b54632e4d..d7a33a056de 100644
--- a/src/main/java/org/olat/group/ui/BGTranslatorFactory.java
+++ b/src/main/java/org/olat/group/ui/BGTranslatorFactory.java
@@ -44,9 +44,9 @@ import org.olat.group.BusinessGroup;
  */
 public class BGTranslatorFactory {
 	private static final String PACKAGE_BASE = Util.getPackageName(BGTranslatorFactory.class);
-	private static final String PACKAGE_BG = PACKAGE_BASE + ".buddygroup";
+	//private static final String PACKAGE_BG = PACKAGE_BASE + ".buddygroup";
 	private static final String PACKAGE_LG = PACKAGE_BASE + ".learninggroup";
-	private static final String PACKAGE_RG = PACKAGE_BASE + ".rightgroup";
+	//private static final String PACKAGE_RG = PACKAGE_BASE + ".rightgroup";
 
 	private BGTranslatorFactory() {
 	// never called
@@ -86,14 +86,13 @@ public class BGTranslatorFactory {
 		}
 		// 1 - group type specific translations (buddy, learning, right)
 		// with fallback to package translator (2)
-		if (groupType.equals(BusinessGroup.TYPE_BUDDYGROUP)) { 
+		/*if (groupType.equals(BusinessGroup.TYPE_BUDDYGROUP)) { 
 			return new PackageTranslator(PACKAGE_BG, locale, packageTrans);
 		} else if (groupType.equals(BusinessGroup.TYPE_LEARNINGROUP)) {
 			return new PackageTranslator(PACKAGE_LG, locale, packageTrans);
 		} else if (groupType.equals(BusinessGroup.TYPE_RIGHTGROUP)) {
 			return new PackageTranslator(PACKAGE_RG, locale, packageTrans);
-		} else {
-			return new PackageTranslator(PACKAGE_LG, locale, packageTrans);
-		}
+		}*/
+		return new PackageTranslator(PACKAGE_LG, locale, packageTrans);
 	}
 }
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 13daa2a590f..9f6eb205a3c 100644
--- a/src/main/java/org/olat/group/ui/main/BGMainController.java
+++ b/src/main/java/org/olat/group/ui/main/BGMainController.java
@@ -186,7 +186,7 @@ public class BGMainController extends MainLayoutBasicController implements Activ
 		securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
 
 		identity = ureq.getIdentity();
-		setTranslator(BGTranslatorFactory.createBGPackageTranslator(PACKAGE, BusinessGroup.TYPE_BUDDYGROUP, ureq.getLocale()));
+		setTranslator(BGTranslatorFactory.createBGPackageTranslator(PACKAGE, null, ureq.getLocale()));
 		//fxdiff VCRP-1,2: access control of resources
 		acFrontendManager = (ACFrontendManager)CoreSpringFactory.getBean("acFrontendManager");
 
@@ -311,13 +311,14 @@ public class BGMainController extends MainLayoutBasicController implements Activ
 				if(ctrl != null) {
 					addToHistory(ureq, ctrl);
 				}
-			} else if (actionid.equals(TABLE_ACTION_DELETE) && currBusinessGroup.getType().equals(BusinessGroup.TYPE_BUDDYGROUP)) {
-				// only for buddygroups allowed
-				deleteDialogBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.delete.text", trnslP), deleteDialogBox);
-			} else if (actionid.equals(TABLE_ACTION_LEAVE) && currBusinessGroup.getType().equals(BusinessGroup.TYPE_BUDDYGROUP)) {
-				// only for buddygroups allowed
-				leaveDialogBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.leave.text", trnslP), leaveDialogBox);
-			//fxdiff VCRP-1,2: access control of resources
+			} else if (actionid.equals(TABLE_ACTION_DELETE) || actionid.equals(TABLE_ACTION_LEAVE)) {
+				if(!businessGroupService.hasResources(currBusinessGroup)) {
+					if(actionid.equals(TABLE_ACTION_DELETE)) {
+						deleteDialogBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.delete.text", trnslP), deleteDialogBox);
+					} else if(actionid.equals(TABLE_ACTION_LEAVE)) {
+						leaveDialogBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.leave.text", trnslP), leaveDialogBox);
+					}
+				}
 			} else if (actionid.equals(TABLE_ACTION_ACCESS)) {
 				handleAccess(ureq);
 			}
@@ -518,7 +519,7 @@ public class BGMainController extends MainLayoutBasicController implements Activ
 		 * description and also the CollaborationTools are enabled during creation.
 		 * The GroupContext is null in the case of BuddyGroups.
 		 */
-		BusinessGroup newGroup = businessGroupService.createBusinessGroup(identity, bgName, bgDesc, null, bgMin, bgMax, false, false, null);
+		BusinessGroup newGroup = businessGroupService.createBusinessGroup(identity, bgName, bgDesc, bgMin, bgMax, false, false, null);
 		// do Logging
 		ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(newGroup));
 		ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_CREATED, getClass());
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 7e6f45dc63a..612fd66fa84 100644
--- a/src/main/java/org/olat/group/ui/management/BGManagementController.java
+++ b/src/main/java/org/olat/group/ui/management/BGManagementController.java
@@ -157,7 +157,6 @@ public class BGManagementController extends MainLayoutBasicController implements
 
 	private Translator userTrans;
 	private final OLATResource resource;
-	private final String groupType = BusinessGroup.TYPE_LEARNINGROUP;
 	private BGConfigFlags flags;
 	private static final int STATE_OVERVIEW = 1;
 	private static final int STATE_CONTEXT_REMOVED = 3;
@@ -236,7 +235,7 @@ public class BGManagementController extends MainLayoutBasicController implements
 		// Initialize translator
 		// 1 - package translator with default group fallback translators and type
 		// translator
-		setTranslator(BGTranslatorFactory.createBGPackageTranslator(PACKAGE, this.groupType, ureq.getLocale()));
+		setTranslator(BGTranslatorFactory.createBGPackageTranslator(PACKAGE, "LearningGroup", ureq.getLocale()));
 		// user translator
 		this.userTrans = Util.createPackageTranslator(UserManager.class, ureq.getLocale());
 
@@ -788,33 +787,25 @@ public class BGManagementController extends MainLayoutBasicController implements
 		// Overview page
 		overviewVC = createVelocityContainer("overview");
 		overviewVC.contextPut("flags", flags);
-		overviewVC.contextPut("type", this.groupType);
 		// Create new group form
 		newGroupVC = createVelocityContainer("newgroup");
-		newGroupVC.contextPut("type", this.groupType);
 		// Group list
 		groupListVC = createVelocityContainer("grouplist");
-		groupListVC.contextPut("type", this.groupType);
 		// Group message
 		sendMessageVC = createVelocityContainer("sendmessage");
-		sendMessageVC.contextPut("type", this.groupType);
 		if (flags.isEnabled(BGConfigFlags.AREAS)) {
 			// Create new area form
 			newAreaVC = createVelocityContainer("newarea");
-			newAreaVC.contextPut("type", this.groupType);
 			// Area list
 			areaListVC = createVelocityContainer("arealist");
-			areaListVC.contextPut("type", this.groupType);
 		}
 		// User list
 		userListVC = createVelocityContainer("userlist");
-		userListVC.contextPut("type", this.groupType);
 		// User details
 		userDetailsVC = new VelocityContainer("userdetails", Util.getPackageVelocityRoot(this.getClass()) + "/userdetails.html", 
 				Util.createPackageTranslator(HomePageDisplayController.class, getLocale(), getTranslator())
 		, this);
 		backButton = LinkFactory.createButtonSmall("back", userDetailsVC, this);
-		userDetailsVC.contextPut("type", this.groupType);
 	}
 
 	private void doOverview(UserRequest ureq) {
@@ -1081,7 +1072,7 @@ public class BGManagementController extends MainLayoutBasicController implements
 		userDetailsVC.put("userdetailsform", homePageDisplayController.getInitialComponent());
 		// 2. expose the owner groups of the identity
 		if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) {
-			List<BusinessGroup> ownerGroups = businessGroupService.findBusinessGroupsOwnedBy(groupType, currentIdentity, resource);
+			List<BusinessGroup> ownerGroups = businessGroupService.findBusinessGroupsOwnedBy(currentIdentity, resource);
 			
 			Link[] ownerGroupLinks= new Link[ownerGroups.size()];
 			int ownerNumber = 0;
@@ -1100,7 +1091,7 @@ public class BGManagementController extends MainLayoutBasicController implements
 			userDetailsVC.contextPut("showOwnerGroups", Boolean.FALSE);
 		}
 		// 3. expose the participant groups of the identity
-		List<BusinessGroup> participantGroups = businessGroupService.findBusinessGroupsAttendedBy(groupType, currentIdentity, resource);
+		List<BusinessGroup> participantGroups = businessGroupService.findBusinessGroupsAttendedBy(currentIdentity, resource);
 		
 		Link[] participantGroupLinks= new Link[participantGroups.size()];
 		int participantNumber = 0;
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 22c894cfb86..de51035e725 100644
--- a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java
+++ b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java
@@ -1153,11 +1153,8 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
 		
 		if (InstantMessagingModule.isEnabled() && 
 				collabTools.isToolEnabled(CollaborationTools.TOOL_CHAT) && 
-				(
-						!businessGroup.getType().equals(BusinessGroup.TYPE_LEARNINGROUP) ||
-						InstantMessagingModule.isSyncLearningGroups() // whether LearningGroups can have chat or not
-				)
-			) {
+				InstantMessagingModule.isSyncLearningGroups() // whether LearningGroups can have chat or not)
+				) {
 			gtnChild = new GenericTreeNode();
 			gtnChild.setTitle(translate("menutree.chat"));
 			gtnChild.setUserObject(ACTIVITY_MENUSELECT_CHAT);
@@ -1200,18 +1197,16 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
 			nodeAdmin = gtnChild;
 
 			//fxdiff VCRP-1,2: access control of resources
-			if(BusinessGroup.TYPE_BUDDYGROUP.equals(businessGroup.getType())) {
-				AccessControlModule acModule = (AccessControlModule)CoreSpringFactory.getBean("acModule");
-				if(acModule.isEnabled()) {
-					gtnChild = new GenericTreeNode();
-					gtnChild.setTitle(translate("menutree.ac"));
-					gtnChild.setUserObject(ACTIVITY_MENUSELECT_AC);
-					gtnChild.setIdent(ACTIVITY_MENUSELECT_AC);
-					gtnChild.setAltText(translate("menutree.ac.alt"));
-					gtnChild.setIconCssClass("b_order_icon");
-					root.addChild(gtnChild);
-					//acNodeId = gtnChild.getIdent();
-				}
+			AccessControlModule acModule = (AccessControlModule)CoreSpringFactory.getBean("acModule");
+			if(acModule.isEnabled()) {
+				gtnChild = new GenericTreeNode();
+				gtnChild.setTitle(translate("menutree.ac"));
+				gtnChild.setUserObject(ACTIVITY_MENUSELECT_AC);
+				gtnChild.setIdent(ACTIVITY_MENUSELECT_AC);
+				gtnChild.setAltText(translate("menutree.ac.alt"));
+				gtnChild.setIconCssClass("b_order_icon");
+				root.addChild(gtnChild);
+				//acNodeId = gtnChild.getIdent();
 			}
 		}
 
diff --git a/src/main/java/org/olat/group/ui/run/BusinessGroupSendToChooserForm.java b/src/main/java/org/olat/group/ui/run/BusinessGroupSendToChooserForm.java
index d5122f6e2c8..b4e2afd9a13 100644
--- a/src/main/java/org/olat/group/ui/run/BusinessGroupSendToChooserForm.java
+++ b/src/main/java/org/olat/group/ui/run/BusinessGroupSendToChooserForm.java
@@ -114,7 +114,7 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 		showChoosePartips = bgpm.showPartips();
 		showWaitingList = isAdmin && businessGroup.getWaitingListEnabled().booleanValue();
 		
-		if (isRightGroup() || isMultiSelectionOwnerKeys())  {
+		if (isMultiSelectionOwnerKeys())  {
 			
 			radioKeysOwners = new String[] {
 					NLS_RADIO_ALL,
@@ -129,12 +129,10 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 			};
 
 			// Owner MultiSelection
-			if (!isRightGroup()) {
-				SecurityGroup owners = businessGroup.getOwnerGroup();			
-				keysOwner = getMemberKeys(ureq, owners);
-				valuesOwner = getMemberValues(ureq, owners); 
-				ArrayHelper.sort(keysOwner, valuesOwner, false, true, false);
-			}
+			SecurityGroup owners = businessGroup.getOwnerGroup();			
+			keysOwner = getMemberKeys(ureq, owners);
+			valuesOwner = getMemberValues(ureq, owners); 
+			ArrayHelper.sort(keysOwner, valuesOwner, false, true, false);
 		} else {
 
 			radioKeysOwners = new String[]{
@@ -149,7 +147,7 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 		}
 		
 		if (isMultiSelectionPartipKeys()) {
-			if (isRightGroup()) {
+			/*if (isRightGroup()) {
 				radioKeysPartips = new String[]{
 						NLS_RADIO_ALL,
 						NLS_RADIO_CHOOSE
@@ -164,7 +162,7 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 				keysPartips = getMemberKeys(ureq, participants);
 				valuesPartips = getMemberValues(ureq, participants); 
 								
-			} else {
+			} else */{
 				radioKeysPartips = new String[]{
 						NLS_RADIO_ALL,
 						NLS_RADIO_NOTHING,
@@ -183,14 +181,14 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 				ArrayHelper.sort(keysPartips, valuesPartips, false, true, false);
 			}
 		} else {
-			if (isRightGroup()) {
+			/*if (isRightGroup()) {
 				radioKeysPartips = new String[]{
 						NLS_RADIO_ALL
 				};
 				radioValuesPartips = new String[]{
 						translate("sendtochooser.form.radio.partip.all.rightgroup")
 				};
-			} else {
+			} else */{
 				radioKeysPartips = new String[]{
 						NLS_RADIO_ALL,
 						NLS_RADIO_NOTHING
@@ -269,15 +267,6 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 		}
 		return keys;
 	}
-		
-	
-	/**
-	 * @param businessGroup
-	 * @return
-	 */
-	private boolean isRightGroup() {
-		return this.businessGroup.getType().equals(businessGroup.TYPE_RIGHTGROUP);
-	}
 
 	protected boolean validateFormLogic(UserRequest ureq) {
 		
@@ -319,7 +308,7 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 				return false;
 			}
 		} else {
-			if (isRightGroup()) {
+			/*if (isRightGroup()) {
 				if (radioButtonPartips.isSelected(0)
 						|| (isMultiSelectionPartipKeys() ? (radioButtonPartips.isSelected(1) && (multiSelectionPartipKeys != null) && multiSelectionPartipKeys.getSelectedKeys().size() > 0 ? true
 								: false)
@@ -329,7 +318,7 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 					errorKeyDisplay.setErrorKey("sendtochooser.form.error.nonselected", null);
 					return false;
 				}
-			} else {
+			} else */ {
 				if (radioButtonOwner.isSelected(0)
 						|| radioButtonPartips.isSelected(0)
 						|| (isMultiSelectionOwnerKeys() ? (radioButtonOwner.isSelected(2) && (multiSelectionOwnerKeys != null) && multiSelectionOwnerKeys.getSelectedKeys().size() > 0 ? true
@@ -429,14 +418,14 @@ public class BusinessGroupSendToChooserForm extends FormBasicController {
 	@Override
 	protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
 		setFormTitle("sendtochooser.form.header");
-		if (!isRightGroup()) {
+		//if (!isRightGroup()) {
 			radioButtonOwner = uifactory.addRadiosVertical("radioButtonOwner", "sendtochooser.form.radio.owners", formLayout, radioKeysOwners, radioValuesOwners);
 			radioButtonOwner.select(NLS_RADIO_ALL, true);
 			radioButtonOwner.addActionListener(listener, FormEvent.ONCLICK);
 			if ( (keysOwner != null) && (valuesOwner != null) ) {
 				multiSelectionOwnerKeys = uifactory.addCheckboxesVertical("multiSelectionOwnerKeys", "", formLayout, keysOwner, valuesOwner, null, 1);
 			}
-		}
+		//}
 		
 		radioButtonPartips = uifactory.addRadiosVertical("radioButtonPartip", "sendtochooser.form.radio.rightgroup", formLayout, radioKeysPartips, radioValuesPartips);
 		radioButtonPartips.select(NLS_RADIO_ALL, true);
diff --git a/src/main/java/org/olat/home/HomeCalendarController.java b/src/main/java/org/olat/home/HomeCalendarController.java
index 9233ad56d13..c7967f77adc 100644
--- a/src/main/java/org/olat/home/HomeCalendarController.java
+++ b/src/main/java/org/olat/home/HomeCalendarController.java
@@ -136,7 +136,6 @@ public class HomeCalendarController extends BasicController implements Activatea
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 
 		SearchBusinessGroupParams groupParams = new SearchBusinessGroupParams();
-		groupParams.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP, BusinessGroup.TYPE_RIGHTGROUP);
 		groupParams.addTools(CollaborationTools.TOOL_CALENDAR);
 		List<BusinessGroup> ownerGroups = bgs.findBusinessGroups(groupParams, ureq.getIdentity(), true, false, null, 0, -1);
 		addCalendars(ureq, ownerGroups, true, calendars);
diff --git a/src/main/java/org/olat/instantMessaging/InstantMessaging.java b/src/main/java/org/olat/instantMessaging/InstantMessaging.java
index cf3bf39474f..1b7bb4bfc8a 100644
--- a/src/main/java/org/olat/instantMessaging/InstantMessaging.java
+++ b/src/main/java/org/olat/instantMessaging/InstantMessaging.java
@@ -35,7 +35,6 @@ import org.olat.core.gui.control.Controller;
 import org.olat.core.gui.control.WindowControl;
 import org.olat.core.id.Identity;
 import org.olat.core.id.OLATResourceable;
-import org.olat.group.BusinessGroup;
 import org.olat.instantMessaging.groupchat.GroupChatManagerController;
 import org.olat.instantMessaging.ui.ConnectedUsersListEntry;
 
@@ -48,16 +47,10 @@ import org.olat.instantMessaging.ui.ConnectedUsersListEntry;
  */
 public interface InstantMessaging {
 	
-	/**
-	 * called when OLAT server is started and needs to sync the buddygroups with the IM server.
-	 * @return true upon success
-	 */
-	public boolean synchronizeAllBuddyGroupsWithIMServer();
-	
 	/**
 	 * called when OLAT server is started and needs to sync the learinggroups with the IM server.
 	 */
-	public boolean synchronizeLearningGroupsWithIMServer();
+	public boolean synchronizeBusinessGroupsWithIMServer();
 
 	/**
 	 * called when OLAT server is started and needs to sync the buddygroups with the IM server.
diff --git a/src/main/java/org/olat/instantMessaging/InstantMessagingJob.java b/src/main/java/org/olat/instantMessaging/InstantMessagingJob.java
index 00e60b93378..6bea7ddcf00 100644
--- a/src/main/java/org/olat/instantMessaging/InstantMessagingJob.java
+++ b/src/main/java/org/olat/instantMessaging/InstantMessagingJob.java
@@ -59,7 +59,7 @@ public class InstantMessagingJob extends JobWithDB {
 				if (InstantMessagingModule.isSyncLearningGroups()) {
 					long start = System.currentTimeMillis();
 					log.info("Start synching learning groups with IM");
-					boolean result = im.synchronizeLearningGroupsWithIMServer();
+					boolean result = im.synchronizeBusinessGroupsWithIMServer();
 					Property property = propertyManager.createPropertyInstance(null, null, null, "classConfig", createPropertyName(this.getClass(), CONFIG_SYNCED_LEARNING_GROUPS), null,  null, Boolean.toString(result), null);
 					propertyManager.saveProperty(property);
 					log.info("Synching learning groups with IM terminated in " + (System.currentTimeMillis() - start) + " (ms)");
diff --git a/src/main/java/org/olat/instantMessaging/InstantMessagingModule.java b/src/main/java/org/olat/instantMessaging/InstantMessagingModule.java
index 66c00e97dac..192e442376b 100644
--- a/src/main/java/org/olat/instantMessaging/InstantMessagingModule.java
+++ b/src/main/java/org/olat/instantMessaging/InstantMessagingModule.java
@@ -119,7 +119,6 @@ public class InstantMessagingModule implements Initializable, Destroyable, UserD
 	/**
 	 * @see org.olat.core.configuration.OLATModule#init(com.anthonyeden.lib.config.Configuration)
 	 */
-	@SuppressWarnings("unchecked")
 	public void init() {
 		if (config.isEnabled()) {
 			
@@ -134,10 +133,12 @@ public class InstantMessagingModule implements Initializable, Destroyable, UserD
 			 * delete from o_property where name='org.olat.instantMessaging.InstantMessagingModule::syncedbuddygroups';
 			 */
 			
-			List props = propertyManager.findProperties(null, null, null, "classConfig", createPropertyName(this.getClass(), CONFIG_SYNCED_BUDDY_GROUPS));
+			List<Property> props = propertyManager.findProperties(null, null, null, "classConfig", createPropertyName(this.getClass(), CONFIG_SYNCED_BUDDY_GROUPS));
 			if (props.size() == 0) {
 				
-				if (config.isSyncPersonalGroups()) instantMessaging.synchronizeAllBuddyGroupsWithIMServer();
+				if (config.isSyncPersonalGroups()) {
+					instantMessaging.synchronizeBusinessGroupsWithIMServer();
+				}
 				Property property = propertyManager.createPropertyInstance(null, null, null, "classConfig", createPropertyName(this.getClass(), CONFIG_SYNCED_BUDDY_GROUPS), null,  null, Boolean.toString(true), null);
 				propertyManager.saveProperty(property);
 			}
diff --git a/src/main/java/org/olat/instantMessaging/SmackInstantMessagingImpl.java b/src/main/java/org/olat/instantMessaging/SmackInstantMessagingImpl.java
index f1be6e8fa77..b98f019f389 100644
--- a/src/main/java/org/olat/instantMessaging/SmackInstantMessagingImpl.java
+++ b/src/main/java/org/olat/instantMessaging/SmackInstantMessagingImpl.java
@@ -39,7 +39,6 @@ import org.olat.basesecurity.BaseSecurity;
 import org.olat.basesecurity.BaseSecurityManager;
 import org.olat.basesecurity.IdentityShort;
 import org.olat.basesecurity.SecurityGroup;
-import org.olat.core.CoreSpringFactory;
 import org.olat.core.commons.persistence.DBFactory;
 import org.olat.core.gui.UserRequest;
 import org.olat.core.gui.control.Controller;
@@ -336,7 +335,7 @@ public class SmackInstantMessagingImpl extends LogDelegator implements InstantMe
 	 */
 
 	//fxdiff: FXOLAT-219 decrease the load for synching groups
-	public boolean synchronizeLearningGroupsWithIMServer() {
+	public boolean synchronizeBusinessGroupsWithIMServer() {
 		if (!(adminConnecion != null && adminConnecion.getConnection() != null && adminConnecion.getConnection().isConnected())) {
 			return false;
 		}
@@ -348,11 +347,9 @@ public class SmackInstantMessagingImpl extends LogDelegator implements InstantMe
 		int GROUP_BATCH_SIZE = 50;
 		List<BusinessGroup> groups;
 		Set<Long> checkedIdentities = new HashSet<Long>();
-		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_LEARNINGROUP);
 		do {
-			groups = bgs.findBusinessGroups(params, null, false, false, null, counter, GROUP_BATCH_SIZE);
+			groups = businessGroupService.findBusinessGroups(params, null, false, false, null, counter, GROUP_BATCH_SIZE);
 			for (BusinessGroup group:groups) {
 				if (!syncLearn) {
 					String groupID = InstantMessagingModule.getAdapter().createChatRoomString(group);
@@ -378,35 +375,6 @@ public class SmackInstantMessagingImpl extends LogDelegator implements InstantMe
 		return true;
 	}
 
-	/**
-	 * Synchronize the groups with the IM system
-	 * To synchronize buddygroups, use the null-context.
-	 * Be aware that this action might take some time!
-	 * @return true if successfull, false if IM server is not running
-	 */
-	public boolean synchronizeAllBuddyGroupsWithIMServer() {
-		if (adminConnecion != null && adminConnecion.getConnection() != null && adminConnecion.getConnection().isConnected()) {
-			logInfo("Started synchronisation of BuddyGroups with IM server.");
-			//null as argument pulls all buddygroups
-			SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-			params.addTypes(BusinessGroup.TYPE_BUDDYGROUP);
-			List<BusinessGroup> groups = businessGroupService.findBusinessGroups(params, null, false, false, null, 0, -1);
-			int counter = 0;
-			//fxdiff: FXOLAT-219 decrease the load for synching groups
-			Set<Long> checkedIdentites = new HashSet<Long>();
-			for (BusinessGroup group: groups) {
-				if(synchonizeBuddyRoster(group, checkedIdentites)) {
-					counter++;
-				}
-				//make an intermediate commit already
-			}
-			logInfo("Ended synchronisation of BuddyGroups with IM server: Synched "+counter+" groups");
-			return true;
-		} else {
-			return false;
-		}
-	}
-
 	/**
 	 * @see org.olat.instantMessaging.InstantMessaging#createChatRoomString(org.olat.core.id.OLATResourceable
 	 */
diff --git a/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java b/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java
index 304e9a4a514..7bce2df6420 100644
--- a/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java
+++ b/src/main/java/org/olat/modules/fo/restapi/MyForumsWebService.java
@@ -215,7 +215,6 @@ public class MyForumsWebService {
 		//start found forums in groups
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		params.addTools(CollaborationTools.TOOL_FORUM);
 		List<BusinessGroup> groups = bgs.findBusinessGroups(params, retrievedUser, true, true, null, 0, -1);
 		//list forum keys
diff --git a/src/main/java/org/olat/repository/controllers/RepositoryMainController.java b/src/main/java/org/olat/repository/controllers/RepositoryMainController.java
index c2bc0e89e0b..710a34ef838 100644
--- a/src/main/java/org/olat/repository/controllers/RepositoryMainController.java
+++ b/src/main/java/org/olat/repository/controllers/RepositoryMainController.java
@@ -72,7 +72,6 @@ import org.olat.fileresource.types.PodcastFileResource;
 import org.olat.fileresource.types.ScormCPFileResource;
 import org.olat.fileresource.types.SharedFolderFileResource;
 import org.olat.fileresource.types.WikiResource;
-import org.olat.group.BusinessGroup;
 import org.olat.group.BusinessGroupService;
 import org.olat.group.model.SearchBusinessGroupParams;
 import org.olat.ims.qti.fileresource.SurveyFileResource;
@@ -286,7 +285,6 @@ public class RepositoryMainController extends MainLayoutBasicController implemen
 			rootNode.addChild(new GenericTreeNode(translate("search.mycourses.student"), "search.mycourses.student"));
 			// for authors or users with group rights also show the teacher portlet
 			SearchBusinessGroupParams rightParams = new SearchBusinessGroupParams();
-			rightParams.addTypes(BusinessGroup.TYPE_RIGHTGROUP);
 			if (bIsAuthor || businessGroupService.countBusinessGroups(rightParams, getIdentity(), true, false, null) > 0) {
 				rootNode.addChild(new GenericTreeNode(translate("search.mycourses.teacher"), "search.mycourses.teacher"));
 			}
diff --git a/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java b/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java
index cf7939a4643..ac636270a87 100644
--- a/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java
+++ b/src/main/java/org/olat/repository/controllers/WizardCloseCourseController.java
@@ -66,7 +66,6 @@ import org.olat.core.util.mail.MailerWithTemplate;
 import org.olat.course.CourseFactory;
 import org.olat.course.ICourse;
 import org.olat.group.BusinessGroup;
-import org.olat.group.BusinessGroupManagerImpl;
 import org.olat.group.BusinessGroupService;
 import org.olat.group.ui.BGConfigFlags;
 import org.olat.repository.RepositoryEntry;
@@ -255,7 +254,6 @@ public class WizardCloseCourseController extends WizardController implements Wiz
 		if(course != null) {
 			BaseSecurity securityManager = BaseSecurityManager.getInstance();
 
-
 			// LearningGroups
 			List<BusinessGroup> allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts();
 			BGConfigFlags flagsLearning = BGConfigFlags.createLearningGroupDefaultFlags();
@@ -263,18 +261,17 @@ public class WizardCloseCourseController extends WizardController implements Wiz
 				SecurityGroup secGroupOwner = bGroup.getOwnerGroup();
 				SecurityGroup secGroupPartipiciant = bGroup.getPartipiciantGroup();
 				SecurityGroup secGroupWaiting = bGroup.getWaitingGroup();
-				businessGroupService.removeOwners(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupOwner), bGroup, flagsLearning);
-				businessGroupService.removeParticipants(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), bGroup, flagsLearning);
-				businessGroupService.removeFromWaitingList(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupWaiting), bGroup, flagsLearning);
-			}
-			// RightGroups
-			allGroups.clear();
-			allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllRightGroupsFromAllContexts();
-			BGConfigFlags flagsRightgroup = BGConfigFlags.createRightGroupDefaultFlags();
-			for (Object bGroup : allGroups) {
-				SecurityGroup secGroupPartipiciant = ((BusinessGroup) bGroup).getPartipiciantGroup();
-				businessGroupService.removeParticipants(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), ((BusinessGroup) bGroup), flagsRightgroup);
+				if(secGroupOwner != null) {
+					businessGroupService.removeOwners(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupOwner), bGroup, flagsLearning);
+				}
+				if(secGroupPartipiciant != null) {
+					businessGroupService.removeParticipants(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), bGroup, flagsLearning);
+				}
+				if(secGroupWaiting != null) {
+					businessGroupService.removeFromWaitingList(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupWaiting), bGroup, flagsLearning);
+				}
 			}
+			
 			//fxdiff VCRP-1,2: access control of resources
 			if(repositoryEntry.getParticipantGroup() != null) {
 				SecurityGroup secGroupPartipiciant = repositoryEntry.getParticipantGroup();
diff --git a/src/main/java/org/olat/restapi/group/MyGroupWebService.java b/src/main/java/org/olat/restapi/group/MyGroupWebService.java
index 72b32f4f053..8e82f0fc68f 100644
--- a/src/main/java/org/olat/restapi/group/MyGroupWebService.java
+++ b/src/main/java/org/olat/restapi/group/MyGroupWebService.java
@@ -36,8 +36,6 @@ import javax.ws.rs.core.Response.Status;
 import org.olat.core.CoreSpringFactory;
 import org.olat.core.id.Identity;
 import org.olat.group.BusinessGroup;
-import org.olat.group.BusinessGroupManager;
-import org.olat.group.BusinessGroupManagerImpl;
 import org.olat.group.BusinessGroupService;
 import org.olat.group.model.SearchBusinessGroupParams;
 import org.olat.restapi.support.MediaTypeVariants;
@@ -85,7 +83,6 @@ public class MyGroupWebService {
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		List<BusinessGroup> groups;
 		if(MediaTypeVariants.isPaged(httpRequest, request)) {
 			int totalCount = bgs.countBusinessGroups(params, retrievedUser, true, true, null);
@@ -135,7 +132,6 @@ public class MyGroupWebService {
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		List<BusinessGroup> groups;
 		if(MediaTypeVariants.isPaged(httpRequest, request)) {
 			int totalCount = bgs.countBusinessGroups(params, retrievedUser, true, true, null);
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 a974dc521a2..2d25228b7e1 100644
--- a/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java
+++ b/src/main/java/org/olat/restapi/repository/course/CourseGroupWebService.java
@@ -217,7 +217,7 @@ public class CourseGroupWebService {
 		Integer max = normalize(group.getMaxParticipants());
 		
 		OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(course);
-		BusinessGroup bg = bgm.createBusinessGroup(ureq.getIdentity(), name, desc, BusinessGroup.TYPE_LEARNINGROUP, min, max, false, false, resource);
+		BusinessGroup bg = bgm.createBusinessGroup(ureq.getIdentity(), name, desc, min, max, false, false, resource);
 		GroupVO savedVO = ObjectFactory.get(bg);
 		return Response.ok(savedVO).build();
 	}
diff --git a/src/main/java/org/olat/restapi/user/UserFoldersWebService.java b/src/main/java/org/olat/restapi/user/UserFoldersWebService.java
index e53a977ca7f..721b004f95c 100644
--- a/src/main/java/org/olat/restapi/user/UserFoldersWebService.java
+++ b/src/main/java/org/olat/restapi/user/UserFoldersWebService.java
@@ -70,8 +70,6 @@ import org.olat.course.nodes.BCCourseNode;
 import org.olat.course.nodes.bc.BCWebService;
 import org.olat.course.run.userview.CourseTreeVisitor;
 import org.olat.group.BusinessGroup;
-import org.olat.group.BusinessGroupManager;
-import org.olat.group.BusinessGroupManagerImpl;
 import org.olat.group.BusinessGroupService;
 import org.olat.group.model.SearchBusinessGroupParams;
 import org.olat.repository.RepositoryEntry;
@@ -247,7 +245,6 @@ public class UserFoldersWebService {
 		//start found forums in groups
 		BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
-		params.addTypes(BusinessGroup.TYPE_BUDDYGROUP, BusinessGroup.TYPE_LEARNINGROUP);
 		params.addTools(CollaborationTools.TOOL_FOLDER);
 		List<BusinessGroup> groups = bgs.findBusinessGroups(params, retrievedUser, true, true, null, 0, -1);
 		for(BusinessGroup group:groups) {
diff --git a/src/main/java/org/olat/upgrade/OLATUpgrade_7_1_1.java b/src/main/java/org/olat/upgrade/OLATUpgrade_7_1_1.java
index 29502633fee..6d0f9d9096a 100644
--- a/src/main/java/org/olat/upgrade/OLATUpgrade_7_1_1.java
+++ b/src/main/java/org/olat/upgrade/OLATUpgrade_7_1_1.java
@@ -29,6 +29,7 @@ import org.olat.basesecurity.BaseSecurityManager;
 import org.olat.basesecurity.Constants;
 import org.olat.basesecurity.SecurityGroup;
 import org.olat.core.CoreSpringFactory;
+import org.olat.core.commons.persistence.DB;
 import org.olat.core.commons.persistence.DBFactory;
 import org.olat.core.commons.persistence.DBQuery;
 import org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback;
@@ -38,7 +39,6 @@ import org.olat.core.commons.services.commentAndRating.model.UserComment;
 import org.olat.core.id.Identity;
 import org.olat.group.BusinessGroup;
 import org.olat.group.context.BGContext;
-import org.olat.group.context.BGContextManagerImpl;
 import org.olat.portfolio.PortfolioModule;
 import org.olat.portfolio.manager.EPFrontendManager;
 import org.olat.portfolio.model.artefacts.AbstractArtefact;
@@ -49,6 +49,7 @@ import org.olat.portfolio.model.structel.EPStructuredMapTemplate;
 import org.olat.portfolio.model.structel.ElementType;
 import org.olat.portfolio.model.structel.PortfolioStructure;
 import org.olat.repository.RepositoryEntry;
+import org.olat.resource.OLATResource;
 
 /**
  * Description:<br>
@@ -457,11 +458,10 @@ public class OLATUpgrade_7_1_1 extends OLATUpgrade {
 	
 	private void migrateRepoEntrySecurityGroups(RepositoryEntry entry) {
 		BaseSecurity securityManager = BaseSecurityManager.getInstance();
-		BGContextManagerImpl contextManager = (BGContextManagerImpl)BGContextManagerImpl.getInstance();
 
-		List<BGContext> contexts = contextManager.findBGContextsForResource(entry.getOlatResource(), true, true);
+		List<BGContext> contexts = findBGContextsForResource(entry.getOlatResource(), true, true);
 		for(BGContext context:contexts) {
-			List<BusinessGroup> groups = contextManager.getGroupsOfBGContext(context);
+			List<BusinessGroup> groups = getGroupsOfBGContext(context);
 			for(BusinessGroup group:groups) {
 				//migrate tutors
 				if(group.getOwnerGroup() != null) {
@@ -501,13 +501,46 @@ public class OLATUpgrade_7_1_1 extends OLATUpgrade {
 		}
 	}
 	
+	private List<BusinessGroup> getGroupsOfBGContext(BGContext bgContext) {
+		String q = "select bg from org.olat.group.BusinessGroupImpl bg where bg.groupContext = :context";
+		DBQuery query = DBFactory.getInstance().createQuery(q);
+		query.setEntity("context", bgContext);
+		@SuppressWarnings("unchecked")
+		List<BusinessGroup> groups = query.list();
+		return groups;
+	}
+	
 	public List<RepositoryEntry> queryEntries(int firstResult) {
 		StringBuilder sb = new StringBuilder();
 		sb.append("select v from ").append(RepositoryEntry.class.getName()).append(" v inner join fetch v.olatResource as res order by v.key asc");
 		DBQuery dbquery = DBFactory.getInstance().createQuery(sb.toString());
 		dbquery.setFirstResult(firstResult);
 		dbquery.setMaxResults(REPO_ENTRIES_BATCH_SIZE);
-		return dbquery.list();
+		@SuppressWarnings("unchecked")
+		List<RepositoryEntry> entries = dbquery.list();
+		return entries;
+	}
+	
+	private List<BGContext> findBGContextsForResource(OLATResource resource, boolean defaultContexts, boolean nonDefaultContexts) {
+		DB db = DBFactory.getInstance();
+		StringBuilder q = new StringBuilder();
+		q.append(" select context from org.olat.group.context.BGContextImpl as context,");
+		q.append(" org.olat.group.context.BGContext2Resource as bgcr");
+		q.append(" where bgcr.resource = :resource");
+		q.append(" and bgcr.groupContext = context");
+
+		boolean checkDefault = defaultContexts != nonDefaultContexts;
+		if (checkDefault){
+			q.append(" and context.defaultContext = :isDefault");
+		}
+		DBQuery query = db.createQuery(q.toString());
+		query.setEntity("resource", resource);
+		if (checkDefault){
+			query.setBoolean("isDefault", defaultContexts ? true : false);
+		}
+		@SuppressWarnings("unchecked")
+		List<BGContext> contexts = query.list();
+		return contexts;
 	}
 
 	
diff --git a/src/test/java/org/olat/commons/lifecycle/LifeCycleManagerTest.java b/src/test/java/org/olat/commons/lifecycle/LifeCycleManagerTest.java
index 0b29399c885..28e25628b30 100644
--- a/src/test/java/org/olat/commons/lifecycle/LifeCycleManagerTest.java
+++ b/src/test/java/org/olat/commons/lifecycle/LifeCycleManagerTest.java
@@ -75,7 +75,7 @@ public class LifeCycleManagerTest extends OlatTestCase {
 		// identity with null User should be ok for test case
 		res = JunitTestHelper.createRandomResource();
 		identity = JunitTestHelper.createAndPersistIdentityAsUser("foo-" + UUID.randomUUID().toString());
-		group = businessGroupService.createBusinessGroup(identity, "a buddygroup", "a desc", BusinessGroup.TYPE_BUDDYGROUP, -1, -1, false, false, null);
+		group = businessGroupService.createBusinessGroup(identity, "a buddygroup", "a desc", -1, -1, false, false, null);
 	}
 	
 	/**
diff --git a/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java b/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java
index e131d2439cb..00f7bcb5a3a 100644
--- a/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java
+++ b/src/test/java/org/olat/course/groupsandrights/CourseGroupManagementTest.java
@@ -100,9 +100,9 @@ public class CourseGroupManagementTest extends OlatTestCase {
 		OLATResource course1 = JunitTestHelper.createRandomResource();
 
 		// create groups without waitinglist
-		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false,
+		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, 0, 10, false, false,
 				course1);
-		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false,
+		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, 0, 10, false, false,
 				course1);
 		// members
 		securityManager.addIdentityToSecurityGroup(id1, g2.getOwnerGroup());
@@ -112,9 +112,9 @@ public class CourseGroupManagementTest extends OlatTestCase {
 		securityManager.addIdentityToSecurityGroup(id3, g1.getOwnerGroup());
 
 		// groups
-		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false,
+		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, -1, -1, false, false,
 				course1);
-		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false,
+		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g4", null, -1, -1, false, false,
 				course1);
 		// members
 		securityManager.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
@@ -166,9 +166,9 @@ public class CourseGroupManagementTest extends OlatTestCase {
 		OLATResource course1 = JunitTestHelper.createRandomResource();
 
 		// create groups without waitinglist
-		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false,
+		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, 0, 10, false, false,
 				course1);
-		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false,
+		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, 0, 10, false, false,
 				course1);
 		// members
 		securityManager.addIdentityToSecurityGroup(id1, g2.getOwnerGroup());
@@ -186,9 +186,9 @@ public class CourseGroupManagementTest extends OlatTestCase {
 		areaManager.addBGToBGArea(g2, a3);
 
 		// groups
-		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false,
+		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, -1, -1, false, false,
 				course1);
-		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false,
+		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g4", null, -1, -1, false, false,
 				course1);
 		// members
 		securityManager.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
diff --git a/src/test/java/org/olat/course/nodes/en/EnrollmentManagerTest.java b/src/test/java/org/olat/course/nodes/en/EnrollmentManagerTest.java
index 7ef1e814ceb..3cf6beb59e3 100644
--- a/src/test/java/org/olat/course/nodes/en/EnrollmentManagerTest.java
+++ b/src/test/java/org/olat/course/nodes/en/EnrollmentManagerTest.java
@@ -117,7 +117,7 @@ public class EnrollmentManagerTest extends OlatTestCase implements WindowControl
 			OLATResource resource = JunitTestHelper.createRandomResource();
 			System.out.println("testAddToWaitingListAndFireEvent: resource=" + resource);
 			bgWithWaitingList = businessGroupService.createBusinessGroup(id1, bgWithWaitingListName,
-					bgWithWaitingListDesc, BusinessGroup.TYPE_LEARNINGROUP,  -1, -1, enableWaitinglist, enableAutoCloseRanks, resource);
+					bgWithWaitingListDesc, -1, -1, enableWaitinglist, enableAutoCloseRanks, resource);
 			bgWithWaitingList.setMaxParticipants(new Integer(2));
 			System.out.println("TEST bgWithWaitingList=" + bgWithWaitingList);
 			System.out.println("TEST bgWithWaitingList.getMaxParticipants()=" + bgWithWaitingList.getMaxParticipants() );
diff --git a/src/test/java/org/olat/group/test/BGRightManagerTest.java b/src/test/java/org/olat/group/test/BGRightManagerTest.java
index a143b5fb7e1..6a5e5204178 100644
--- a/src/test/java/org/olat/group/test/BGRightManagerTest.java
+++ b/src/test/java/org/olat/group/test/BGRightManagerTest.java
@@ -109,9 +109,9 @@ public class BGRightManagerTest extends OlatTestCase {
 		OLATResource c1 = JunitTestHelper.createRandomResource();
 		OLATResource c2 = JunitTestHelper.createRandomResource();
 
-		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c1);
-		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c1);
-		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
+		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, -1, -1, false, false, c1);
+		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, -1, -1, false, false, c1);
+		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, -1, -1, false, false, c2);
 
 		securityManager.addIdentityToSecurityGroup(id1, g1.getPartipiciantGroup());
 		securityManager.addIdentityToSecurityGroup(id2, g1.getPartipiciantGroup());
diff --git a/src/test/java/org/olat/group/test/BusinessGroupDAOTest.java b/src/test/java/org/olat/group/test/BusinessGroupDAOTest.java
index 3e4f5933bdb..0f5c4707716 100644
--- a/src/test/java/org/olat/group/test/BusinessGroupDAOTest.java
+++ b/src/test/java/org/olat/group/test/BusinessGroupDAOTest.java
@@ -1,18 +1,25 @@
 package org.olat.group.test;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.UUID;
 
 import junit.framework.Assert;
 
 import org.junit.After;
 import org.junit.Test;
+import org.olat.basesecurity.BaseSecurity;
 import org.olat.core.commons.persistence.DB;
 import org.olat.core.commons.persistence.DBFactory;
+import org.olat.core.id.Identity;
 import org.olat.core.logging.OLog;
 import org.olat.core.logging.Tracing;
 import org.olat.group.BusinessGroup;
 import org.olat.group.manager.BusinessGroupDAO;
 import org.olat.group.model.SearchBusinessGroupParams;
+import org.olat.group.properties.BusinessGroupPropertyManager;
+import org.olat.test.JunitTestHelper;
 import org.olat.test.OlatTestCase;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -28,6 +35,9 @@ public class BusinessGroupDAOTest extends OlatTestCase {
 	private BusinessGroupDAO businessGroupDao;
 	@Autowired
 	private DB dbInstance;
+	@Autowired
+	private BaseSecurity securityManager;
+
 	
 	@After
 	public void tearDown() throws Exception {
@@ -46,20 +56,598 @@ public class BusinessGroupDAOTest extends OlatTestCase {
 	
 	@Test
 	public void createBusinessGroup() {
-		BusinessGroup group = businessGroupDao.createAndPersist(null, "gdao", "gdao-desc", BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false);
+		BusinessGroup group = businessGroupDao.createAndPersist(null, "gdao", "gdao-desc", -1, -1, false, false, false, false, false);
+		dbInstance.commit();
+
 		Assert.assertNotNull(group);
+		Assert.assertNull(group.getMinParticipants());
+		Assert.assertNull(group.getMaxParticipants());
+		Assert.assertNotNull(group.getLastUsage());
+		Assert.assertNotNull(group.getCreationDate());
+		Assert.assertNotNull(group.getLastModified());
+		Assert.assertNotNull(group.getOwnerGroup());
+		Assert.assertNotNull(group.getPartipiciantGroup());
+		Assert.assertNotNull(group.getWaitingGroup());
+		Assert.assertEquals("gdao", group.getName());
+		Assert.assertEquals("gdao-desc", group.getDescription());
+		Assert.assertFalse(group.getWaitingListEnabled());
+		Assert.assertFalse(group.getAutoCloseRanksEnabled());
+	}
+	
+	@Test
+	public void loadBusinessGroupStandard() {
+		BusinessGroup group = businessGroupDao.createAndPersist(null, "gdbo", "gdbo-desc", -1, -1, false, false, false, false, false);
+		dbInstance.commitAndCloseSession();
 		
-		dbInstance.commit();
+		BusinessGroup reloadedGroup = businessGroupDao.load(group.getKey());
+		
+		Assert.assertNotNull(reloadedGroup);
+		Assert.assertNull(reloadedGroup.getMinParticipants());
+		Assert.assertNull(reloadedGroup.getMaxParticipants());
+		Assert.assertNotNull(reloadedGroup.getLastUsage());
+		Assert.assertNotNull(reloadedGroup.getCreationDate());
+		Assert.assertNotNull(reloadedGroup.getLastModified());
+		Assert.assertNotNull(reloadedGroup.getOwnerGroup());
+		Assert.assertNotNull(reloadedGroup.getPartipiciantGroup());
+		Assert.assertNotNull(reloadedGroup.getWaitingGroup());
+		Assert.assertEquals("gdbo", reloadedGroup.getName());
+		Assert.assertEquals("gdbo-desc", reloadedGroup.getDescription());
+		Assert.assertFalse(reloadedGroup.getWaitingListEnabled());
+		Assert.assertFalse(reloadedGroup.getAutoCloseRanksEnabled());
+	}
+	
+	@Test
+	public void loadBusinessGroup() {
+		//create business group
+		BusinessGroup group = businessGroupDao.createAndPersist(null, "gdco", "gdco-desc", 0, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		BusinessGroup reloadedGroup = businessGroupDao.load(group.getKey());
+		//check the saved values
+		Assert.assertNotNull(reloadedGroup);
+		Assert.assertNotNull(reloadedGroup.getMinParticipants());
+		Assert.assertNotNull(reloadedGroup.getMaxParticipants());
+		Assert.assertEquals(0, reloadedGroup.getMinParticipants().intValue());
+		Assert.assertEquals(10, reloadedGroup.getMaxParticipants().intValue());
+		Assert.assertNotNull(reloadedGroup.getLastUsage());
+		Assert.assertNotNull(reloadedGroup.getCreationDate());
+		Assert.assertNotNull(reloadedGroup.getLastModified());
+		Assert.assertNotNull(reloadedGroup.getOwnerGroup());
+		Assert.assertNotNull(reloadedGroup.getPartipiciantGroup());
+		Assert.assertNotNull(reloadedGroup.getWaitingGroup());
+		Assert.assertEquals("gdco", reloadedGroup.getName());
+		Assert.assertEquals("gdco-desc", reloadedGroup.getDescription());
+		Assert.assertTrue(reloadedGroup.getWaitingListEnabled());
+		Assert.assertTrue(reloadedGroup.getAutoCloseRanksEnabled());
+	}
+	
+	@Test
+	public void loadBusinessGroupWithOwner() {
+		Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("bdao-1-" + UUID.randomUUID().toString());
+		dbInstance.commitAndCloseSession();
+		
+		BusinessGroup group = businessGroupDao.createAndPersist(owner, "gddo", "gddo-desc", 0, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		BusinessGroup reloadedGroup = businessGroupDao.load(group.getKey());
+		//check if the owner is in the owner security group
+		Assert.assertNotNull(reloadedGroup);
+		Assert.assertNotNull(reloadedGroup.getOwnerGroup());
+		boolean isOwner = securityManager.isIdentityInSecurityGroup(owner, reloadedGroup.getOwnerGroup());
+		Assert.assertTrue(isOwner);
+	}
+	
+	@Test
+	public void loadBusinessGroupsByIds() {
+		Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("bdao-2-" + UUID.randomUUID().toString());
+		BusinessGroup group1 = businessGroupDao.createAndPersist(owner, "gdeo", "gdeo-desc", 0, 10, true, true, false, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(owner, "gdfo", "gdfo-desc", 0, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//check if the method is robust against empty list fo keys
+		List<BusinessGroup> groups1 = businessGroupDao.load(Collections.<Long>emptyList());
+		Assert.assertNotNull(groups1);
+		Assert.assertEquals(0, groups1.size());
+		
+		//check load 1 group
+		List<BusinessGroup> groups2 = businessGroupDao.load(Collections.singletonList(group1.getKey()));
+		Assert.assertNotNull(groups2);
+		Assert.assertEquals(1, groups2.size());
+		Assert.assertEquals(group1, groups2.get(0));
+		
+		//check load 2 groups
+		List<Long> groupKeys = new ArrayList<Long>(2);
+		groupKeys.add(group1.getKey());
+		groupKeys.add(group2.getKey());
+		List<BusinessGroup> groups3 = businessGroupDao.load(groupKeys);
+		Assert.assertNotNull(groups3);
+		Assert.assertEquals(2, groups3.size());
+		Assert.assertTrue(groups3.contains(group1));
+		Assert.assertTrue(groups3.contains(group2));
+	}
+	
+	@Test
+	public void loadAllBusinessGroups() {
+		Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("bdao-3-" + UUID.randomUUID().toString());
+		BusinessGroup group1 = businessGroupDao.createAndPersist(owner, "gdgo", "gdgo-desc", 0, 10, true, true, false, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(owner, "gdho", "gdho-desc", 0, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//load all business groups
+		List<BusinessGroup> allGroups = businessGroupDao.loadAll();
+		Assert.assertNotNull(allGroups);
+		Assert.assertTrue(allGroups.size() >= 2);
+		Assert.assertTrue(allGroups.contains(group1));
+		Assert.assertTrue(allGroups.contains(group2));
+	}
+
+	
+	@Test
+	public void mergeBusinessGroup() {
+		//create a business group
+		Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("bdao-3-" + UUID.randomUUID().toString());
+		BusinessGroup group = businessGroupDao.createAndPersist(owner, "gdho", "gdho-desc", 0, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//delete a business group
+		group.setAutoCloseRanksEnabled(false);
+		group.setName("gdho-2");
+
+		//merge business group
+		BusinessGroup mergedGroup = businessGroupDao.merge(group);
+		Assert.assertNotNull(mergedGroup);
+		Assert.assertEquals(group, mergedGroup);
+		Assert.assertEquals("gdho-2", mergedGroup.getName());
+		Assert.assertEquals(Boolean.FALSE, mergedGroup.getAutoCloseRanksEnabled());
+		
+		dbInstance.commitAndCloseSession();
+		
+		//reload the merged group and check values
+		BusinessGroup reloadedGroup = businessGroupDao.load(group.getKey());
+		Assert.assertNotNull(reloadedGroup);
+		Assert.assertEquals(group, reloadedGroup);
+		Assert.assertEquals("gdho-2", reloadedGroup.getName());
+		Assert.assertEquals(Boolean.FALSE, reloadedGroup.getAutoCloseRanksEnabled());
 	}
 	
 	@Test
-	public void loadBusinessGroups() {
+	public void updateBusinessGroup() {
+		//create a business group
+		Identity owner = JunitTestHelper.createAndPersistIdentityAsUser("bdao-4-" + UUID.randomUUID().toString());
+		BusinessGroup group = businessGroupDao.createAndPersist(owner, "gdio", "gdio-desc", 1, 10, true, true, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//delete a business group
+		group.setWaitingListEnabled(false);
+		group.setDescription("gdio-2-desc");
+
+		//update business group (semantic of Hibernate before JPA)
+		BusinessGroup updatedGroup = businessGroupDao.update(group);
+		Assert.assertNotNull(updatedGroup);
+		Assert.assertEquals(group, updatedGroup);
+		Assert.assertEquals("gdio-2-desc", updatedGroup.getDescription());
+		Assert.assertEquals(Boolean.FALSE, updatedGroup.getWaitingListEnabled());
+		Assert.assertTrue(updatedGroup == group);
+		
+		dbInstance.commitAndCloseSession();
+		
+		//reload the merged group and check values
+		BusinessGroup reloadedGroup = businessGroupDao.load(group.getKey());
+		Assert.assertNotNull(reloadedGroup);
+		Assert.assertEquals(group, reloadedGroup);
+		Assert.assertEquals("gdio-2-desc", reloadedGroup.getDescription());
+		Assert.assertEquals(Boolean.FALSE, reloadedGroup.getWaitingListEnabled());
+	}
+	
+	@Test
+	public void findBusinessGroupBySecurityGroup() {
+		//create 2 groups
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gdjo", "gdjo-desc", -1, -1, false, false, false, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdko", "gdko-desc", -1, -1, false, false, false, false, false);
+		dbInstance.commitAndCloseSession();
+
+		//check find by owner group
+		BusinessGroup byOwnerGroup = businessGroupDao.findBusinessGroup(group1.getOwnerGroup());
+		Assert.assertNotNull(byOwnerGroup);
+		Assert.assertEquals(group1, byOwnerGroup);
+		Assert.assertNotSame(group2, byOwnerGroup);
+
+		//check find by participant group
+		BusinessGroup byParticipantGroup = businessGroupDao.findBusinessGroup(group1.getPartipiciantGroup());
+		Assert.assertNotNull(byParticipantGroup);
+		Assert.assertEquals(group1, byParticipantGroup);
+		
+		//check find by waiting group
+		BusinessGroup byWaitingGroup = businessGroupDao.findBusinessGroup(group2.getWaitingGroup());
+		Assert.assertNotNull(byWaitingGroup);
+		Assert.assertEquals(group2, byWaitingGroup);
+		Assert.assertNotSame(group1, byWaitingGroup);
+		
+	}
+	
+	@Test
+	public void findBusinessGroupsWithWaitingListAttendedBy() {
+		//3 identities
+		Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser("bdao-5-" + UUID.randomUUID().toString());
+		Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser("bdao-6-" + UUID.randomUUID().toString());
+		Identity id3 = JunitTestHelper.createAndPersistIdentityAsUser("bdao-7-" + UUID.randomUUID().toString());
+
+		//create 3 groups
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gdlo", "gdlo-desc", 0, 5, true, false, false, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdmo", "gdmo-desc", 0, 5, true, false, false, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "gdno", "gdno-desc", 0, 5, true, false, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//id1 -> group 1 and 2
+		securityManager.addIdentityToSecurityGroup(id1, group1.getWaitingGroup());
+		securityManager.addIdentityToSecurityGroup(id1, group2.getWaitingGroup());
+		//id2 -> group 1 and 3
+		securityManager.addIdentityToSecurityGroup(id2, group1.getWaitingGroup());
+		securityManager.addIdentityToSecurityGroup(id2, group3.getWaitingGroup());
+
+		//check:
+		//id1: group 1 and 2
+		List<BusinessGroup> groupOfId1 = businessGroupDao.findBusinessGroupsWithWaitingListAttendedBy(id1,  null);
+		Assert.assertNotNull(groupOfId1);
+		Assert.assertTrue(groupOfId1.contains(group1));
+		Assert.assertTrue(groupOfId1.contains(group2));
+		//id2 -> group 1 and 3
+		List<BusinessGroup> groupOfId2 = businessGroupDao.findBusinessGroupsWithWaitingListAttendedBy(id2,  null);
+		Assert.assertNotNull(groupOfId2);
+		Assert.assertTrue(groupOfId2.contains(group1));
+		Assert.assertTrue(groupOfId2.contains(group3));
+
+		List<BusinessGroup> groupOfId3 = businessGroupDao.findBusinessGroupsWithWaitingListAttendedBy(id3,  null);
+		Assert.assertNotNull(groupOfId3);
+		Assert.assertTrue(groupOfId3.isEmpty());
+	}
+	
+	@Test
+	public void testVisibilityOfSecurityGroups() {
+		//create 3 groups
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gdro", "gdro-desc", 0, 5, true, false, true, true, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdso", "gdso-desc", 0, 5, true, false, false, true, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "gdto", "gdto-desc", 0, 5, true, false, false, false, true);
+		dbInstance.commitAndCloseSession();
+		
+		//check the value
+		BusinessGroupPropertyManager bgpm1 = new BusinessGroupPropertyManager(group1);
+		Assert.assertTrue(bgpm1.showOwners());
+		Assert.assertTrue(bgpm1.showPartips());
+		Assert.assertFalse(bgpm1.showWaitingList());
+		
+		BusinessGroupPropertyManager bgpm2 = new BusinessGroupPropertyManager(group2);
+		Assert.assertFalse(bgpm2.showOwners());
+		Assert.assertTrue(bgpm2.showPartips());
+		Assert.assertFalse(bgpm2.showWaitingList());
+		
+		BusinessGroupPropertyManager bgpm3 = new BusinessGroupPropertyManager(group3);
+		Assert.assertFalse(bgpm3.showOwners());
+		Assert.assertFalse(bgpm3.showPartips());
+		Assert.assertTrue(bgpm3.showWaitingList());
+	}
+	
+	@Test
+	public void testContacts() {
+		//5 identities
+		Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser("cdao-1-" + UUID.randomUUID().toString());
+		Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser("cdao-2-" + UUID.randomUUID().toString());
+		Identity id3 = JunitTestHelper.createAndPersistIdentityAsUser("cdao-3-" + UUID.randomUUID().toString());
+		Identity id4 = JunitTestHelper.createAndPersistIdentityAsUser("cdao-4-" + UUID.randomUUID().toString());
+		Identity id5 = JunitTestHelper.createAndPersistIdentityAsUser("cdao-5-" + UUID.randomUUID().toString());
+		//create 3 groups
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gdlo", "gdlo-desc", 0, 5, true, false, true, true, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdmo", "gdmo-desc", 0, 5, true, false, false, true, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "gdno", "gdno-desc", 0, 5, true, false, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//id1 -> group 1 and 2
+		securityManager.addIdentityToSecurityGroup(id1, group1.getOwnerGroup());
+		securityManager.addIdentityToSecurityGroup(id1, group2.getPartipiciantGroup());
+		//id2 -> group 1 and 2
+		securityManager.addIdentityToSecurityGroup(id2, group1.getPartipiciantGroup());
+		securityManager.addIdentityToSecurityGroup(id2, group2.getOwnerGroup());
+		//id3 -> group 1 and 3
+		securityManager.addIdentityToSecurityGroup(id3, group1.getPartipiciantGroup());
+		securityManager.addIdentityToSecurityGroup(id3, group3.getPartipiciantGroup());
+		//id4 -> group 2
+		securityManager.addIdentityToSecurityGroup(id4, group2.getOwnerGroup());
+		//id5 -> group 3
+		securityManager.addIdentityToSecurityGroup(id5, group3.getOwnerGroup());
+		dbInstance.commitAndCloseSession();	
+		
+		//check identity1 : contact to id2 and id3
+		int numOfContact1 = businessGroupDao.countContacts(id1);
+		Assert.assertEquals(2, numOfContact1);
+		List<Identity> contactList1 = businessGroupDao.findContacts(id1, 0, -1);
+		Assert.assertEquals(2, contactList1.size());
+		Assert.assertTrue(contactList1.contains(id2));
+		Assert.assertTrue(contactList1.contains(id3));
+		
+		//check identity2 : contact to id1 and id3
+		int numOfContact2 = businessGroupDao.countContacts(id2);
+		Assert.assertEquals(2, numOfContact2);
+		List<Identity> contactList2 = businessGroupDao.findContacts(id2, 0, -1);
+		Assert.assertEquals(2, contactList2.size());
+		Assert.assertTrue(contactList2.contains(id1));
+		Assert.assertTrue(contactList2.contains(id3));
+		
+		//check identity3 : contact to id1 and id2
+		int numOfContact3 = businessGroupDao.countContacts(id3);
+		Assert.assertEquals(2, numOfContact3);
+		List<Identity> contactList3 = businessGroupDao.findContacts(id3, 0, -1);
+		Assert.assertEquals(2, contactList3.size());
+		Assert.assertTrue(contactList3.contains(id1));
+		Assert.assertTrue(contactList3.contains(id2));
+		
+		//check identity4 : contact to id1
+		int numOfContact4 = businessGroupDao.countContacts(id4);
+		Assert.assertEquals(1, numOfContact4);//!!! ne marche pas
+		List<Identity> contactList4 = businessGroupDao.findContacts(id4, 0, -1);
+		Assert.assertEquals(1, contactList4.size());
+		Assert.assertTrue(contactList4.contains(id1));
+		
+		//check identity5 : contact to id2
+		int numOfContact5 = businessGroupDao.countContacts(id5);
+		Assert.assertEquals(0, numOfContact5);
+		List<Identity> contactList5 = businessGroupDao.findContacts(id5, 0, -1);
+		Assert.assertEquals(0, contactList5.size());
+	}
+	
+	@Test
+	public void testContactsWithMoreExclusions() {
+		//5 identities
+		Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-1-" + UUID.randomUUID().toString());
+		Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-2-" + UUID.randomUUID().toString());
+		Identity id3 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-3-" + UUID.randomUUID().toString());
+		Identity id4 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-4-" + UUID.randomUUID().toString());
+		Identity id5 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-5-" + UUID.randomUUID().toString());
+		//create 3 groups
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gdoo", "gdoo-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdpo", "gdpo-desc", 0, 5, true, false, false, true, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "gdqo", "gdqo-desc", 0, 5, true, false, false, false, false);
+		dbInstance.commitAndCloseSession();
+		
+		//id1 -> group 1 and 2
+		securityManager.addIdentityToSecurityGroup(id1, group1.getOwnerGroup());				//visible
+		securityManager.addIdentityToSecurityGroup(id1, group2.getPartipiciantGroup());	//visible
+		//id2 -> group 1 and 2
+		securityManager.addIdentityToSecurityGroup(id2, group1.getPartipiciantGroup()); //not
+		securityManager.addIdentityToSecurityGroup(id2, group2.getOwnerGroup());        //not
+		//id3 -> group 1 and 3
+		securityManager.addIdentityToSecurityGroup(id3, group2.getOwnerGroup());        //not
+		securityManager.addIdentityToSecurityGroup(id3, group3.getPartipiciantGroup()); //not
+		//id4 -> group 2
+		securityManager.addIdentityToSecurityGroup(id4, group2.getOwnerGroup());        //not
+		securityManager.addIdentityToSecurityGroup(id4, group3.getOwnerGroup());        //not
+		//id5 -> group 3
+		securityManager.addIdentityToSecurityGroup(id5, group3.getOwnerGroup());        //not
+		dbInstance.commitAndCloseSession();	
+		
+		//check identity1 : contact to id2 and id3
+		int numOfContact1 = businessGroupDao.countContacts(id1);
+		Assert.assertEquals(0, numOfContact1);
+		List<Identity> contactList1 = businessGroupDao.findContacts(id1, 0, -1);
+		Assert.assertEquals(0, contactList1.size());
+		
+		//check identity2 : contact to id1 and id3
+		int numOfContact2 = businessGroupDao.countContacts(id2);
+		Assert.assertEquals(1, numOfContact2);
+		List<Identity> contactList2 = businessGroupDao.findContacts(id2, 0, -1);
+		Assert.assertEquals(1, contactList2.size());
+		Assert.assertTrue(contactList2.contains(id1));
+		
+		//check identity3 : contact to id1 and id2
+		int numOfContact3 = businessGroupDao.countContacts(id3);
+		Assert.assertEquals(1, numOfContact3);
+		List<Identity> contactList3 = businessGroupDao.findContacts(id3, 0, -1);
+		Assert.assertEquals(1, contactList3.size());
+		Assert.assertTrue(contactList3.contains(id1));
+		
+		//check identity4 : contact to id1
+		int numOfContact4 = businessGroupDao.countContacts(id4);
+		Assert.assertEquals(1, numOfContact4);//!!! ne marche pas
+		List<Identity> contactList4 = businessGroupDao.findContacts(id4, 0, -1);
+		Assert.assertEquals(1, contactList4.size());
+		Assert.assertTrue(contactList4.contains(id1));
+		
+		//check identity5 : contact to id2
+		int numOfContact5 = businessGroupDao.countContacts(id5);
+		Assert.assertEquals(0, numOfContact5);
+		List<Identity> contactList5 = businessGroupDao.findContacts(id5, 0, -1);
+		Assert.assertEquals(0, contactList5.size());
+	}
+
+	@Test
+	public void findBusinessGroups() {
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "gduo", "gduo-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "gdvo", "gdvo-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
 		SearchBusinessGroupParams params = new SearchBusinessGroupParams(); 
 		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
 		Assert.assertNotNull(groups);
-		
+		Assert.assertTrue(groups.size() >= 2);
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
 
 		dbInstance.commit();
+
+		List<BusinessGroup> groupLimit = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, 1);
+		Assert.assertNotNull(groupLimit);
+		Assert.assertEquals(1, groupLimit.size());
+	}
+	
+	@Test
+	public void findBusinessGroupsByExactName() {
+		String exactName = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, exactName, "gdwo-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, exactName + "x", "gdxo-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "y" +exactName, "gdyo-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setExactName(exactName);
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(1, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertFalse(groups.contains(group2));
+		Assert.assertFalse(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByName() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, name.toUpperCase(), "fingbg-1-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, name + "xxx", "fingbg-2-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "yyy" + name.toUpperCase(), "fingbg-3-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setName(name);
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(2, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
+		Assert.assertFalse(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByNameFuzzy() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, name.toUpperCase(), "fingbg-1-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, name + "xxx", "fingbg-2-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "yyy" + name.toUpperCase(), "fingbg-3-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setName("*" + name + "*");
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(3, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByDescription() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "fingbg-1", name.toUpperCase() + "-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "fingbg-2", "desc-" + name, 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "fingbg-3", "desc-" + name + "-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setDescription(name);
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(1, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertFalse(groups.contains(group2));
+		Assert.assertFalse(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByDescriptionFuzzy() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "fingbg-1", name + "-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "fingbg-2", "desc-" + name.toUpperCase(), 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "fingbg-3", "desc-" + name + "-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setDescription("*" + name + "*");
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(3, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByNameOrDesc() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "fingbg-1", name.toUpperCase() + "-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "fingbg-2", "fingbg-2-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, name.toUpperCase() + "-xxx", "desc-fingb-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setNameOrDesc(name);
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(2, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertFalse(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
 	}
+	
+	@Test
+	public void findBusinessGroupsByNameOrDescFuzzy() {
+		String name = UUID.randomUUID().toString();
+		BusinessGroup group1 = businessGroupDao.createAndPersist(null, "fingbg-1", name + "-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(null, "fingbg-2", "desc-" + name.toUpperCase(), 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(null, "fingbg-3", "desc-" + name + "-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setNameOrDesc("*" + name + "*");
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(3, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByOwner() {
+		//5 identities
+		String name = UUID.randomUUID().toString();
+		Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser(name);
+		Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-2-" + name);
+		Identity id3 = JunitTestHelper.createAndPersistIdentityAsUser(name + "-ddao-3");
+
+		BusinessGroup group1 = businessGroupDao.createAndPersist(id1, "fingbgown-1", "fingbgown-1-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(id2, "fingbgown-2", "fingbgown-2-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(id3, "fingbgown-3", "fingbgown-3-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setOwner(name);
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(2, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertFalse(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
+	}
+	
+	@Test
+	public void findBusinessGroupsByOwnerFuzzy() {
+		String name = UUID.randomUUID().toString();
+		Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser(name);
+		Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser("ddao-2-" + name.toUpperCase());
+		Identity id3 = JunitTestHelper.createAndPersistIdentityAsUser(name + "-ddao-3-");
+		
+		BusinessGroup group1 = businessGroupDao.createAndPersist(id1, "fingbg-own-1-1", "fingbg-own-1-1-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group2 = businessGroupDao.createAndPersist(id2, "fingbg-own-1-2", "fingbg-own-1-2-desc", 0, 5, true, false, true, false, false);
+		BusinessGroup group3 = businessGroupDao.createAndPersist(id3, "fingbg-own-1-3", "fingbg-own-1-3-desc", 0, 5, true, false, true, false, false);
+		dbInstance.commitAndCloseSession();
+
+		SearchBusinessGroupParams params = new SearchBusinessGroupParams();
+		params.setOwner("*" + name + "*");
+		List<BusinessGroup> groups = businessGroupDao.findBusinessGroups(params, null, false, false, null, 0, -1);
+		Assert.assertNotNull(groups);
+		Assert.assertEquals(3, groups.size() );
+		Assert.assertTrue(groups.contains(group1));
+		Assert.assertTrue(groups.contains(group2));
+		Assert.assertTrue(groups.contains(group3));
+	}
+	
 
 }
diff --git a/src/test/java/org/olat/group/test/BusinessGroupRelationDAOTest.java b/src/test/java/org/olat/group/test/BusinessGroupRelationDAOTest.java
new file mode 100644
index 00000000000..c02fff351c0
--- /dev/null
+++ b/src/test/java/org/olat/group/test/BusinessGroupRelationDAOTest.java
@@ -0,0 +1,33 @@
+package org.olat.group.test;
+
+public class BusinessGroupRelationDAOTest {
+	
+	/*
+	 	//
+	public boolean isIdentityInBusinessGroup(Identity identity, String name, OLATResource resource) 
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, OLATResource resource) 
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, List<Long> resourceKeys) 
+	
+	public boolean checkIfOneOrMoreNameExistsInContext(Set<String> names, BusinessGroup group) 
+	
+	
+	check with resources
+	//findBusinessGroupsWithWaitingListAttendedBy
+	 * 	public int countBusinessGroups(SearchBusinessGroupParams params, Identity identity,
+			boolean ownedById, boolean attendedById, OLATResource resource)
+	
+	public List<BusinessGroup> findBusinessGroups(SearchBusinessGroupParams params, Identity identity,
+			boolean ownedById, boolean attendedById, OLATResource resource, int firstResult, int maxResults)
+
+
+public int countMembersOf(OLATResource resource, boolean owner, boolean attendee)
+
+	public List<Identity> getMembersOf(OLATResource resource, boolean owner, boolean attendee)
+	
+	
+	
+	 */
+
+}
diff --git a/src/test/java/org/olat/group/test/BusinessGroupServiceImplTest.java b/src/test/java/org/olat/group/test/BusinessGroupServiceImplTest.java
index 2a09de602cb..4a8498bff15 100644
--- a/src/test/java/org/olat/group/test/BusinessGroupServiceImplTest.java
+++ b/src/test/java/org/olat/group/test/BusinessGroupServiceImplTest.java
@@ -26,14 +26,6 @@
 
 package org.olat.group.test;
 
-// um click emulieren:
-/*
- * 1) generiere Persistentes Object 2) -> DB...evict() entferne Instanz aus
- * HibernateSession 3) aktionen testen, z.b. update failed, falls object nicht
- * in session
- */
-// DB.getInstance().evict();
-// DB.getInstance().loadObject(); püft ob schon in hibernate session.
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -56,14 +48,8 @@ import org.olat.basesecurity.SecurityGroupImpl;
 import org.olat.collaboration.CollaborationTools;
 import org.olat.collaboration.CollaborationToolsFactory;
 import org.olat.core.commons.persistence.DBFactory;
-import org.olat.core.gui.components.Component;
-import org.olat.core.gui.control.WindowBackOffice;
-import org.olat.core.gui.control.WindowControl;
-import org.olat.core.gui.control.generic.dtabs.DTabs;
-import org.olat.core.gui.control.info.WindowControlInfo;
 import org.olat.core.id.Identity;
 import org.olat.core.id.User;
-import org.olat.core.id.context.BusinessControl;
 import org.olat.core.util.Encoder;
 import org.olat.group.BusinessGroup;
 import org.olat.group.BusinessGroupService;
@@ -75,13 +61,13 @@ import org.olat.user.UserManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
- * Description: <BR/>TODO: Class Description for BusinessGroupManagerImplTest
+ * Description: <BR/>
  * <P/> Initial Date: Jul 28, 2004
  * 
- * @author patrick
+ * @author patrick, srosse
  */
 
-public class BusinessGroupServiceImplTest extends OlatTestCase implements WindowControl {
+public class BusinessGroupServiceImplTest extends OlatTestCase {
 	//
 	private static Logger log = Logger.getLogger(BusinessGroupServiceImplTest.class.getName());
 	/*
@@ -144,35 +130,35 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 			id3 = JunitTestHelper.createAndPersistIdentityAsUser("id3");
 			id4 = JunitTestHelper.createAndPersistIdentityAsUser("id4");
 			// buddyGroups without waiting-list: groupcontext is null
-			List<BusinessGroup> l = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id1, null);
+			List<BusinessGroup> l = businessGroupService.findBusinessGroupsOwnedBy(id1, null);
 			if (l.size() == 0) {
-				one = businessGroupService.createBusinessGroup(id1, oneName, oneDesc, BusinessGroup.TYPE_BUDDYGROUP, -1, -1, false, false, null);
+				one = businessGroupService.createBusinessGroup(id1, oneName, oneDesc, -1, -1, false, false, null);
 			} else {
-				List<BusinessGroup> groups = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id1, null);
+				List<BusinessGroup> groups = businessGroupService.findBusinessGroupsOwnedBy(id1, null);
 				for(BusinessGroup group:groups) {
 					if(oneName.equals(group.getName())) {
 						one = group;
 					}
 				}
 			}
-			l = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+			l = businessGroupService.findBusinessGroupsOwnedBy(id2, null);
 			if (l.size() == 0) {
-				two = businessGroupService.createBusinessGroup(id2, twoName, twoDesc, BusinessGroup.TYPE_BUDDYGROUP, -1, -1, false, false, null);
+				two = businessGroupService.createBusinessGroup(id2, twoName, twoDesc, -1, -1, false, false, null);
 				SecurityGroup twoPartips = two.getPartipiciantGroup();
 				BaseSecurityManager.getInstance().addIdentityToSecurityGroup(id3, twoPartips);
 				BaseSecurityManager.getInstance().addIdentityToSecurityGroup(id4, twoPartips);
 			} else {
-				two = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null).get(0);
+				two = businessGroupService.findBusinessGroupsOwnedBy(id2, null).get(0);
 			}
-			l = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id3, null);
+			l = businessGroupService.findBusinessGroupsOwnedBy(id3, null);
 			if (l.size() == 0) {
-				three = businessGroupService.createBusinessGroup(id3, threeName, threeDesc, BusinessGroup.TYPE_BUDDYGROUP, -1, -1, false, false, null);
+				three = businessGroupService.createBusinessGroup(id3, threeName, threeDesc, -1, -1, false, false, null);
 				SecurityGroup threeOwner = three.getOwnerGroup();
 				SecurityGroup threeOPartips = three.getPartipiciantGroup();
 				BaseSecurityManager.getInstance().addIdentityToSecurityGroup(id2, threeOPartips);
 				BaseSecurityManager.getInstance().addIdentityToSecurityGroup(id1, threeOwner);
 			} else {
-				three = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id3, null).get(0);
+				three = businessGroupService.findBusinessGroupsOwnedBy(id3, null).get(0);
 			}
 			/*
 			 * Membership in ParticipiantGroups............................. id1
@@ -191,7 +177,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 			OLATResource resource = JunitTestHelper.createRandomResource();
 			System.out.println("testAddToWaitingListAndFireEvent: resource=" + resource);
 			bgWithWaitingList = businessGroupService.createBusinessGroup(id1, bgWithWaitingListName,
-					bgWithWaitingListDesc, BusinessGroup.TYPE_LEARNINGROUP, -1, -1, enableWaitinglist, enableAutoCloseRanks, resource);
+					bgWithWaitingListDesc, -1, -1, enableWaitinglist, enableAutoCloseRanks, resource);
 			bgWithWaitingList.setMaxParticipants(new Integer(2));
 			// Identities
 			String suffix = UUID.randomUUID().toString();
@@ -229,11 +215,11 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		BusinessGroup[] ctxBgroups = new BusinessGroup[namesInCtxB.length];
 
 		for (int i = 0; i < namesInCtxA.length; i++) {
-			ctxAgroups[i] = businessGroupService.createBusinessGroup(id1, namesInCtxA[i], null, BusinessGroup.TYPE_LEARNINGROUP, 0, 0, false,
+			ctxAgroups[i] = businessGroupService.createBusinessGroup(id1, namesInCtxA[i], null, 0, 0, false,
 					false, ctxA);
 		}
 		for (int i = 0; i < namesInCtxB.length; i++) {
-			ctxBgroups[i] = businessGroupService.createBusinessGroup(id1, namesInCtxB[i], null, BusinessGroup.TYPE_LEARNINGROUP, 0, 0, false,
+			ctxBgroups[i] = businessGroupService.createBusinessGroup(id1, namesInCtxB[i], null, 0, 0, false,
 					false, ctxB);
 		}
 		// first click created two context and each of them containg groups
@@ -321,7 +307,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		/*
 		 * id1
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id1, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id1, null);
 		assertTrue("2 BuddyGroups owned by id1", sqlRes.size() == 2);
 		for (int i = 0; i < sqlRes.size(); i++) {
 			assertTrue("It's a BuddyGroup Object", sqlRes.get(i) instanceof BusinessGroup);
@@ -331,19 +317,19 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 			assertTrue("It's the correct BuddyGroup", ok);
 
 		}
-		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(BusinessGroup.TYPE_BUDDYGROUP, id1, null);
+		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(id1, null);
 		assertTrue("0 BuddyGroup where id1 is partipicating", sqlRes.size() == 0);
 
 		/*
 		 * id2
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id2, null);
 		assertTrue("1 BuddyGroup owned by id2", sqlRes.size() == 1);
 		assertTrue("It's a BuddyGroup Object", sqlRes.get(0) instanceof BusinessGroup);
 		found = (BusinessGroup) sqlRes.get(0);
 		// equality by comparing PersistenObject.getKey()!!!
 		assertTrue("It's the correct BuddyGroup", two.getKey().longValue() == found.getKey().longValue());
-		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(id2, null);
 		assertTrue("1 BuddyGroup where id2 is partipicating", sqlRes.size() == 1);
 		assertTrue("It's a BuddyGroup Object", sqlRes.get(0) instanceof BusinessGroup);
 		found = (BusinessGroup) sqlRes.get(0);
@@ -352,13 +338,13 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		/*
 		 * id3
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id3, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id3, null);
 		assertTrue("1 BuddyGroup owned by id3", sqlRes.size() == 1);
 		assertTrue("It's a BuddyGroup Object", sqlRes.get(0) instanceof BusinessGroup);
 		found = (BusinessGroup) sqlRes.get(0);
 		// equality by comparing PersistenObject.getKey()!!!
 		assertTrue("It's the correct BuddyGroup", three.getKey().longValue() == found.getKey().longValue());
-		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(BusinessGroup.TYPE_BUDDYGROUP, id3, null);
+		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(id3, null);
 		assertTrue("1 BuddyGroup where id3 is partipicating", sqlRes.size() == 1);
 		assertTrue("It's a BuddyGroup Object", sqlRes.get(0) instanceof BusinessGroup);
 		found = (BusinessGroup) sqlRes.get(0);
@@ -367,10 +353,10 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		/*
 		 * id4
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id4, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id4, null);
 		assertTrue("0 BuddyGroup owned by id4", sqlRes.size() == 0);
 		//
-		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(BusinessGroup.TYPE_BUDDYGROUP, id4, null);
+		sqlRes = businessGroupService.findBusinessGroupsAttendedBy(id4, null);
 		assertTrue("1 BuddyGroup where id4 is partipicating", sqlRes.size() == 1);
 		assertTrue("It's a BuddyGroup Object", sqlRes.get(0) instanceof BusinessGroup);
 		found = (BusinessGroup) sqlRes.get(0);
@@ -399,7 +385,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		/*
 		 * id2
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id2, null);
 		found = (BusinessGroup) sqlRes.get(0);
 		CollaborationTools myCTSMngr = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(found);
 		for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
@@ -455,7 +441,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		/*
 		 * id2
 		 */
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id2, null);
 		assertTrue("1 BuddyGroup owned by id2", sqlRes.size() == 1);
 		found = (BusinessGroup) sqlRes.get(0);
 		CollaborationTools myCTSMngr = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(found);
@@ -467,7 +453,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		 * 
 		 */
 		businessGroupService.deleteBusinessGroup(found);
-		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, id2, null);
+		sqlRes = businessGroupService.findBusinessGroupsOwnedBy(id2, null);
 		assertTrue("0 BuddyGroup owned by id2", sqlRes.size() == 0);
 		/*
 		 * 
@@ -596,7 +582,7 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 		OLATResource resource = JunitTestHelper.createRandomResource();
 
 		BusinessGroup deleteTestGroup = businessGroupService.createBusinessGroup(id1, "deleteTestGroup-1",
-				"deleteTestGroup-1", BusinessGroup.TYPE_LEARNINGROUP, -1, -1, withWaitingList, true, resource);
+				"deleteTestGroup-1", -1, -1, withWaitingList, true, resource);
 		
 		Long ownerGroupKey = deleteTestGroup.getOwnerGroup().getKey();
 		Long partipiciantGroupKey = deleteTestGroup.getPartipiciantGroup().getKey();
@@ -626,40 +612,4 @@ public class BusinessGroupServiceImplTest extends OlatTestCase implements Window
 			log.error("tearDown failed: ", e);
 		}
 	}
-
-
-
-	// Implements interface WindowControl
-	// ///////////////////////////////////
-	public void pushToMainArea(Component comp) {};
-
-	public void pushAsModalDialog(Component comp) {};
-
-	public void pop() {};
-
-	public void setInfo(String string) {};
-
-	public void setError(String string) {};
-
-	public void setWarning(String string) {};
-
-	public DTabs getDTabs() {
-		return null;
-	};
-
-	public WindowControlInfo getWindowControlInfo() {
-		return null;
-	};
-
-	public void makeFlat() {};
-
-	public BusinessControl getBusinessControl() {
-		return null;
-	}
-
-	public WindowBackOffice getWindowBackOffice() {
-		// TODO Auto-generated method stub
-		return null;
-	};
-
 }
\ No newline at end of file
diff --git a/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java b/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java
index f299392adad..1890c1e0dd6 100644
--- a/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java
+++ b/src/test/java/org/olat/group/test/BusinessGroupServiceTest.java
@@ -52,14 +52,14 @@ public class BusinessGroupServiceTest extends OlatTestCase {
 	
 	@Test
 	public void createBusinessGroup() {
-		BusinessGroup group = businessGroupService.createBusinessGroup(null, "gdao", "gdao-desc", BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, null);
+		BusinessGroup group = businessGroupService.createBusinessGroup(null, "gdao", "gdao-desc", -1, -1, false, false, null);
 		Assert.assertNotNull(group);
 	}
 	
 	@Test
 	public void createBusinessGroupWithResource() {
 		OLATResource resource =  JunitTestHelper.createRandomResource();
-		BusinessGroup group = businessGroupService.createBusinessGroup(null, "gdao", "gdao-desc", BusinessGroup.TYPE_LEARNINGROUP, -1, -1, false, false, resource);
+		BusinessGroup group = businessGroupService.createBusinessGroup(null, "gdao", "gdao-desc", -1, -1, false, false, resource);
 		
 		//commit the group
 		dbInstance.commit();
@@ -84,24 +84,21 @@ public class BusinessGroupServiceTest extends OlatTestCase {
 		assertTrue(businessGroupService.countBusinessGroups(null, null, false, false, c1) == 0);
 
 		DBFactory.getInstance().closeSession(); // simulate user clicks
-		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+		BusinessGroup g1 = businessGroupService.createBusinessGroup(null, "g1", null, 0, 10, false, false, c1);
 		assertNotNull(g1);
-		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+		BusinessGroup g2 = businessGroupService.createBusinessGroup(null, "g2", null, 0, 10, false, false, c1);
 		assertNotNull(g2);
-		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c2);
+		BusinessGroup g3 = businessGroupService.createBusinessGroup(null, "g3", null, 0, 10, false, false, c2);
 		assertNotNull(g3);
 
-		BusinessGroup g2douplicate = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+		BusinessGroup g2douplicate = businessGroupService.createBusinessGroup(null, "g2", null, 0, 10, false, false, c1);
 		assertNull(g2douplicate); // name duplicate names allowed per group context
 
-		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c2);
+		BusinessGroup g4 = businessGroupService.createBusinessGroup(null, "g2", null, 0, 10, false, false, c2);
 		assertNotNull(g4); // name duplicate in other context allowed
 
 		DBFactory.getInstance().closeSession(); // simulate user clicks
 		Assert.assertEquals(2, businessGroupService.findBusinessGroups(null, null, false, false, c1, 0, -1).size());
 		Assert.assertEquals(2, businessGroupService.countBusinessGroups(null, null, false, false, c1));
 	}
-
-	
-
-}
+}
\ No newline at end of file
diff --git a/src/test/java/org/olat/properties/PropertyTest.java b/src/test/java/org/olat/properties/PropertyTest.java
index 7cc4c6aae80..155c0066c22 100644
--- a/src/test/java/org/olat/properties/PropertyTest.java
+++ b/src/test/java/org/olat/properties/PropertyTest.java
@@ -84,9 +84,9 @@ public class PropertyTest extends OlatTestCase {
 				id4 = JunitTestHelper.createAndPersistIdentityAsUser("drp-" + UUID.randomUUID().toString());
 				res = JunitTestHelper.createRandomResource();
 
-				List<BusinessGroup> l = businessGroupService.findBusinessGroupsOwnedBy(BusinessGroup.TYPE_BUDDYGROUP, identity, null);
+				List<BusinessGroup> l = businessGroupService.findBusinessGroupsOwnedBy(identity, null);
 				if (l.size() == 0) {
-					group = businessGroupService.createBusinessGroup(identity, "a buddygroup", "a desc", BusinessGroup.TYPE_BUDDYGROUP, -1, -1, false, false, null);
+					group = businessGroupService.createBusinessGroup(identity, "a buddygroup", "a desc", -1, -1, false, false, null);
 				} else {
 					group =  (BusinessGroup) l.get(0);
 				}
diff --git a/src/test/java/org/olat/restapi/ContactsTest.java b/src/test/java/org/olat/restapi/ContactsTest.java
index 47c636082ff..0c3b13a758c 100644
--- a/src/test/java/org/olat/restapi/ContactsTest.java
+++ b/src/test/java/org/olat/restapi/ContactsTest.java
@@ -118,8 +118,8 @@ public class ContactsTest extends OlatJerseyTestCase {
 	    // 1) context one: learning groups
 	    OLATResource c1 = JunitTestHelper.createRandomResource();
 	    // create groups without waiting list
-	    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, BusinessGroup.TYPE_LEARNINGROUP, new Integer(0), new Integer(10), false, false, c1);
-	    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, BusinessGroup.TYPE_LEARNINGROUP, new Integer(0), new Integer(10), false, false, c1);
+	    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, new Integer(0), new Integer(10), false, false, c1);
+	    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, new Integer(0), new Integer(10), false, false, c1);
 	    
 	    //permission to see owners and participants
 	    BusinessGroupPropertyManager bgpm1 = new BusinessGroupPropertyManager(g1);
@@ -141,8 +141,8 @@ public class ContactsTest extends OlatJerseyTestCase {
 	    // 2) context two: right groups
 	    OLATResource c2 = JunitTestHelper.createRandomResource();
 	    // groups
-	    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
-	    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
+	    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, -1, -1, false, false, c2);
+	    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, -1, -1, false, false, c2);
 	    // members -> default participants are visible
 	    secm.addIdentityToSecurityGroup(owner1, g3.getPartipiciantGroup());
 	    secm.addIdentityToSecurityGroup(part3, g3.getPartipiciantGroup());
diff --git a/src/test/java/org/olat/restapi/CourseGroupMgmtTest.java b/src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
index e6241c629cf..a1c6fde8926 100644
--- a/src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
+++ b/src/test/java/org/olat/restapi/CourseGroupMgmtTest.java
@@ -118,8 +118,8 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
 		DBFactory.getInstance().closeSession();
 		
     // create groups without waiting list
-    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, course);
-    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, course);
+    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, 0, 10, false, false, course);
+    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, 0, 10, false, false, course);
     // members
     securityManager.addIdentityToSecurityGroup(id1, g2.getOwnerGroup());
     securityManager.addIdentityToSecurityGroup(id1, g1.getPartipiciantGroup());
@@ -127,8 +127,8 @@ public class CourseGroupMgmtTest extends OlatJerseyTestCase {
     securityManager.addIdentityToSecurityGroup(id2, g2.getPartipiciantGroup());
     
     // groups
-    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, course);
-    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, course);
+    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, -1, -1, false, false, course);
+    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, -1, -1, false, false, course);
     // members
     securityManager.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
     securityManager.addIdentityToSecurityGroup(id2, g4.getPartipiciantGroup());
diff --git a/src/test/java/org/olat/restapi/GroupFoldersTest.java b/src/test/java/org/olat/restapi/GroupFoldersTest.java
index a7abb36bc48..5d2179755dc 100644
--- a/src/test/java/org/olat/restapi/GroupFoldersTest.java
+++ b/src/test/java/org/olat/restapi/GroupFoldersTest.java
@@ -150,8 +150,8 @@ public class GroupFoldersTest extends OlatJerseyTestCase {
 	    // 1) context one: learning groups
 	    OLATResource c1 = JunitTestHelper.createRandomResource();
 	    // create groups without waiting list
-	    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
-	    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+	    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, 0, 10, false, false, c1);
+	    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, 0, 10, false, false, c1);
 	    
 	    //permission to see owners and participants
 	    BusinessGroupPropertyManager bgpm1 = new BusinessGroupPropertyManager(g1);
diff --git a/src/test/java/org/olat/restapi/GroupMgmtTest.java b/src/test/java/org/olat/restapi/GroupMgmtTest.java
index d3e68c62c62..6366a243da9 100644
--- a/src/test/java/org/olat/restapi/GroupMgmtTest.java
+++ b/src/test/java/org/olat/restapi/GroupMgmtTest.java
@@ -162,8 +162,8 @@ public class GroupMgmtTest extends OlatJerseyTestCase {
     // 1) context one: learning groups
     OLATResource c1 = JunitTestHelper.createRandomResource();
     // create groups without waiting list
-    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
-    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+    g1 = businessGroupService.createBusinessGroup(null, "rest-g1", null, 0, 10, false, false, c1);
+    g2 = businessGroupService.createBusinessGroup(null, "rest-g2", null, 0, 10, false, false, c1);
     
     //permission to see owners and participants
     BusinessGroupPropertyManager bgpm1 = new BusinessGroupPropertyManager(g1);
@@ -185,8 +185,8 @@ public class GroupMgmtTest extends OlatJerseyTestCase {
     // 2) context two: right groups
     OLATResource c2 = JunitTestHelper.createRandomResource();
     // groups
-    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
-    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
+    g3 = businessGroupService.createBusinessGroup(null, "rest-g3", null, -1, -1, false, false, c2);
+    g4 = businessGroupService.createBusinessGroup(null, "rest-g4", null, -1, -1, false, false, c2);
     // members
     secm.addIdentityToSecurityGroup(owner1, g3.getPartipiciantGroup());
     secm.addIdentityToSecurityGroup(owner2, g4.getPartipiciantGroup());
diff --git a/src/test/java/org/olat/restapi/UserMgmtTest.java b/src/test/java/org/olat/restapi/UserMgmtTest.java
index 8eb18b84356..218644dbff4 100644
--- a/src/test/java/org/olat/restapi/UserMgmtTest.java
+++ b/src/test/java/org/olat/restapi/UserMgmtTest.java
@@ -177,8 +177,8 @@ public class UserMgmtTest extends OlatJerseyTestCase {
     // 1) context one: learning groups
     OLATResource c1 = JunitTestHelper.createRandomResource();
     // create groups without waiting list
-    g1 = businessGroupService.createBusinessGroup(null, "user-rest-g1", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
-    g2 = businessGroupService.createBusinessGroup(null, "user-rest-g2", null, BusinessGroup.TYPE_LEARNINGROUP, 0, 10, false, false, c1);
+    g1 = businessGroupService.createBusinessGroup(null, "user-rest-g1", null, 0, 10, false, false, c1);
+    g2 = businessGroupService.createBusinessGroup(null, "user-rest-g2", null, 0, 10, false, false, c1);
     // members g1
     secm.addIdentityToSecurityGroup(id1, g1.getOwnerGroup());
     secm.addIdentityToSecurityGroup(id2, g1.getPartipiciantGroup());
@@ -189,8 +189,8 @@ public class UserMgmtTest extends OlatJerseyTestCase {
     // 2) context two: right groups
     OLATResource c2 = JunitTestHelper.createRandomResource();
     // groups
-    g3 = businessGroupService.createBusinessGroup(null, "user-rest-g3", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
-    g4 = businessGroupService.createBusinessGroup(null, "user-rest-g4", null, BusinessGroup.TYPE_RIGHTGROUP, -1, -1, false, false, c2);
+    g3 = businessGroupService.createBusinessGroup(null, "user-rest-g3", null, -1, -1, false, false, c2);
+    g4 = businessGroupService.createBusinessGroup(null, "user-rest-g4", null, -1, -1, false, false, c2);
     // members
     secm.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
     secm.addIdentityToSecurityGroup(id2, g4.getPartipiciantGroup());
diff --git a/src/test/profile/mysql/olat.eclipse.properties b/src/test/profile/mysql/olat.eclipse.properties
index 447687fe9bb..088eadeffe8 100644
--- a/src/test/profile/mysql/olat.eclipse.properties
+++ b/src/test/profile/mysql/olat.eclipse.properties
@@ -7,7 +7,7 @@
 tomcat.id=2
 
 defaultlang=de
-db.show_sql=false
+db.show_sql=true
 #force use of java.io.tmpDir for unit tests
 archive.dir=
 log.dir=
-- 
GitLab