org.sakaiproject.api.section
Interface SectionManager

All Known Implementing Classes:
SectionManagerHibernateImpl, SectionManagerImpl

public interface SectionManager

An internal service interface for the Section Manager Tool (AKA "Section Info") to provide for the creation, modification, and removal of CourseSections, along with the membership of of these sections. This service is not to be used outside of the Section Manager Tool.

Author:
Josh Holtzman

Method Summary
 CourseSection addSection(String courseUuid, String title, String category, Integer maxEnrollments, String location, Time startTime, Time endTime, boolean monday, boolean tuesday, boolean wednesday, boolean thursday, boolean friday, boolean saturday, boolean sunday)
          Adds a CourseSection to a parent CourseSection.
 ParticipationRecord addSectionMembership(String userUid, Role role, String sectionUuid)
          Adds a user to a section under the specified role.
 void disbandSection(String sectionUuid)
          Disbands a course section.
 void dropEnrollmentFromCategory(String studentUid, String siteContext, String category)
          Removes the user from any enrollment to a section of the given category.
 void dropSectionMembership(String userUid, String sectionUuid)
          Removes a user from a section.
 List findSiteEnrollments(String siteContext, String pattern)
          Finds a list of EnrollmentRecords belonging to the current site and whose sort name, display name, or display id start with the given string pattern.
 String getCategoryName(String categoryId, Locale locale)
          Gets the localized name of a given category.
 Course getCourse(String siteContext)
          Gets the course (whatever that means) associated with this site context.
 CourseSection getSection(String sectionUuid)
          Gets a CourseSection by its uuid.
 List getSectionCategories(String siteContext)
          Gets the list of section categories.
 List getSectionEnrollments(String sectionUuid)
          Gets a list of EnrollmentRecords belonging to a section.
 Set getSectionEnrollments(String userUid, String courseUuid)
          Gets all of the section enrollments for a user in a course.
 SectionEnrollments getSectionEnrollmentsForStudents(String siteContext, Set studentUids)
          Gets a SectionEnrollments data structure for the given students.
 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 getSectionTeachingAssistants(String sectionUuid)
          Gets a list of ParticipationRecords for all TAs in a section.
 User getSiteEnrollment(String siteContext, String studentUid)
          Gets a single User object for a student in a site.
 List getSiteEnrollments(String siteContext)
          Gets a list of EnrollmentRecords belonging to the current site.
 List getSiteInstructors(String siteContext)
          Gets a list of ParticipationRecords for all instructors in the current site.
 List getSiteTeachingAssistants(String siteContext)
          Gets a list of ParticipationRecords for all TAs in the current site.
 int getTotalEnrollments(String learningContextUuid)
          Returns the total number of students enrolled in a learning context.
 List getUnsectionedEnrollments(String courseUuid, String category)
          The Section Manager tool could use more specific queries on membership, such as this: getting all students in a primary section that are not enrolled in any secondary sections of a given type.
 boolean isSelfRegistrationAllowed(String courseUuid)
          Determines whether students can enroll themselves in a section.
 boolean isSelfSwitchingAllowed(String courseUuid)
          Determines whether students can switch sections once they are enrolled in a section of a given category (for instance, swapping one lab for another).
 EnrollmentRecord joinSection(String sectionUuid)
          Adds the current user to a section as a student.
 void setSectionMemberships(Set userUids, Role role, String sectionId)
          Defines the complete set of users that make up the members of a section in a given role.
 void setSelfRegistrationAllowed(String courseUuid, boolean allowed)
          Sets the "self registration" status of a section.
 void setSelfSwitchingAllowed(String courseUuid, boolean allowed)
          Sets the "student switching" status of a primary section.
 void switchSection(String newSectionUuid)
          Switches a student's currently assigned section.
 void updateSection(String sectionUuid, String title, Integer maxEnrollments, String location, Time startTime, Time endTime, boolean monday, boolean tuesday, boolean wednesday, boolean thursday, boolean friday, boolean saturday, boolean sunday)
          Updates the persistent representation of the given CourseSection.
 

Method Detail

getCourse

public Course getCourse(String siteContext)
Gets the course (whatever that means) associated with this site context.

Parameters:
siteContext - The site context
Returns:
The course (whatever that means)

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.

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

getSection

public CourseSection getSection(String sectionUuid)
Gets a CourseSection by its uuid.

Parameters:
sectionUuid - The uuid of a section
Returns:
A section

getSiteInstructors

public List getSiteInstructors(String siteContext)
Gets a list of ParticipationRecords for all instructors in the current site.

Parameters:
siteContext - The current site context
Returns:
The instructors

getSiteTeachingAssistants

public List getSiteTeachingAssistants(String siteContext)
Gets a list of ParticipationRecords for all TAs in the current site.

Parameters:
siteContext - The current site context
Returns:
The TAs

getSectionTeachingAssistants

public List getSectionTeachingAssistants(String sectionUuid)
Gets a list of ParticipationRecords for all TAs in a section.

Parameters:
sectionUuid - The section uuid
Returns:
The TAs

getSiteEnrollments

public List getSiteEnrollments(String siteContext)
Gets a list of EnrollmentRecords belonging to the current site.

Parameters:
siteContext - The current site context
Returns:
The enrollments

getSectionEnrollments

public List getSectionEnrollments(String sectionUuid)
Gets a list of EnrollmentRecords belonging to a section.

Parameters:
sectionUuid - The section uuid
Returns:
The enrollments

findSiteEnrollments

public List findSiteEnrollments(String siteContext,
                                String pattern)
Finds a list of EnrollmentRecords belonging to the current site and whose sort name, display name, or display id start with the given string pattern.

Parameters:
siteContext - The current site context
pattern - The pattern to match students names or ids
Returns:
The enrollments

getSectionEnrollmentsForStudents

public SectionEnrollments getSectionEnrollmentsForStudents(String siteContext,
                                                           Set studentUids)
Gets a SectionEnrollments data structure for the given students.

Parameters:
siteContext - The site context
studentUids - The Set of userUids to include in the SectionEnrollments
Returns:

joinSection

public EnrollmentRecord joinSection(String sectionUuid)
                             throws RoleConfigurationException
Adds the current user to a section as a student. This is a convenience method for addSectionMembership(currentUserId, Role.STUDENT, sectionId).

Parameters:
sectionUuid -
Throws:
RoleConfigurationException - If there is no valid student role, or if there is more than one group-scoped role flagged as a student role.

switchSection

public void switchSection(String newSectionUuid)
                   throws RoleConfigurationException
Switches a student's currently assigned section. If the student is enrolled in another section of the same type, that enrollment will be dropped. This is a convenience method to allow a drop/add (a switch) in a single transaction.

Parameters:
newSectionUuid - The new section uuid to which the student should be assigned
Throws:
RoleConfigurationException - If there is no valid student role, or if there is more than one group-scoped role flagged as a student role.

getTotalEnrollments

public int getTotalEnrollments(String learningContextUuid)
Returns the total number of students enrolled in a learning context. Useful for comparing to the max number of enrollments allowed in a section.

Returns:

addSectionMembership

public ParticipationRecord addSectionMembership(String userUid,
                                                Role role,
                                                String sectionUuid)
                                         throws MembershipException,
                                                RoleConfigurationException
Adds a user to a section under the specified role. If a student is added to a section, s/he will be automatically removed from any other section of the same category in this site. So adding 'student1' to 'Lab1', for example, will automatically remove 'student1' from 'Lab2'. TAs may be added to multiple sections in a site regardless of category.

Parameters:
userUid -
role -
sectionUuid -
Throws:
MembershipException - Only students and TAs can be members of a section. Instructor roles are assigned only at the course level.
RoleConfigurationException - Thrown when no sakai role can be identified to represent the given role.

setSectionMemberships

public void setSectionMemberships(Set userUids,
                                  Role role,
                                  String sectionId)
                           throws RoleConfigurationException
Defines the complete set of users that make up the members of a section in a given role. This is useful when doing bulk modifications of section membership.

Parameters:
userUids - The set of userUids as strings
sectionId - The sectionId
Throws:
RoleConfigurationException - If there is no properly configured role in the site matching the role specified.

dropSectionMembership

public void dropSectionMembership(String userUid,
                                  String sectionUuid)
Removes a user from a section.

Parameters:
userUid -
sectionUuid -

dropEnrollmentFromCategory

public void dropEnrollmentFromCategory(String studentUid,
                                       String siteContext,
                                       String category)
Removes the user from any enrollment to a section of the given category.

Parameters:
studentUid -
siteContext -
category -

addSection

public CourseSection addSection(String courseUuid,
                                String title,
                                String category,
                                Integer maxEnrollments,
                                String location,
                                Time startTime,
                                Time endTime,
                                boolean monday,
                                boolean tuesday,
                                boolean wednesday,
                                boolean thursday,
                                boolean friday,
                                boolean saturday,
                                boolean sunday)
Adds a CourseSection to a parent CourseSection. This assumes that meeting times will not be handled by an external service. The added functionality of linking course sections to repeating events (meet every 2nd Tuesday of the month at 3pm) is currently out of scope, so meetingTimes is represented as a start time, end time, and seven booleans representing the days that the section meets.

Parameters:
courseUuid -
title -
category -
maxEnrollments -
location -
startTime -
endTime -
monday -
tuesday -
wednesday -
thursday -
friday -
saturday -
sunday -
Returns:

updateSection

public void updateSection(String sectionUuid,
                          String title,
                          Integer maxEnrollments,
                          String location,
                          Time startTime,
                          Time endTime,
                          boolean monday,
                          boolean tuesday,
                          boolean wednesday,
                          boolean thursday,
                          boolean friday,
                          boolean saturday,
                          boolean sunday)
Updates the persistent representation of the given CourseSection. Once a section is created, its category is immutable.

Parameters:
sectionUuid -
title -
maxEnrollments -
location -
startTime -
endTime -
monday -
tuesday -
wednesday -
thursday -
friday -
saturday -
sunday -

disbandSection

public void disbandSection(String sectionUuid)
Disbands a course section. This does not affect enrollment records for the course.

Parameters:
sectionUuid -

isSelfRegistrationAllowed

public boolean isSelfRegistrationAllowed(String courseUuid)
Determines whether students can enroll themselves in a section.

Parameters:
courseUuid -
Returns:

setSelfRegistrationAllowed

public void setSelfRegistrationAllowed(String courseUuid,
                                       boolean allowed)
Sets the "self registration" status of a section.

Parameters:
courseUuid -
allowed -

isSelfSwitchingAllowed

public boolean isSelfSwitchingAllowed(String courseUuid)
Determines whether students can switch sections once they are enrolled in a section of a given category (for instance, swapping one lab for another).

Parameters:
courseUuid -
Returns:

setSelfSwitchingAllowed

public void setSelfSwitchingAllowed(String courseUuid,
                                    boolean allowed)
Sets the "student switching" status of a primary section.

Parameters:
allowed -

getUnsectionedEnrollments

public List getUnsectionedEnrollments(String courseUuid,
                                      String category)
The Section Manager tool could use more specific queries on membership, such as this: getting all students in a primary section that are not enrolled in any secondary sections of a given type. For instance, 'Who are the students who are not enrolled in any lab?'

Returns:
A List of EnrollmentRecords of students who are enrolled in the course but are not enrolled in a section of the given section category.

getSectionEnrollments

public Set getSectionEnrollments(String userUid,
                                 String courseUuid)
Gets all of the section enrollments for a user in a course. Useful for listing all of the sections in which a student is enrolled.

Parameters:
userUid -
courseUuid -
Returns:
A Set of EnrollmentRecords

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.

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.

Parameters:
siteContext - The site context (which is not used in the current implementation)
Returns:
A List of unique Strings that identify the available section categories. These should be internationalized for display using getCategoryName.

getSiteEnrollment

public User getSiteEnrollment(String siteContext,
                              String studentUid)
Gets a single User object for a student in a site.

Parameters:
siteContext - Needed by the standalone implementation to find the user
studentUid -
Returns:
The User representing this student