org.olat.group.area
Class BGAreaManagerImpl

java.lang.Object
  extended by org.olat.group.area.BGAreaManagerImpl
All Implemented Interfaces:
BGAreaManager

public class BGAreaManagerImpl
extends java.lang.Object
implements BGAreaManager

Description:
Implementation of the business group area manager

Initial Date: Aug 24, 2004

Author:
gnaegi

Method Summary
 void addBGToBGArea(BusinessGroup group, BGArea area)
          Add a business group to a business group area.
 boolean checkIfOneOrMoreNameExistsInContext(java.util.Set<java.lang.String> allNames, BGContext bgContext)
          checks if one or more of the given names exists already in the context.
 java.util.Map copyBGAreasOfBGContext(BGContext origBgContext, BGContext targetBgContext)
          Copies all group areas from the original context to the target context.
 int countBGAreasOfBGContext(BGContext groupContext)
          Counts the number of business group areas of the given business group context
 BGArea createAndPersistBGAreaIfNotExists(java.lang.String areaName, java.lang.String description, BGContext groupContext)
          Creates an area object and persists the object in the database only if such an area name does not already exist in this context
 void deleteBGArea(BGArea area)
          Delete the given area form the database
 void deleteBGtoAreaRelations(BusinessGroup group)
          Deletes all business group to area relations from the given business group
 BGArea findBGArea(java.lang.String areaName, BGContext groupContext)
          Finds an area in the given context
 java.util.List findBGAreasOfBGContext(BGContext groupContext)
          Searches for all business group areas in the given business group context
 java.util.List findBGAreasOfBusinessGroup(BusinessGroup group)
          Searches for all business group areas associated with the given business group
 java.util.List findBusinessGroupsOfArea(BGArea area)
          Searches for all business groups that are associated with the given business group area
 java.util.List findBusinessGroupsOfAreaAttendedBy(Identity identity, java.lang.String areaName, BGContext context)
          Searches for all business groups that are associated with the given business group area where the given identity is in the participants group
static BGAreaManager getInstance()
           
 boolean isIdentityInBGArea(Identity identity, java.lang.String areaName, BGContext groupContext)
          Checks if an identity is in a business group areas with a given name in the given group context
 BGArea reloadArea(BGArea area)
          Reloads the business group area from the database or the hibernate second level cache
 void removeBGFromArea(BusinessGroup group, BGArea area)
          Remove a business group from a business group area.
 BGArea updateBGArea(BGArea area)
          Update the given area in the database
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static BGAreaManager getInstance()
Returns:
singleton instance

createAndPersistBGAreaIfNotExists

public BGArea createAndPersistBGAreaIfNotExists(java.lang.String areaName,
                                                java.lang.String description,
                                                BGContext groupContext)
Description copied from interface: BGAreaManager
Creates an area object and persists the object in the database only if such an area name does not already exist in this context

Specified by:
createAndPersistBGAreaIfNotExists in interface BGAreaManager
Parameters:
areaName - The visible area name
description - The area description
groupContext - The group context of this area
Returns:
The new area or null if no area has been created
See Also:
BGAreaManager.createAndPersistBGAreaIfNotExists(java.lang.String, java.lang.String, org.olat.group.context.BGContext)

copyBGAreasOfBGContext

public java.util.Map copyBGAreasOfBGContext(BGContext origBgContext,
                                            BGContext targetBgContext)
Description copied from interface: BGAreaManager
Copies all group areas from the original context to the target context. The method returns a hash map with all original areas as key and the newly created areas as value.

Specified by:
copyBGAreasOfBGContext in interface BGAreaManager
Parameters:
origBgContext - Context containing the orignial areas
targetBgContext - Context where the areas should be created
Returns:
Map mapping the original to the new areas
See Also:
BGAreaManager.copyBGAreasOfBGContext(org.olat.group.context.BGContext, org.olat.group.context.BGContext)

findBGArea

public BGArea findBGArea(java.lang.String areaName,
                         BGContext groupContext)
Description copied from interface: BGAreaManager
Finds an area in the given context

Specified by:
findBGArea in interface BGAreaManager
Returns:
The area or null if the area does not exists
See Also:
BGAreaManager.findBGArea(java.lang.String, org.olat.group.context.BGContext)

updateBGArea

public BGArea updateBGArea(BGArea area)
Description copied from interface: BGAreaManager
Update the given area in the database

Specified by:
updateBGArea in interface BGAreaManager
Returns:
the updated area
See Also:
BGAreaManager.updateBGArea(org.olat.group.area.BGArea)

deleteBGArea

public void deleteBGArea(BGArea area)
Description copied from interface: BGAreaManager
Delete the given area form the database

Specified by:
deleteBGArea in interface BGAreaManager
See Also:
BGAreaManager.deleteBGArea(org.olat.group.area.BGArea)

deleteBGtoAreaRelations

public void deleteBGtoAreaRelations(BusinessGroup group)
Deletes all business group to area relations from the given business group

Specified by:
deleteBGtoAreaRelations in interface BGAreaManager
Parameters:
group -

addBGToBGArea

public void addBGToBGArea(BusinessGroup group,
                          BGArea area)
Description copied from interface: BGAreaManager
Add a business group to a business group area. Does not check it this relationship does already exists. Check this prior to using this method.

Specified by:
addBGToBGArea in interface BGAreaManager
See Also:
BGAreaManager.addBGToBGArea(org.olat.group.BusinessGroup, org.olat.group.area.BGArea)

removeBGFromArea

public void removeBGFromArea(BusinessGroup group,
                             BGArea area)
Description copied from interface: BGAreaManager
Remove a business group from a business group area. If no such relation exists, the mehthod does nothing.

Specified by:
removeBGFromArea in interface BGAreaManager
See Also:
BGAreaManager.removeBGFromArea(org.olat.group.BusinessGroup, org.olat.group.area.BGArea)

findBusinessGroupsOfArea

public java.util.List findBusinessGroupsOfArea(BGArea area)
Description copied from interface: BGAreaManager
Searches for all business groups that are associated with the given business group area

Specified by:
findBusinessGroupsOfArea in interface BGAreaManager
Returns:
A list of business groups
See Also:
BGAreaManager.findBusinessGroupsOfArea(org.olat.group.area.BGArea)

findBusinessGroupsOfAreaAttendedBy

public java.util.List findBusinessGroupsOfAreaAttendedBy(Identity identity,
                                                         java.lang.String areaName,
                                                         BGContext context)
Description copied from interface: BGAreaManager
Searches for all business groups that are associated with the given business group area where the given identity is in the participants group

Specified by:
findBusinessGroupsOfAreaAttendedBy in interface BGAreaManager
Returns:
A list of business groups
See Also:
BGAreaManager.findBusinessGroupsOfAreaAttendedBy(org.olat.core.id.Identity, java.lang.String, org.olat.group.context.BGContext)

findBGAreasOfBusinessGroup

public java.util.List findBGAreasOfBusinessGroup(BusinessGroup group)
Description copied from interface: BGAreaManager
Searches for all business group areas associated with the given business group

Specified by:
findBGAreasOfBusinessGroup in interface BGAreaManager
Returns:
A list of business group area
See Also:
BGAreaManager.findBGAreasOfBusinessGroup(org.olat.group.BusinessGroup)

countBGAreasOfBGContext

public int countBGAreasOfBGContext(BGContext groupContext)
Description copied from interface: BGAreaManager
Counts the number of business group areas of the given business group context

Specified by:
countBGAreasOfBGContext in interface BGAreaManager
Returns:
Number of business gropu areas
See Also:
BGAreaManager.countBGAreasOfBGContext(org.olat.group.context.BGContext)

findBGAreasOfBGContext

public java.util.List findBGAreasOfBGContext(BGContext groupContext)
Description copied from interface: BGAreaManager
Searches for all business group areas in the given business group context

Specified by:
findBGAreasOfBGContext in interface BGAreaManager
Returns:
A list of business group areas
See Also:
BGAreaManager.findBGAreasOfBGContext(org.olat.group.context.BGContext)

isIdentityInBGArea

public boolean isIdentityInBGArea(Identity identity,
                                  java.lang.String areaName,
                                  BGContext groupContext)
Description copied from interface: BGAreaManager
Checks if an identity is in a business group areas with a given name in the given group context

Specified by:
isIdentityInBGArea in interface BGAreaManager
Returns:
true if identity is in such an area, false otherwhise
See Also:
BGAreaManager.isIdentityInBGArea(org.olat.core.id.Identity, java.lang.String, org.olat.group.context.BGContext)

reloadArea

public BGArea reloadArea(BGArea area)
Description copied from interface: BGAreaManager
Reloads the business group area from the database or the hibernate second level cache

Specified by:
reloadArea in interface BGAreaManager
Returns:
The reloaded area
See Also:
BGAreaManager.reloadArea(org.olat.group.area.BGArea)

checkIfOneOrMoreNameExistsInContext

public boolean checkIfOneOrMoreNameExistsInContext(java.util.Set<java.lang.String> allNames,
                                                   BGContext bgContext)
Description copied from interface: BGAreaManager
checks if one or more of the given names exists already in the context.

Specified by:
checkIfOneOrMoreNameExistsInContext in interface BGAreaManager
Returns: