org.olat.group.context
Interface BGContextManager

All Known Implementing Classes:
BGContextManagerImpl

public interface BGContextManager

Description:
Manager to manipulate business group contexts. A business group context is a collection of business groups of the same business group type and of business group areas that area associated with the business groups. A business group context can be associated with multiple courses. Every course has at least two business group contexts, the default learning group context and the default right group context

Initial Date: Aug 25, 2004

Author:
gnaegi

Method Summary
 void addBGContextToResource(BGContext bgContext, OLATResource resource)
          Add a business group context to an OLATResource
 BGContext copyAndAddBGContextToResource(java.lang.String contextName, OLATResource resource, BGContext originalBgContext)
          Creates and persists a business group context as a copy of an existing business group context.
 int countBGOwnersOfBGContext(BGContext bgContext)
          Count the number of identities that are owner of any group in the given business group context
 int countBGParticipantsOfBGContext(BGContext bgContext)
          Count the number of identities that are participants of any group in the given business group context
 int countGroupsOfBGContext(BGContext bgContext)
          Count the number of groups within a business group context
 int countGroupsOfType(java.lang.String groupType)
          Count the number of groups of a certain group type
 BGContext createAndAddBGContextToResource(java.lang.String contextName, OLATResource resource, java.lang.String groupType, Identity initialOwner, boolean defaultContext)
          Creates a relation from a business group context to an OLATResource (e.g.
 BGContext createAndPersistBGContext(java.lang.String name, java.lang.String description, java.lang.String groupType, Identity owner, boolean defaultContext)
          Creates a busines group context object and persists the object in the database
 void deleteBGContext(BGContext bgContext)
          Deletes a business group context from the database
 java.util.List findBGContextsForIdentity(Identity identity, boolean defaultContexts, boolean nonDefaultContexts)
          Find all business group contexts for a specific user.
 java.util.List findBGContextsForResource(OLATResource resource, boolean defaultContexts, boolean nonDefaultContexts)
          Find all business group contexts for the given OLATResource defaultContexts and nonDefaultContexts can both be true or partly be true, but not be both false
 java.util.List findBGContextsForResource(OLATResource resource, java.lang.String groupType, boolean defaultContexts, boolean nonDefaultContexts)
          Find all business group contexts for the given OLATResource with the given group type defaultContexts and nonDefaultContexts can both be true or partly be true, but not be both false
 BusinessGroup findGroupAttendedBy(Identity identity, java.lang.String groupName, BGContext context)
          Find a business group in the given business group context where the given user is in the group as participant
 BusinessGroup findGroupOfBGContext(java.lang.String groupName, BGContext bgContext)
          Find a business group in the given business group context
 java.util.List findOLATResourcesForBGContext(BGContext bgContext)
          Find all OLATResources that are associated with the given business group context
 java.util.List findRepositoryEntriesForBGContext(BGContext bgContext)
          Find all repository entries of the OLAT resources that have a relation to this group context.
 java.util.List getBGOwnersOfBGContext(BGContext bgContext)
          Find the identities that are owners of any group in the given business group context
 java.util.List getBGParticipantsOfBGContext(BGContext bgContext)
          Find the identities that are participants of any group in the given business group context
 java.util.List<BusinessGroup> getGroupsOfBGContext(BGContext bgContext)
          Find all groups from a business group context
 boolean isIdentityInBGContext(Identity identity, BGContext bgContext, boolean asOwner, boolean asParticipant)
          Check if the given identity is in this business group context
 BGContext loadBGContext(BGContext bgContext)
          Refresh the given bgContext
 void removeBGContextFromResource(BGContext bgContext, OLATResource resource)
          Remove the given business group context from this OLATResource
 void updateBGContext(BGContext bgContext)
          Updates a business group context in the database
 

Method Detail

createAndPersistBGContext

BGContext createAndPersistBGContext(java.lang.String name,
                                    java.lang.String description,
                                    java.lang.String groupType,
                                    Identity owner,
                                    boolean defaultContext)
Creates a busines group context object and persists the object in the database

Parameters:
name - Display name of the group context
description -
groupType - Business group type that this business group context can contain
owner - The initial owner, the users who can manage the business group context using the group context management tool
defaultContext - true: create as a default context, false: create as a regular context
Returns:
The persisted business group context

copyAndAddBGContextToResource

BGContext copyAndAddBGContextToResource(java.lang.String contextName,
                                        OLATResource resource,
                                        BGContext originalBgContext)
Creates and persists a business group context as a copy of an existing business group context. The new created context will then be associated to the given OLATResource. The copy process will copy all business group areas and all business groups. The groups will be configured identically as the original groups but will not contain any users.

Parameters:
contextName - The new context name
resource - The OALTResource that the new context should be associated with using the group context management tool
originalBgContext - The original business group context that is uses for the copy process
Returns:
The new copied business group context

updateBGContext

void updateBGContext(BGContext bgContext)
Updates a business group context in the database

Parameters:
bgContext -

deleteBGContext

void deleteBGContext(BGContext bgContext)
Deletes a business group context from the database

Parameters:
bgContext -

getGroupsOfBGContext

java.util.List<BusinessGroup> getGroupsOfBGContext(BGContext bgContext)
Find all groups from a business group context

Parameters:
bgContext - the business group context or null to find groups that are not within a business group context (e.b. buddygroups)
Returns:
A list containing business group contexts

countGroupsOfBGContext

int countGroupsOfBGContext(BGContext bgContext)
Count the number of groups within a business group context

Parameters:
bgContext -
Returns:
The number of groups

countGroupsOfType

int countGroupsOfType(java.lang.String groupType)
Count the number of groups of a certain group type

Parameters:
groupType -
Returns:

getBGOwnersOfBGContext

java.util.List getBGOwnersOfBGContext(BGContext bgContext)
Find the identities that are owners of any group in the given business group context

Parameters:
bgContext -
Returns:
A list of identities

countBGOwnersOfBGContext

int countBGOwnersOfBGContext(BGContext bgContext)
Count the number of identities that are owner of any group in the given business group context

Parameters:
bgContext -
Returns:
The number of identities

getBGParticipantsOfBGContext

java.util.List getBGParticipantsOfBGContext(BGContext bgContext)
Find the identities that are participants of any group in the given business group context

Parameters:
bgContext -
Returns:
A list of identities

countBGParticipantsOfBGContext

int countBGParticipantsOfBGContext(BGContext bgContext)
Count the number of identities that are participants of any group in the given business group context

Parameters:
bgContext -
Returns:
The number of identities

isIdentityInBGContext

boolean isIdentityInBGContext(Identity identity,
                              BGContext bgContext,
                              boolean asOwner,
                              boolean asParticipant)
Check if the given identity is in this business group context

Parameters:
identity -
bgContext -
asOwner - Flag to check if the user is in any group as owner
asParticipant - Flag to check if the user is in any group as participant
Returns:
true if user is in any group with ghe given role, false otherwhise

findGroupOfBGContext

BusinessGroup findGroupOfBGContext(java.lang.String groupName,
                                   BGContext bgContext)
Find a business group in the given business group context

Parameters:
groupName -
bgContext -
Returns:
The business group or null if no group found

findGroupAttendedBy

BusinessGroup findGroupAttendedBy(Identity identity,
                                  java.lang.String groupName,
                                  BGContext context)
Find a business group in the given business group context where the given user is in the group as participant

Parameters:
identity -
groupName -
context -
Returns:
The business group or null if no group found

createAndAddBGContextToResource

BGContext createAndAddBGContextToResource(java.lang.String contextName,
                                          OLATResource resource,
                                          java.lang.String groupType,
                                          Identity initialOwner,
                                          boolean defaultContext)
Creates a relation from a business group context to an OLATResource (e.g. course)

Parameters:
contextName - The new context name
resource - The OALTResource that the new context should be associated with
initialOwner - The initial owner. the users who can manage the business group context using the group context management tool
groupType - The group type the context should be used for
defaultContext - true: create as a default context, false: create as a regular context
Returns:
The new created business group context

addBGContextToResource

void addBGContextToResource(BGContext bgContext,
                            OLATResource resource)
Add a business group context to an OLATResource

Parameters:
bgContext -
resource -

findBGContextsForResource

java.util.List findBGContextsForResource(OLATResource resource,
                                         boolean defaultContexts,
                                         boolean nonDefaultContexts)
Find all business group contexts for the given OLATResource defaultContexts and nonDefaultContexts can both be true or partly be true, but not be both false

Parameters:
resource -
defaultContexts - true: find default contexts
nonDefaultContexts - true: find non-default contexts
Returns:
A list of business group contexts

findBGContextsForResource

java.util.List findBGContextsForResource(OLATResource resource,
                                         java.lang.String groupType,
                                         boolean defaultContexts,
                                         boolean nonDefaultContexts)
Find all business group contexts for the given OLATResource with the given group type defaultContexts and nonDefaultContexts can both be true or partly be true, but not be both false

Parameters:
resource -
groupType -
defaultContexts - true: find default contexts
nonDefaultContexts - true: find non-default contexts
Returns:
A list of business group contexts

findBGContextsForIdentity

java.util.List findBGContextsForIdentity(Identity identity,
                                         boolean defaultContexts,
                                         boolean nonDefaultContexts)
Find all business group contexts for a specific user. This will find all contexts where the user is in the owner group and all context where the user is in the owner group of the olat resource that uses this context. defaultContexts and nonDefaultContexts can both be true or partly be true, but not be both false

Parameters:
identity -
defaultContexts - true: find default contexts
nonDefaultContexts - true: find non-default contexts
Returns:
A list of business group contexts

findOLATResourcesForBGContext

java.util.List findOLATResourcesForBGContext(BGContext bgContext)
Find all OLATResources that are associated with the given business group context

Parameters:
bgContext -
Returns:
A list of OLATResources

findRepositoryEntriesForBGContext

java.util.List findRepositoryEntriesForBGContext(BGContext bgContext)
Find all repository entries of the OLAT resources that have a relation to this group context. (see findOlatResourcesForBGContext)

Parameters:
bgContext -
Returns:
List of repository entries

removeBGContextFromResource

void removeBGContextFromResource(BGContext bgContext,
                                 OLATResource resource)
Remove the given business group context from this OLATResource

Parameters:
bgContext -
resource -

loadBGContext

BGContext loadBGContext(BGContext bgContext)
Refresh the given bgContext

Parameters:
bgContext -
Returns:
BGContext the updated context