org.sakaiproject.section.api
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

Nested Class Summary
static class SectionManager.ExternalIntegrationConfig
          Describes the configuration for the SectionManager service and the Section Info tool: MANUAL_MANDATORY - The Section Info tool does not allow for externally managed sections, and sections will never be created automatically MANUAL_DEFAULT - The Section Info tool allows the user to choose whether sections should be internally or externally managed.
 
Field Summary
static String CONFIGURATION_KEY
           
 
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)
          Deprecated.  
 ParticipationRecord addSectionMembership(String userUid, Role role, String sectionUuid)
          Adds a user to a section under the specified role.
 Collection<CourseSection> addSections(String courseUuid, Collection<CourseSection> sections)
          Adds multiple sections at once.
 void disbandSection(String sectionUuid)
          Disbands a course section.
 void disbandSections(Set<String> sectionUuids)
          Disbands course sections.
 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<EnrollmentRecord> 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.
 SectionManager.ExternalIntegrationConfig getConfiguration(Object obj)
          Gets the application-wide configuration setting.
 Course getCourse(String siteContext)
          Gets the course (whatever that means) associated with this site context.
 Map getEnrollmentCount(List sectionSet)
          Gets the enrollment size for a set of sections.
 CourseSection getSection(String sectionUuid)
          Gets a CourseSection by its uuid.
 List<String> getSectionCategories(String siteContext)
          Gets the list of section categories.
 List<EnrollmentRecord> getSectionEnrollments(String sectionUuid)
          Gets a list of EnrollmentRecords belonging to a section.
 Set<EnrollmentRecord> 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<CourseSection> getSections(String siteContext)
          Gets the sections associated with this site context.
 List<CourseSection> getSectionsInCategory(String siteContext, String categoryId)
          Lists the sections in this context that are a member of the given category.
 List<ParticipationRecord> getSectionTeachingAssistants(String sectionUuid)
          Gets a list of ParticipationRecords for all TAs in a section.
 Map<String,List<ParticipationRecord>> getSectionTeachingAssistantsMap(List sectionSet)
          Gets the list of Teaching Assistants for a set of sections
 User getSiteEnrollment(String siteContext, String studentUid)
          Gets a single User object for a student in a site.
 List<EnrollmentRecord> getSiteEnrollments(String siteContext)
          Gets a list of EnrollmentRecords belonging to the current site.
 List<ParticipationRecord> getSiteInstructors(String siteContext)
          Gets a list of ParticipationRecords for all instructors in the current site.
 List<ParticipationRecord> 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.
 Map getTotalEnrollmentsMap(String learningContextUuid)
          Returns the total number of students enrolled in a learning context by section role.
 List<EnrollmentRecord> 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 isExternallyManaged(String courseUuid)
          Determines whether a course is externally managed.
 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.
 EnrollmentRecord joinSection(String sectionUuid, int maxSize)
          Adds the current user to a section as a student, enforcing a maximum permitted size.
 void setExternallyManaged(String courseUuid, boolean externallyManaged)
          Sets a course as externally or internally managed.
 void setJoinOptions(String courseUuid, boolean joinAllowed, boolean switchAllowed)
          Sets the join/switch options for a course.
 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 switchSection(String newSectionUuid)
          Switches a student's currently assigned section.
 void switchSection(String newSectionUuid, int maxSize)
          Switches a student's currently assigned section, enforcing a maximum permitted size.
 void updateSection(String sectionUuid, String title, Integer maxEnrollments, List<Meeting> meetings)
          Updates a section and all of its meetings.
 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)
          Deprecated.  
 

Field Detail

CONFIGURATION_KEY

static final String CONFIGURATION_KEY
See Also:
Constant Field Values
Method Detail

getCourse

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

List<CourseSection> 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

List<CourseSection> 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

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

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

getSiteInstructors

List<ParticipationRecord> 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

List<ParticipationRecord> 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

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

Parameters:
sectionUuid - The section uuid
Returns:
The TAs

getSiteEnrollments

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

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

getSectionEnrollments

List<EnrollmentRecord> getSectionEnrollments(String sectionUuid)
Gets a list of EnrollmentRecords belonging to a section.

Parameters:
sectionUuid - The section uuid
Returns:
The enrollments

findSiteEnrollments

List<EnrollmentRecord> 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

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

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.

joinSection

EnrollmentRecord joinSection(String sectionUuid,
                             int maxSize)
                             throws RoleConfigurationException,
                                    SectionFullException
Adds the current user to a section as a student, enforcing a maximum permitted size.

Parameters:
sectionUuid -
maxSize -
Throws:
RoleConfigurationException - If there is no valid student role, or if there is more than one group-scoped role flagged as a student role.
SectionFullException - If adding the user would exceed the size limit

switchSection

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.

switchSection

void switchSection(String newSectionUuid,
                   int maxSize)
                   throws RoleConfigurationException,
                          SectionFullException
Switches a student's currently assigned section, enforcing a maximum permitted size. 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.
SectionFullException - If adding the user would exceed the size limit

getTotalEnrollments

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.

Parameters:
sectionUuid -
Returns:

getTotalEnrollmentsMap

Map getTotalEnrollmentsMap(String learningContextUuid)
Returns the total number of students enrolled in a learning context by section role. Useful for comparing to the max number of enrollments allowed in a section.

Parameters:
sectionUuid -
Returns:

addSectionMembership

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

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

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

Parameters:
userUid -
sectionUuid -

dropEnrollmentFromCategory

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

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)
Deprecated. 

Adds a CourseSection with a single meeting time to a parent CourseSection. This method is deprecated. Please use addSection(String courseUuid, String title, String category, Integer maxEnrollments, List meetings)

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

addSections

Collection<CourseSection> addSections(String courseUuid,
                                      Collection<CourseSection> sections)
Adds multiple sections at once. This should help address the inefficiencies described in http://bugs.sakaiproject.org/jira/browse/SAK-7503. Meeting times should be, but are not handled by an external calendar service. So, the added functionality of linking course sections to repeating events (meet every 2nd Tuesday of the month at 3pm) is currently out of scope. Instead, meetings are represented as a start time, end time, and seven booleans representing the days that the section meets.

Parameters:
courseUuid -
sections -

updateSection

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)
Deprecated. 

Updates the persistent representation of the given CourseSection. Once a section is created, its category is immutable. This method will remove all but one Meeting associated with this CourseSection. To update a CourseSection and all of its meetings, use updateSection(String sectionUuid, String title, Integer maxEnrollments, List meetings).

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

updateSection

void updateSection(String sectionUuid,
                   String title,
                   Integer maxEnrollments,
                   List<Meeting> meetings)
Updates a section and all of its meetings. Notice that you can not change a section's category once it's been created.

Parameters:
sectionUuid -
title -
maxEnrollments -
meetings -

disbandSection

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

Parameters:
sectionUuid -

disbandSections

void disbandSections(Set<String> sectionUuids)
Disbands course sections. This does not affect enrollment records for the course.

Parameters:
sectionUuids -

isSelfRegistrationAllowed

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

Parameters:
courseUuid -
Returns:

isSelfSwitchingAllowed

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:

setJoinOptions

void setJoinOptions(String courseUuid,
                    boolean joinAllowed,
                    boolean switchAllowed)
Sets the join/switch options for a course.

Parameters:
courseUuid -
joinAllowed -
switchAllowed -

isExternallyManaged

boolean isExternallyManaged(String courseUuid)
Determines whether a course is externally managed.

Parameters:
courseUuid -
Returns:

setExternallyManaged

void setExternallyManaged(String courseUuid,
                          boolean externallyManaged)
Sets a course as externally or internally managed.

Parameters:
courseUuid -
externallyManaged -

getUnsectionedEnrollments

List<EnrollmentRecord> 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.

getEnrollmentCount

Map getEnrollmentCount(List sectionSet)
Gets the enrollment size for a set of sections.

Parameters:
sectionSet -
Returns:
A Map (sectionUuid, size)

getSectionTeachingAssistantsMap

Map<String,List<ParticipationRecord>> getSectionTeachingAssistantsMap(List sectionSet)
Gets the list of Teaching Assistants for a set of sections

Parameters:
sectionSet -
Returns:
A Map (sectionUuid, List ) of TAs for each section

getSectionEnrollments

Set<EnrollmentRecord> 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

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

List<String> getSectionCategories(String siteContext)
Gets the list of section categories. These are not 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.

getSiteEnrollment

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

getConfiguration

SectionManager.ExternalIntegrationConfig getConfiguration(Object obj)
Gets the application-wide configuration setting.

Parameters:
obj - An object to pass any necessary context information.
Returns:


Copyright © 2011 Sakai Project. All Rights Reserved.