org.sakaiproject.api.section
Interface SectionAwareness

All Known Implementing Classes:
SectionAwarenessHibernateImpl, SectionAwarenessImpl

public interface SectionAwareness

Provides section awareness to tools needing read-only access to section information, such as section membership.

Author:
Ray Davis, Josh Holtzman

Field Summary
static String CATEGORY_BUNDLE
          The resource bundle containing the category IDs and names
static String INSTRUCTOR_MARKER
          The permission "marker" indicating that a role is the instructor role
static String STUDENT_MARKER
          The permission "marker" indicating that a role is the student role
static String TA_MARKER
          The permission "marker" indicating that a role is the ta role
 
Method Summary
 List findSiteMembersInRole(String siteContext, Role role, String pattern)
          Finds site members in the given context and Role with a matching name or display id.
 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.
 List getSectionMembers(String sectionId)
          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.
 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 sectionId, String personId, 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.
 

Field Detail

CATEGORY_BUNDLE

public static final String CATEGORY_BUNDLE
The resource bundle containing the category IDs and names

See Also:
Constant Field Values

STUDENT_MARKER

public static final String STUDENT_MARKER
The permission "marker" indicating that a role is the student role

See Also:
Constant Field Values

TA_MARKER

public static final String TA_MARKER
The permission "marker" indicating that a role is the ta role

See Also:
Constant Field Values

INSTRUCTOR_MARKER

public static final String INSTRUCTOR_MARKER
The permission "marker" indicating that a role is the instructor role

See Also:
Constant Field Values
Method Detail

getSections

public List getSections(String siteContext)
Gets the sections associated with this site context.

Parameters:
siteContext - The site context
Returns:
The List of CourseSections associated with this site context.

getSectionCategories

public List getSectionCategories(String siteContext)
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.

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)
Gets a CourseSection by its uuid.

Parameters:
sectionUuid -
Returns:

getSiteMembersInRole

public List getSiteMembersInRole(String siteContext,
                                 Role role)
Gets the site membership for a given context.

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)
Finds site members in the given context and Role with a matching name or display id. Pattern matching is TBD, but will probably match in any of the following cases:

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)
Checks whether a user plays a particular Role in a given site context.

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 sectionId)
Gets the full membership of the given section.

Parameters:
sectionId -
Returns:
A List of ParticipationRecords representing the users in a CourseSection.

getSectionMembersInRole

public List getSectionMembersInRole(String sectionUuid,
                                    Role role)
Gets the members of a given section that play a given role in the section.

Parameters:
sectionUuid -
role -
Returns:
A List of ParticipationRecords representing the users in a CourseSection that play a given Role.

isSectionMemberInRole

public boolean isSectionMemberInRole(String sectionId,
                                     String personId,
                                     Role role)
Checks whether a user plays a particular Role in a section.

Parameters:
sectionId -
personId -
role -
Returns:
Whether the user plays a particular role in a section.

getUnassignedMembersInRole

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

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

getSectionsInCategory

public List getSectionsInCategory(String siteContext,
                                  String categoryId)
Lists the sections in this context that are a member of the given category.

Parameters:
siteContext - The site context
categoryId -
Returns:
A List of CourseSections

getCategoryName

public String getCategoryName(String categoryId,
                              Locale locale)
Gets the localized name of a given category.

Parameters:
categoryId - A string identifying the category
locale - The locale of the client
Returns:
An internationalized string to display for this category.