org.olat.course.groupsandrights
Class PersistingCourseGroupManager

java.lang.Object
  extended by org.olat.course.groupsandrights.PersistingCourseGroupManager
All Implemented Interfaces:
CourseGroupManager

public class PersistingCourseGroupManager
extends java.lang.Object
implements CourseGroupManager

Description:
Implementation of the CourseGroupManager that persists its data on the database

Initial Date: Aug 25, 2004

Author:
gnaegi

Field Summary
 
Fields inherited from interface org.olat.course.groupsandrights.CourseGroupManager
DEFAULT_CONTEXT_PREFIX, DEFAULT_NAME_LC_PREFIX, DEFAULT_NAME_RC_PREFIX
 
Method Summary
 void archiveCourseGroups(java.io.File exportDirectory)
          Archive all learning-group-contexts and right-group-contexts.
 void createCourseGroupmanagement(java.lang.String courseTitle)
          Initializes the course groupmanagement.
 void createCourseGroupmanagementAsCopy(CourseGroupManager originalCourseGroupManager, java.lang.String courseTitle)
          Initializes the course groupmanagement as a copy of another course.
 void deleteCourseGroupmanagement()
          Deletes the course group management.
 void exportCourseLeaningGroups(java.io.File fExportDirectory)
          Export all groups which are course internal to a file for later import.
 void exportCourseRightGroups(java.io.File fExportDirectory)
          Export all groups which are course internal to a file for later import.
 java.util.List getAllAreasFromAllContexts()
           
 java.util.List getAllLearningGroupsFromAllContexts()
           
 java.util.List getAllRightGroupsFromAllContexts()
           
 java.util.List getCoachesFromArea(java.lang.String areaName)
          List with identities being coaches in the areas of this course.
 java.util.List getCoachesFromLearningGroup(java.lang.String groupName)
          List with identities being coaches in learning groups of this course.
static PersistingCourseGroupManager getInstance(OLATResource courseResource)
           
static PersistingCourseGroupManager getInstance(OLATResourceable course)
           
 java.util.List getLearningAreasOfGroupFromAllContexts(java.lang.String groupName)
           
 java.util.List getLearningGroupContexts()
           
 java.util.List getLearningGroupsFromAllContexts(java.lang.String groupName)
           
 java.util.List getLearningGroupsInAreaFromAllContexts(java.lang.String areaName)
           
 java.util.List getNumberOfMembersFromGroups(java.util.List groups)
          Method to count group memberships.
 java.util.List getOwnedLearningGroupsFromAllContexts(Identity identity)
           
 java.util.List getParticipantsFromArea(java.lang.String areaName)
          List with identities being participants in the areas of this course.
 java.util.List getParticipantsFromLearningGroup(java.lang.String groupName)
          List with identities being participants in the learning groups of this course.
 java.util.List getParticipatingLearningGroupsFromAllContexts(Identity identity)
           
 java.util.List getParticipatingLearningGroupsFromAllContexts(Identity identity, java.lang.String groupName)
           
 java.util.List getParticipatingLearningGroupsInAreaFromAllContexts(Identity identity, java.lang.String areaName)
           
 java.util.List getParticipatingRightGroupsFromAllContexts(Identity identity)
           
 java.util.List getRightGroupContexts()
           
 java.util.List getRightGroupsFromAllContexts(java.lang.String groupName)
           
 java.util.List getUniqueAreaNamesFromAllContexts()
           
 java.util.List getUniqueLearningGroupNamesFromAllContexts()
           
 java.util.List getWaitingListGroupsFromAllContexts(Identity identity)
           
 boolean hasRight(Identity identity, java.lang.String courseRight)
          Checks users course rights in any of the available right group context of this course
 boolean hasRight(Identity identity, java.lang.String courseRight, java.lang.String groupContextName)
          Checks users course rights in the specified right group context of this course
 void importCourseLearningGroups(java.io.File fImportDirectory)
          Import course internal groups fa previous export.
 void importCourseRightGroups(java.io.File fImportDirectory)
          Import course internal groups fa previous export.
 void initGroupContextsList()
          Initialize the group contexts list.
 boolean isIdentityCourseAdministrator(Identity identity)
          Checks if user is course administrator (is owner of repository entry)
 boolean isIdentityCourseCoach(Identity identity)
          Checks if user is coach in any of the courses learning groups
 boolean isIdentityInGroupContext(Identity identity, java.lang.String groupContextName)
          Checks if an identity is in the given group context
 boolean isIdentityInLearningArea(Identity identity, java.lang.String areaName)
          Checks if an identity is in any learning areas with the given name in any of the courses group contexts
 boolean isIdentityInLearningArea(Identity identity, java.lang.String areaName, java.lang.String groupContextName)
          Checks if an identity is in a learning areas with the given name in the given group context
 boolean isIdentityInLearningGroup(Identity identity, java.lang.String groupName)
          Checks if an identity is in a learning group with the given name in any contexts of this course, either as owner or as participant
 boolean isIdentityInLearningGroup(Identity identity, java.lang.String groupName, java.lang.String groupContextName)
          Checks if an identity is in a learning group with the given name in the the given group context of this course, either as owner or as participant
 boolean isIdentityInRightGroup(Identity identity, java.lang.String groupName)
          Checks if an identity is in a right group with the given name in any contexts of this course
 boolean isIdentityInRightGroup(Identity identity, java.lang.String groupName, java.lang.String groupContextName)
          Checks if an identity is in a right group with the given name in the the given group context of this course
 boolean isIdentityParticipantInAnyLearningGroup(Identity identity)
          Checks if user is participant in any learning group of this course
 boolean isIdentityParticipantInAnyRightGroup(Identity identity)
          Checks if user is participant in any right group of this course
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initGroupContextsList

public void initGroupContextsList()
Description copied from interface: CourseGroupManager
Initialize the group contexts list.

Specified by:
initGroupContextsList in interface CourseGroupManager
See Also:
CourseGroupManager.initGroupContextsList()

getInstance

public static PersistingCourseGroupManager getInstance(OLATResourceable course)
Parameters:
course - The current course
Returns:
A course group manager that uses persisted data

getInstance

public static PersistingCourseGroupManager getInstance(OLATResource courseResource)
Parameters:
courseResource - The current course resource
Returns:
A course group manager that uses persisted data

hasRight

public boolean hasRight(Identity identity,
                        java.lang.String courseRight)
Description copied from interface: CourseGroupManager
Checks users course rights in any of the available right group context of this course

Specified by:
hasRight in interface CourseGroupManager
Returns:
true if user has course right, false otherwhise
See Also:
CourseGroupManager.hasRight(org.olat.core.id.Identity, java.lang.String)

hasRight

public boolean hasRight(Identity identity,
                        java.lang.String courseRight,
                        java.lang.String groupContextName)
Description copied from interface: CourseGroupManager
Checks users course rights in the specified right group context of this course

Specified by:
hasRight in interface CourseGroupManager
Returns:
true if user has course right, false otherwhise
See Also:
CourseGroupManager.hasRight(org.olat.core.id.Identity, java.lang.String, java.lang.String)

isIdentityInLearningGroup

public boolean isIdentityInLearningGroup(Identity identity,
                                         java.lang.String groupName)
Description copied from interface: CourseGroupManager
Checks if an identity is in a learning group with the given name in any contexts of this course, either as owner or as participant

Specified by:
isIdentityInLearningGroup in interface CourseGroupManager
Returns:
true if user is in learning group, false otherwhise
See Also:
CourseGroupManager.isIdentityInLearningGroup(org.olat.core.id.Identity, java.lang.String)

isIdentityInLearningGroup

public boolean isIdentityInLearningGroup(Identity identity,
                                         java.lang.String groupName,
                                         java.lang.String groupContextName)
Description copied from interface: CourseGroupManager
Checks if an identity is in a learning group with the given name in the the given group context of this course, either as owner or as participant

Specified by:
isIdentityInLearningGroup in interface CourseGroupManager
Returns:
true if user is in learning group, false otherwhise
See Also:
CourseGroupManager.isIdentityInLearningGroup(org.olat.core.id.Identity, java.lang.String, java.lang.String)

isIdentityInRightGroup

public boolean isIdentityInRightGroup(Identity identity,
                                      java.lang.String groupName)
Description copied from interface: CourseGroupManager
Checks if an identity is in a right group with the given name in any contexts of this course

Specified by:
isIdentityInRightGroup in interface CourseGroupManager
Returns:
true if user is in right group, false otherwhise
See Also:
CourseGroupManager.isIdentityInRightGroup(org.olat.core.id.Identity, java.lang.String)

isIdentityInRightGroup

public boolean isIdentityInRightGroup(Identity identity,
                                      java.lang.String groupName,
                                      java.lang.String groupContextName)
Description copied from interface: CourseGroupManager
Checks if an identity is in a right group with the given name in the the given group context of this course

Specified by:
isIdentityInRightGroup in interface CourseGroupManager
Returns:
true if user is in right group, false otherwhise
See Also:
CourseGroupManager.isIdentityInRightGroup(org.olat.core.id.Identity, java.lang.String, java.lang.String)

isIdentityInLearningArea

public boolean isIdentityInLearningArea(Identity identity,
                                        java.lang.String areaName)
Description copied from interface: CourseGroupManager
Checks if an identity is in any learning areas with the given name in any of the courses group contexts

Specified by:
isIdentityInLearningArea in interface CourseGroupManager
Returns:
true if user is in such an area, false otherwhise
See Also:
CourseGroupManager.isIdentityInLearningArea(org.olat.core.id.Identity, java.lang.String)

isIdentityInLearningArea

public boolean isIdentityInLearningArea(Identity identity,
                                        java.lang.String areaName,
                                        java.lang.String groupContextName)
Description copied from interface: CourseGroupManager
Checks if an identity is in a learning areas with the given name in the given group context

Specified by:
isIdentityInLearningArea in interface CourseGroupManager
Returns:
true if user is in such an area, false otherwhise
See Also:
CourseGroupManager.isIdentityInLearningArea(org.olat.core.id.Identity, java.lang.String, java.lang.String)

isIdentityInGroupContext

public boolean isIdentityInGroupContext(Identity identity,
                                        java.lang.String groupContextName)
Description copied from interface: CourseGroupManager
Checks if an identity is in the given group context

Specified by:
isIdentityInGroupContext in interface CourseGroupManager
Returns:
true if user is in this context, false otherwhise
See Also:
CourseGroupManager.isIdentityInGroupContext(org.olat.core.id.Identity, java.lang.String)

getLearningGroupContexts

public java.util.List getLearningGroupContexts()
Specified by:
getLearningGroupContexts in interface CourseGroupManager
Returns:
The list of learning group contexts of this course
See Also:
CourseGroupManager.getLearningGroupContexts()

getRightGroupContexts

public java.util.List getRightGroupContexts()
Specified by:
getRightGroupContexts in interface CourseGroupManager
Returns:
The list of right group contexts of this course
See Also:
CourseGroupManager.getRightGroupContexts()

getRightGroupsFromAllContexts

public java.util.List getRightGroupsFromAllContexts(java.lang.String groupName)
Specified by:
getRightGroupsFromAllContexts in interface CourseGroupManager
Returns:
See Also:
CourseGroupManager.getRightGroupsFromAllContexts(java.lang.String)

getAllLearningGroupsFromAllContexts

public java.util.List getAllLearningGroupsFromAllContexts()
Specified by:
getAllLearningGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning group from all learning group contexts of this course
See Also:
CourseGroupManager.getAllLearningGroupsFromAllContexts()

getLearningGroupsFromAllContexts

public java.util.List getLearningGroupsFromAllContexts(java.lang.String groupName)
Specified by:
getLearningGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups with the given group name from all contexts of this course
See Also:
CourseGroupManager.getLearningGroupsFromAllContexts(java.lang.String)

getAllAreasFromAllContexts

public java.util.List getAllAreasFromAllContexts()
Specified by:
getAllAreasFromAllContexts in interface CourseGroupManager
Returns:
A list of all group areas from this course
See Also:
CourseGroupManager.getAllAreasFromAllContexts()

getLearningGroupsInAreaFromAllContexts

public java.util.List getLearningGroupsInAreaFromAllContexts(java.lang.String areaName)
Specified by:
getLearningGroupsInAreaFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups from all contexts from this course that are in the given group area
See Also:
CourseGroupManager.getLearningGroupsInAreaFromAllContexts(java.lang.String)

getLearningAreasOfGroupFromAllContexts

public java.util.List getLearningAreasOfGroupFromAllContexts(java.lang.String groupName)
Specified by:
getLearningAreasOfGroupFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning areas where the given group takes part. All course group contexts are considered in this search.
See Also:
CourseGroupManager.getLearningAreasOfGroupFromAllContexts(java.lang.String)

getParticipatingLearningGroupsFromAllContexts

public java.util.List getParticipatingLearningGroupsFromAllContexts(Identity identity,
                                                                    java.lang.String groupName)
Specified by:
getParticipatingLearningGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups with the given name where this identity is participant
See Also:
CourseGroupManager.getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity, java.lang.String)

getParticipatingLearningGroupsInAreaFromAllContexts

public java.util.List getParticipatingLearningGroupsInAreaFromAllContexts(Identity identity,
                                                                          java.lang.String areaName)
Specified by:
getParticipatingLearningGroupsInAreaFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups within the given group area where this identity is participant
See Also:
CourseGroupManager.getParticipatingLearningGroupsInAreaFromAllContexts(org.olat.core.id.Identity, java.lang.String)

getAllRightGroupsFromAllContexts

public java.util.List getAllRightGroupsFromAllContexts()
Specified by:
getAllRightGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all right groups from this course
See Also:
CourseGroupManager.getAllRightGroupsFromAllContexts()

getOwnedLearningGroupsFromAllContexts

public java.util.List getOwnedLearningGroupsFromAllContexts(Identity identity)
Specified by:
getOwnedLearningGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups where this identity is owner
See Also:
CourseGroupManager.getOwnedLearningGroupsFromAllContexts(org.olat.core.id.Identity)

getParticipatingLearningGroupsFromAllContexts

public java.util.List getParticipatingLearningGroupsFromAllContexts(Identity identity)
Specified by:
getParticipatingLearningGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all learning groups where this identity is participant
See Also:
CourseGroupManager.getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity)

getParticipatingRightGroupsFromAllContexts

public java.util.List getParticipatingRightGroupsFromAllContexts(Identity identity)
Specified by:
getParticipatingRightGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of right groups where this identity is participating
See Also:
CourseGroupManager.getParticipatingRightGroupsFromAllContexts(org.olat.core.id.Identity)

isIdentityCourseCoach

public boolean isIdentityCourseCoach(Identity identity)
Description copied from interface: CourseGroupManager
Checks if user is coach in any of the courses learning groups

Specified by:
isIdentityCourseCoach in interface CourseGroupManager
Returns:
true if user is coach
See Also:
CourseGroupManager.isIdentityCourseCoach(org.olat.core.id.Identity)

isIdentityCourseAdministrator

public boolean isIdentityCourseAdministrator(Identity identity)
Description copied from interface: CourseGroupManager
Checks if user is course administrator (is owner of repository entry)

Specified by:
isIdentityCourseAdministrator in interface CourseGroupManager
Returns:
boolean
See Also:
CourseGroupManager.isIdentityCourseAdministrator(org.olat.core.id.Identity)

isIdentityParticipantInAnyLearningGroup

public boolean isIdentityParticipantInAnyLearningGroup(Identity identity)
Description copied from interface: CourseGroupManager
Checks if user is participant in any learning group of this course

Specified by:
isIdentityParticipantInAnyLearningGroup in interface CourseGroupManager
Returns:
boolean
See Also:
CourseGroupManager.isIdentityParticipantInAnyLearningGroup(org.olat.core.id.Identity)

isIdentityParticipantInAnyRightGroup

public boolean isIdentityParticipantInAnyRightGroup(Identity identity)
Description copied from interface: CourseGroupManager
Checks if user is participant in any right group of this course

Specified by:
isIdentityParticipantInAnyRightGroup in interface CourseGroupManager
Returns:
boolean
See Also:
CourseGroupManager.isIdentityParticipantInAnyRightGroup(org.olat.core.id.Identity)

createCourseGroupmanagement

public void createCourseGroupmanagement(java.lang.String courseTitle)
Description copied from interface: CourseGroupManager
Initializes the course groupmanagement. This will create the initial default learning and right group contexts.

Specified by:
createCourseGroupmanagement in interface CourseGroupManager
See Also:
CourseGroupManager.createCourseGroupmanagement(java.lang.String)

createCourseGroupmanagementAsCopy

public void createCourseGroupmanagementAsCopy(CourseGroupManager originalCourseGroupManager,
                                              java.lang.String courseTitle)
Description copied from interface: CourseGroupManager
Initializes the course groupmanagement as a copy of another course. This will copy the initial default learning and right group contexts and add the references to all other group contexts.

Specified by:
createCourseGroupmanagementAsCopy in interface CourseGroupManager
See Also:
CourseGroupManager.createCourseGroupmanagementAsCopy(org.olat.course.groupsandrights.CourseGroupManager, java.lang.String)

deleteCourseGroupmanagement

public void deleteCourseGroupmanagement()
Description copied from interface: CourseGroupManager
Deletes the course group management. This will unlink all group contexts from this course. When the unlinked contexts are not used in any other resources then the context itself will be deleted as well. This will delete all areas, groups, group memberships, group folders, forums etc. Use with care!

Specified by:
deleteCourseGroupmanagement in interface CourseGroupManager
See Also:
CourseGroupManager.deleteCourseGroupmanagement()

getNumberOfMembersFromGroups

public java.util.List getNumberOfMembersFromGroups(java.util.List groups)
Description copied from interface: CourseGroupManager
Method to count group memberships. Only participants will be counted, no the owners.

Specified by:
getNumberOfMembersFromGroups in interface CourseGroupManager
Parameters:
groups - List of business groups
Returns:
list of Integers that contain the number of participants for each group

getUniqueAreaNamesFromAllContexts

public java.util.List getUniqueAreaNamesFromAllContexts()
Specified by:
getUniqueAreaNamesFromAllContexts in interface CourseGroupManager
Returns:
A list with all area names used in all learning group contexts. If an area red is in more than one contexts, red will be only once in the list
See Also:
CourseGroupManager.getUniqueAreaNamesFromAllContexts()

getUniqueLearningGroupNamesFromAllContexts

public java.util.List getUniqueLearningGroupNamesFromAllContexts()
Specified by:
getUniqueLearningGroupNamesFromAllContexts in interface CourseGroupManager
Returns:
A list with all group names used in all learning group contexts. If a group red is in more than one contexts, red will be only once in the list
See Also:
CourseGroupManager.getUniqueLearningGroupNamesFromAllContexts()

exportCourseLeaningGroups

public void exportCourseLeaningGroups(java.io.File fExportDirectory)
Description copied from interface: CourseGroupManager
Export all groups which are course internal to a file for later import.

Specified by:
exportCourseLeaningGroups in interface CourseGroupManager
See Also:
CourseGroupManager.exportCourseLeaningGroups(java.io.File)

importCourseLearningGroups

public void importCourseLearningGroups(java.io.File fImportDirectory)
Description copied from interface: CourseGroupManager
Import course internal groups fa previous export.

Specified by:
importCourseLearningGroups in interface CourseGroupManager
See Also:
CourseGroupManager.importCourseLearningGroups(java.io.File)

exportCourseRightGroups

public void exportCourseRightGroups(java.io.File fExportDirectory)
Description copied from interface: CourseGroupManager
Export all groups which are course internal to a file for later import.

Specified by:
exportCourseRightGroups in interface CourseGroupManager
See Also:
CourseGroupManager.exportCourseRightGroups(java.io.File)

importCourseRightGroups

public void importCourseRightGroups(java.io.File fImportDirectory)
Description copied from interface: CourseGroupManager
Import course internal groups fa previous export.

Specified by:
importCourseRightGroups in interface CourseGroupManager
See Also:
CourseGroupManager.importCourseRightGroups(java.io.File)

getCoachesFromLearningGroup

public java.util.List getCoachesFromLearningGroup(java.lang.String groupName)
Description copied from interface: CourseGroupManager
List with identities being coaches in learning groups of this course. If the specified name is null, all learning groups are considered.

Specified by:
getCoachesFromLearningGroup in interface CourseGroupManager
Returns:
a list with all coaches of this course
See Also:
org.olat.course.groupsandrights.CourseGroupManager#getCoachesFromLearningGroups(String)

getParticipantsFromLearningGroup

public java.util.List getParticipantsFromLearningGroup(java.lang.String groupName)
Description copied from interface: CourseGroupManager
List with identities being participants in the learning groups of this course. If the specified name is null, all learning groups are considered.

Specified by:
getParticipantsFromLearningGroup in interface CourseGroupManager
Returns:
a list with all participants of this course
See Also:
org.olat.course.groupsandrights.CourseGroupManager#getParticipantsFromLearningGroups(String)

getCoachesFromArea

public java.util.List getCoachesFromArea(java.lang.String areaName)
Description copied from interface: CourseGroupManager
List with identities being coaches in the areas of this course. If the specified name is null, all areas are considered.

Specified by:
getCoachesFromArea in interface CourseGroupManager
Returns:
a list with all coaches of this course
See Also:
CourseGroupManager.getCoachesFromArea(java.lang.String)

getParticipantsFromArea

public java.util.List getParticipantsFromArea(java.lang.String areaName)
Description copied from interface: CourseGroupManager
List with identities being participants in the areas of this course. If the specified name is null, all areas are considered.

Specified by:
getParticipantsFromArea in interface CourseGroupManager
Returns:
a list with participants of this course
See Also:
CourseGroupManager.getParticipantsFromArea(java.lang.String)

getWaitingListGroupsFromAllContexts

public java.util.List getWaitingListGroupsFromAllContexts(Identity identity)
Specified by:
getWaitingListGroupsFromAllContexts in interface CourseGroupManager
Returns:
A list of all waiting-list groups where this identity is in
See Also:
CourseGroupManager.getWaitingListGroupsFromAllContexts(org.olat.core.id.Identity)

archiveCourseGroups

public void archiveCourseGroups(java.io.File exportDirectory)
Archive all learning-group-contexts and right-group-contexts.

Parameters:
exportDirectory -