org.sakaiproject.component.section
Class SectionAwarenessHibernateImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.sakaiproject.component.section.SectionAwarenessHibernateImpl
All Implemented Interfaces:
SectionAwareness, org.springframework.beans.factory.InitializingBean

public class SectionAwarenessHibernateImpl
extends org.springframework.orm.hibernate3.support.HibernateDaoSupport
implements SectionAwareness

Hibernate based implementation of SectionAwareness.

Author:
Josh Holtzman

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface org.sakaiproject.section.api.SectionAwareness
INSTRUCTOR_MARKER, STUDENT_MARKER, TA_MARKER
 
Constructor Summary
SectionAwarenessHibernateImpl()
           
 
Method Summary
 List findSiteMembersInRole(String siteContext, Role role, String pattern)
          The sakai implementation will not use the database to do this kind of searching, so I'll skip doing optimizations here.
 String getCategoryName(String categoryId, Locale locale)
          Gets the localized name of a given category.
 CourseSection getSection(String sectionUuid)
          Gets a CourseSection by its uuid.
 List getSectionCategories(String siteContext)
          Gets the list of section categories.
 String getSectionCategory(String sectionUuid)
           
 List getSectionMembers(String sectionUuid)
          Gets the full membership of the given section.
 List getSectionMembersInRole(String sectionUuid, Role role)
          Gets the members of a given section that play a given role in the section.
 String getSectionName(String sectionUuid)
           
 List getSections(String siteContext)
          Gets the sections associated with this site context.
 List getSectionsInCategory(String siteContext, String categoryId)
          Lists the sections in this context that are a member of the given category.
 List getSiteMembersInRole(String siteContext, Role role)
          Gets the site membership for a given context.
 List getUnassignedMembersInRole(String siteContext, Role role)
          Gets all users who are members of a site but are members of zero sections within the site.
 boolean isSectionMemberInRole(String sectionUuid, String userUid, Role role)
          Checks whether a user plays a particular Role in a section.
 boolean isSiteMemberInRole(String siteContext, String userUid, Role role)
          Checks whether a user plays a particular Role in a given site context.
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SectionAwarenessHibernateImpl

public SectionAwarenessHibernateImpl()
Method Detail

getSections

public List getSections(String siteContext)
Description copied from interface: SectionAwareness
Gets the sections associated with this site context.

Specified by:
getSections in interface SectionAwareness
Parameters:
siteContext - The site context
Returns:
The List of CourseSections associated with this site context.

getSectionCategories

public List getSectionCategories(String siteContext)
Description copied from interface: SectionAwareness
Gets the list of section categories. In sakai 2.1, there will be only a single set of categories. They will not be configurable on a per-course or per-context bases. In future versions, the list of categories will be configurable at the site level.

Specified by:
getSectionCategories in interface SectionAwareness
Parameters:
siteContext - The site context
Returns:
A List of unique Strings that identify the available section categories. These should be internationalized for display using getCategoryName.

getSection

public CourseSection getSection(String sectionUuid)
Description copied from interface: SectionAwareness
Gets a CourseSection by its uuid.

Specified by:
getSection in interface SectionAwareness
Returns:

getSiteMembersInRole

public List getSiteMembersInRole(String siteContext,
                                 Role role)
Description copied from interface: SectionAwareness
Gets the site membership for a given context.

Specified by:
getSiteMembersInRole in interface SectionAwareness
Parameters:
siteContext - The site context
Returns:
A List of ParticipationRecords representing the users in the given site, playing the given Role.

findSiteMembersInRole

public List findSiteMembersInRole(String siteContext,
                                  Role role,
                                  String pattern)
The sakai implementation will not use the database to do this kind of searching, so I'll skip doing optimizations here.

Specified by:
findSiteMembersInRole in interface SectionAwareness
Parameters:
siteContext - The site context
role - The role the user must play in this context
pattern - The pattern the user's name or id must match
Returns:
A List of ParticipationRecords representing the users in the given site, playing the given role, that match the string pattern.

isSiteMemberInRole

public boolean isSiteMemberInRole(String siteContext,
                                  String userUid,
                                  Role role)
Description copied from interface: SectionAwareness
Checks whether a user plays a particular Role in a given site context.

Specified by:
isSiteMemberInRole in interface SectionAwareness
Parameters:
siteContext - The site context
userUid - The user's unique id
role - The role we're checking
Returns:
Whether this user plays this role in this context.

getSectionMembers

public List getSectionMembers(String sectionUuid)
Description copied from interface: SectionAwareness
Gets the full membership of the given section.

Specified by:
getSectionMembers in interface SectionAwareness
Returns:
A List of ParticipationRecords representing the users in a CourseSection.

getSectionMembersInRole

public List getSectionMembersInRole(String sectionUuid,
                                    Role role)
Description copied from interface: SectionAwareness
Gets the members of a given section that play a given role in the section.

Specified by:
getSectionMembersInRole in interface SectionAwareness
Returns:
A List of ParticipationRecords representing the users in a CourseSection that play a given Role.

isSectionMemberInRole

public boolean isSectionMemberInRole(String sectionUuid,
                                     String userUid,
                                     Role role)
Description copied from interface: SectionAwareness
Checks whether a user plays a particular Role in a section.

Specified by:
isSectionMemberInRole in interface SectionAwareness
Returns:
Whether the user plays a particular role in a section.

getSectionName

public String getSectionName(String sectionUuid)

getSectionCategory

public String getSectionCategory(String sectionUuid)

getSectionsInCategory

public List getSectionsInCategory(String siteContext,
                                  String categoryId)
Description copied from interface: SectionAwareness
Lists the sections in this context that are a member of the given category.

Specified by:
getSectionsInCategory in interface SectionAwareness
Parameters:
siteContext - The site context
Returns:
A List of CourseSections

getCategoryName

public String getCategoryName(String categoryId,
                              Locale locale)
Description copied from interface: SectionAwareness
Gets the localized name of a given category.

Specified by:
getCategoryName in interface SectionAwareness
Parameters:
categoryId - A string identifying the category
locale - The locale of the client
Returns:
An internationalized string to display for this category.

getUnassignedMembersInRole

public List getUnassignedMembersInRole(String siteContext,
                                       Role role)
Description copied from interface: SectionAwareness
Gets all users who are members of a site but are members of zero sections within the site.

Specified by:
getUnassignedMembersInRole in interface SectionAwareness
Parameters:
siteContext - The site context
role - The role that the user must play in the given site
Returns:
A List of ParticipationRecords


Copyright © 2011 Sakai Project. All Rights Reserved.