org.sakaiproject.coursemanagement.impl
Class CourseManagementServiceSampleChainImpl

java.lang.Object
  extended by org.sakaiproject.coursemanagement.impl.CourseManagementServiceSampleChainImpl
All Implemented Interfaces:
CourseManagementService

public class CourseManagementServiceSampleChainImpl
extends Object
implements CourseManagementService

A template to use when implementing CourseManagementService to provide course and enrollment data in a federated CM configuration. Extending this class should be useful for institutions intending to federate external datasources (via webservices, SIS APIs, etc) with Sakai's hibernate-based CourseManagementService.

Author:
Josh Holtzman

Constructor Summary
CourseManagementServiceSampleChainImpl()
           
 
Method Summary
 List<CourseOffering> findActiveCourseOfferingsInCanonicalCourse(String eid)
          Find the currently offered course offerings in the cannonical course
 Map findCourseOfferingRoles(String userEid)
          Finds the CourseOfferings (and roles) for which a user is a member.
 Set findCourseOfferings(String courseSetEid, String academicSessionEid)
          Finds all of the course offerings in a course set that are current for any given academic session (regardless of the courseOffering's start and end dates).
 Map findCourseSetRoles(String userEid)
          Finds the CourseSets (and roles) for which a user is a member.
 List findCourseSets(String category)
          Finds all course sets in a given category.
 Set findCurrentlyEnrolledEnrollmentSets(String userId)
          Finds the set of current EnrollmentSets for which a user is enrolled but not dropped.
 Set findCurrentlyInstructingEnrollmentSets(String userId)
          Finds the set of current EnrollmentSets for which a user is an instructor of record.
 Set findEnrolledSections(String userId)
          Finds all Sections that are linked to an EnrollmentSet for which a user is enrolled (but not dropped).
 Enrollment findEnrollment(String userId, String eid)
          Finds the Enrollment for a user in an EnrollmentSet.
 Set findInstructingSections(String userId)
          Finds all Sections that are linked to an EnrollmentSet for which a user is an instructor of record.
 Set findInstructingSections(String userId, String academicSessionEid)
          Finds all Sections that are linked to an EnrollmentSet for which a user is an instructor of record and which are part of a CourseOffering in a given AcademicSession.
 Map findSectionRoles(String userEid)
          Finds the Sections (and roles) for which a user is a member.
 AcademicSession getAcademicSession(String academicSessionEid)
          Gets a AcademicSession by its eid.
 List getAcademicSessions()
          Gets the list of all known AcademicSessions, sorted by start date.
 CanonicalCourse getCanonicalCourse(String canonicalCourseEid)
          Gets a CanonicalCourse by its eid.
 Set getCanonicalCourses(String courseSetEid)
          Gets the CanonicalCourses in a CourseSet.
 Set getChildCourseSets(String parentCourseSetEid)
          Gets the child CourseSet from a parent CourseSet.
 Set getChildSections(String parentSectionEid)
          Gets the child Sections from a parent Section.
 CourseOffering getCourseOffering(String courseOfferingEid)
          Gets a CourseOffering by its eid.
 Set getCourseOfferingMemberships(String courseOfferingEid)
          Gets the memberships directly contained by this CourseOffering.
 Set getCourseOfferingsInCanonicalCourse(String canonicalCourseEid)
          Finds all course offerings belonging to a canonical course.
 Set getCourseOfferingsInCourseSet(String courseSetEid)
          Gets the CourseOfferings in a CourseSet.
 CourseSet getCourseSet(String courseSetEid)
          Gets a CourseSet by its eid.
 Set getCourseSetMemberships(String courseSetEid)
          Gets the memberships directly contained by this CourseSet.
 Set getCourseSets()
          Gets all of the top level CourseSets
 List getCurrentAcademicSessions()
          Gets the list of current AcademicSessions, sorted by start date.
 Set getEnrollments(String enrollmentSetEid)
          Gets the Enrollments in an EnrollmentSet (including dropped enrollments)
 EnrollmentSet getEnrollmentSet(String enrollmentSetEid)
          Gets an EnrollmentSet by its eid.
 Set getEnrollmentSets(String courseOfferingEid)
          Gets the EnrollmentSets associated with a CourseOffering
 Map<String,String> getEnrollmentStatusDescriptions(Locale locale)
          Gets the known enrollment status codes and descriptions for Enrollments.
 Set getEquivalentCanonicalCourses(String canonicalCourseEid)
          Gets the equivalent CanonicalCourses.
 Set getEquivalentCourseOfferings(String courseOfferingEid)
          Gets any equivalent CourseOfferings.
 Map<String,String> getGradingSchemeDescriptions(Locale locale)
          Gets the known grading scheme codes and descriptions for Enrollments.
 Set getInstructorsOfRecordIds(String enrollmentSetEid)
          Gets the set of user ids that are, according to the enterprise, responsible for the EnrollmentSet.
 Map<String,String> getMembershipStatusDescriptions(Locale locale)
          Gets the known membership status codes and descriptions for Memberships.
 Section getSection(String sectionEid)
          Gets a Section by its eid.
 List<String> getSectionCategories()
          Gets the list of section categories defined by the institution.
 String getSectionCategoryDescription(String categoryCode)
          Gets the description for a category, identified by the category code, or null if the category code can not be found.
 Set getSectionMemberships(String sectionEid)
          Gets the members directly contained by this Section.
 Set getSections(String courseOfferingEid)
          Gets the top-level Sections associated with a CourseOffering
 boolean isAcademicSessionDefined(String eid)
          Checks whether an AcademicSession exists.
 boolean isCanonicalCourseDefined(String eid)
          Checks whether a CanonicalCourse exists.
 boolean isCourseOfferingDefined(String eid)
          Checks whether a CourseOffering exists.
 boolean isCourseSetDefined(String eid)
          Checks whether a CourseSet exists.
 boolean isEmpty(String courseSetEid)
          Determines whether a CourseSet has any CanonicalCourses or CourseSets.
 boolean isEnrolled(String userId, Set enrollmentSetEids)
          Determines whether a user is enrolled (and not dropped) in an EnrollmentSet.
 boolean isEnrolled(String userId, String eid)
          Convenience method for checking whether a user is enrolled (and not dropped) in an EnrollmentSet.
 boolean isEnrollmentSetDefined(String eid)
          Checks whether an EnrollmentSet exists.
 boolean isSectionDefined(String eid)
          Checks whether a Section exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CourseManagementServiceSampleChainImpl

public CourseManagementServiceSampleChainImpl()
Method Detail

findCourseOfferings

public Set findCourseOfferings(String courseSetEid,
                               String academicSessionEid)
                        throws IdNotFoundException
Description copied from interface: CourseManagementService
Finds all of the course offerings in a course set that are current for any given academic session (regardless of the courseOffering's start and end dates).

Specified by:
findCourseOfferings in interface CourseManagementService
Returns:
The set of course offerings
Throws:
IdNotFoundException

findCourseSets

public List findCourseSets(String category)
Description copied from interface: CourseManagementService
Finds all course sets in a given category. Useful for listing the departments

Specified by:
findCourseSets in interface CourseManagementService
Returns:
The list of course sets, sorted by title, ascending

findCurrentlyEnrolledEnrollmentSets

public Set findCurrentlyEnrolledEnrollmentSets(String userId)
Description copied from interface: CourseManagementService
Finds the set of current EnrollmentSets for which a user is enrolled but not dropped. An EnrollmentSet is considered current if its CourseOffering's start date (is null or prior to the current date/time) and its end date (is null or after the current date/time).

Specified by:
findCurrentlyEnrolledEnrollmentSets in interface CourseManagementService
Returns:

findCurrentlyInstructingEnrollmentSets

public Set findCurrentlyInstructingEnrollmentSets(String userId)
Description copied from interface: CourseManagementService
Finds the set of current EnrollmentSets for which a user is an instructor of record. An EnrollmentSet is considered current if its CourseOffering's start date (is null or prior to the current date/time) and its end date (is null or after the current date/time).

Specified by:
findCurrentlyInstructingEnrollmentSets in interface CourseManagementService
Returns:

findEnrollment

public Enrollment findEnrollment(String userId,
                                 String eid)
Description copied from interface: CourseManagementService
Finds the Enrollment for a user in an EnrollmentSet. If the user isn't in the EnrollmentSet, or the EnrollmentSet doesn't exist, this returns null. Note that this method will return enrollments flagged as "dropped". TODO Should this throw more descriptive exceptions e.g. when the EnrollmentSet doesn't exist?

Specified by:
findEnrollment in interface CourseManagementService
Returns:

findInstructingSections

public Set findInstructingSections(String userId)
Description copied from interface: CourseManagementService
Finds all Sections that are linked to an EnrollmentSet for which a user is an instructor of record.

Specified by:
findInstructingSections in interface CourseManagementService
Returns:

findInstructingSections

public Set findInstructingSections(String userId,
                                   String academicSessionEid)
                            throws IdNotFoundException
Description copied from interface: CourseManagementService
Finds all Sections that are linked to an EnrollmentSet for which a user is an instructor of record and which are part of a CourseOffering in a given AcademicSession.

Specified by:
findInstructingSections in interface CourseManagementService
Returns:
Throws:
IdNotFoundException

getAcademicSession

public AcademicSession getAcademicSession(String academicSessionEid)
                                   throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets a AcademicSession by its eid.

Specified by:
getAcademicSession in interface CourseManagementService
Returns:
The AcademicSession
Throws:
IdNotFoundException - If the eid is not associated with any AcademicSession

getAcademicSessions

public List getAcademicSessions()
Description copied from interface: CourseManagementService
Gets the list of all known AcademicSessions, sorted by start date.

Specified by:
getAcademicSessions in interface CourseManagementService
Returns:

getCanonicalCourse

public CanonicalCourse getCanonicalCourse(String canonicalCourseEid)
                                   throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets a CanonicalCourse by its eid.

Specified by:
getCanonicalCourse in interface CourseManagementService
Returns:
The CanonicalCourse
Throws:
IdNotFoundException - If the eid is not associated with any CanonicalCourse

getCanonicalCourses

public Set getCanonicalCourses(String courseSetEid)
                        throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the CanonicalCourses in a CourseSet.

Specified by:
getCanonicalCourses in interface CourseManagementService
Parameters:
courseSetEid - The eid of the CourseSet
Returns:
The set of CanonicalCourses in the CourseSet
Throws:
IdNotFoundException - If the eid is not associated with any CourseSet

getChildCourseSets

public Set getChildCourseSets(String parentCourseSetEid)
                       throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the child CourseSet from a parent CourseSet.

Specified by:
getChildCourseSets in interface CourseManagementService
Parameters:
parentCourseSetEid - The parent CourseSet eid
Returns:
The Set of child CourseSets
Throws:
IdNotFoundException

getChildSections

public Set getChildSections(String parentSectionEid)
                     throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the child Sections from a parent Section.

Specified by:
getChildSections in interface CourseManagementService
Parameters:
parentSectionEid - The parent Section eid
Returns:
The Set of child Sections
Throws:
IdNotFoundException - If the eid is not associated with any parent Section

getCourseOffering

public CourseOffering getCourseOffering(String courseOfferingEid)
                                 throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets a CourseOffering by its eid.

Specified by:
getCourseOffering in interface CourseManagementService
Returns:
The CourseOffering
Throws:
IdNotFoundException - If the eid is not associated with any CourseOffering

getCourseOfferingMemberships

public Set getCourseOfferingMemberships(String courseOfferingEid)
                                 throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the memberships directly contained by this CourseOffering.

Specified by:
getCourseOfferingMemberships in interface CourseManagementService
Returns:
The set of memberships in this CourseOffering. This is not a recursive set of Memberships.
Throws:
IdNotFoundException - If the eid is not associated with any CourseOffering

getCourseOfferingsInCourseSet

public Set getCourseOfferingsInCourseSet(String courseSetEid)
                                  throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the CourseOfferings in a CourseSet.

Specified by:
getCourseOfferingsInCourseSet in interface CourseManagementService
Parameters:
courseSetEid - The eid of the CourseSet
Returns:
The set of CourseOfferings in the CourseSet
Throws:
IdNotFoundException - If the eid is not associated with any CourseSet

getCourseSet

public CourseSet getCourseSet(String courseSetEid)
                       throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets a CourseSet by its eid.

Specified by:
getCourseSet in interface CourseManagementService
Parameters:
courseSetEid - The CourseSet's unique eid
Returns:
The CourseSet
Throws:
IdNotFoundException - If the eid is not associated with any CourseSet

getCourseSetMemberships

public Set getCourseSetMemberships(String courseSetEid)
                            throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the memberships directly contained by this CourseSet.

Specified by:
getCourseSetMemberships in interface CourseManagementService
Returns:
The set of memberships in this CourseSet. This is not a transitive set.
Throws:
IdNotFoundException - If the eid is not associated with any CourseSet

getCourseSets

public Set getCourseSets()
Description copied from interface: CourseManagementService
Gets all of the top level CourseSets

Specified by:
getCourseSets in interface CourseManagementService
Returns:
The Set of CourseSets that have no parent CourseSet

getCurrentAcademicSessions

public List getCurrentAcademicSessions()
Description copied from interface: CourseManagementService
Gets the list of current AcademicSessions, sorted by start date.

Specified by:
getCurrentAcademicSessions in interface CourseManagementService
Returns:

getEnrollmentSet

public EnrollmentSet getEnrollmentSet(String enrollmentSetEid)
                               throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets an EnrollmentSet by its eid.

Specified by:
getEnrollmentSet in interface CourseManagementService
Returns:
The EnrollmentSet
Throws:
IdNotFoundException - If the eid is not associated with any EnrollmentSet

getEnrollmentSets

public Set getEnrollmentSets(String courseOfferingEid)
                      throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the EnrollmentSets associated with a CourseOffering

Specified by:
getEnrollmentSets in interface CourseManagementService
Returns:
The Set of EnrollmentSets
Throws:
IdNotFoundException - If the eid is not associated with any CourseOffering

getEnrollments

public Set getEnrollments(String enrollmentSetEid)
                   throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the Enrollments in an EnrollmentSet (including dropped enrollments)

Specified by:
getEnrollments in interface CourseManagementService
Returns:
The Set of Enrollments
Throws:
IdNotFoundException - If the eid is not associated with any EnrollmentSet

getEquivalentCanonicalCourses

public Set getEquivalentCanonicalCourses(String canonicalCourseEid)
                                  throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the equivalent CanonicalCourses.

Specified by:
getEquivalentCanonicalCourses in interface CourseManagementService
Parameters:
canonicalCourseEid - The eid of the CanonicalCourse to use in finding equivalents
Returns:
The set of CanonicalCourses that are equivalent (in the Enterprise view, not in the Java view -- this is independent of CanonicalCourse.equals()).
Throws:
IdNotFoundException

getEquivalentCourseOfferings

public Set getEquivalentCourseOfferings(String courseOfferingEid)
                                 throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets any equivalent CourseOfferings.

Specified by:
getEquivalentCourseOfferings in interface CourseManagementService
Parameters:
courseOfferingEid - The eid of the CourseOffering to use in finding equivalents
Returns:
The set of CourseOfferings that are equivalent (in the Enterprise view, not in the Java view -- this is independent of CourseOffering.equals()).
Throws:
IdNotFoundException - If the eid is not associated with any CourseOffering

getInstructorsOfRecordIds

public Set getInstructorsOfRecordIds(String enrollmentSetEid)
                              throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the set of user ids that are, according to the enterprise, responsible for the EnrollmentSet. Responsibilities usually include submitting the final grades for students enrolled in the EnrollmentSet.

Specified by:
getInstructorsOfRecordIds in interface CourseManagementService
Returns:
The set of ids for users who are responsible for this EnrollmentSet
Throws:
IdNotFoundException - If the eid is not associated with any EnrollmentSet

getSection

public Section getSection(String sectionEid)
                   throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets a Section by its eid.

Specified by:
getSection in interface CourseManagementService
Returns:
The Section
Throws:
IdNotFoundException - If the eid is not associated with any Section

getSectionMemberships

public Set getSectionMemberships(String sectionEid)
                          throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the members directly contained by this Section.

Specified by:
getSectionMemberships in interface CourseManagementService
Returns:
The set of members in this Section. This is not a transitive set.
Throws:
IdNotFoundException - If the eid is not associated with any Section

getSections

public Set getSections(String courseOfferingEid)
                throws IdNotFoundException
Description copied from interface: CourseManagementService
Gets the top-level Sections associated with a CourseOffering

Specified by:
getSections in interface CourseManagementService
Returns:
The Set of Sections
Throws:
IdNotFoundException - If the eid is not associated with any CourseOffering

isEmpty

public boolean isEmpty(String courseSetEid)
Description copied from interface: CourseManagementService
Determines whether a CourseSet has any CanonicalCourses or CourseSets.

Specified by:
isEmpty in interface CourseManagementService
Returns:

isEnrolled

public boolean isEnrolled(String userId,
                          Set enrollmentSetEids)
Description copied from interface: CourseManagementService
Determines whether a user is enrolled (and not dropped) in an EnrollmentSet. This method is needed to implement Sakai's GroupProvider.

Specified by:
isEnrolled in interface CourseManagementService
Parameters:
userId - The student's userEid
enrollmentSetEids - The set of EnrollmentSetEids
Returns:

isEnrolled

public boolean isEnrolled(String userId,
                          String eid)
Description copied from interface: CourseManagementService
Convenience method for checking whether a user is enrolled (and not dropped) in an EnrollmentSet.

Specified by:
isEnrolled in interface CourseManagementService
Returns:

findEnrolledSections

public Set findEnrolledSections(String userId)
Description copied from interface: CourseManagementService
Finds all Sections that are linked to an EnrollmentSet for which a user is enrolled (but not dropped).

Specified by:
findEnrolledSections in interface CourseManagementService
Returns:

findCourseOfferingRoles

public Map findCourseOfferingRoles(String userEid)
Description copied from interface: CourseManagementService
Finds the CourseOfferings (and roles) for which a user is a member.

Specified by:
findCourseOfferingRoles in interface CourseManagementService
Returns:
A Map of CourseOffering EIDs to roles for the user

findCourseSetRoles

public Map findCourseSetRoles(String userEid)
Description copied from interface: CourseManagementService
Finds the CourseSets (and roles) for which a user is a member.

Specified by:
findCourseSetRoles in interface CourseManagementService
Returns:
A Map of CourseSet EIDs to roles for the user

findSectionRoles

public Map findSectionRoles(String userEid)
Description copied from interface: CourseManagementService
Finds the Sections (and roles) for which a user is a member.

Specified by:
findSectionRoles in interface CourseManagementService
Returns:
A Map of Section EIDs to roles for the user

getCourseOfferingsInCanonicalCourse

public Set getCourseOfferingsInCanonicalCourse(String canonicalCourseEid)
                                        throws IdNotFoundException
Description copied from interface: CourseManagementService
Finds all course offerings belonging to a canonical course.

Specified by:
getCourseOfferingsInCanonicalCourse in interface CourseManagementService
Parameters:
canonicalCourseEid - The enterprise id of the canonical course
Returns:
The set of course offerings
Throws:
IdNotFoundException

isAcademicSessionDefined

public boolean isAcademicSessionDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether an AcademicSession exists.

Specified by:
isAcademicSessionDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

isCanonicalCourseDefined

public boolean isCanonicalCourseDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether a CanonicalCourse exists.

Specified by:
isCanonicalCourseDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

isCourseOfferingDefined

public boolean isCourseOfferingDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether a CourseOffering exists.

Specified by:
isCourseOfferingDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

isCourseSetDefined

public boolean isCourseSetDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether a CourseSet exists.

Specified by:
isCourseSetDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

isEnrollmentSetDefined

public boolean isEnrollmentSetDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether an EnrollmentSet exists.

Specified by:
isEnrollmentSetDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

isSectionDefined

public boolean isSectionDefined(String eid)
Description copied from interface: CourseManagementService
Checks whether a Section exists.

Specified by:
isSectionDefined in interface CourseManagementService
Parameters:
eid - The enterprise id
Returns:
Whether the object exists

getSectionCategories

public List<String> getSectionCategories()
Description copied from interface: CourseManagementService
Gets the list of section categories defined by the institution.

Specified by:
getSectionCategories in interface CourseManagementService
Returns:

getSectionCategoryDescription

public String getSectionCategoryDescription(String categoryCode)
Description copied from interface: CourseManagementService
Gets the description for a category, identified by the category code, or null if the category code can not be found.

Specified by:
getSectionCategoryDescription in interface CourseManagementService
Returns:

getEnrollmentStatusDescriptions

public Map<String,String> getEnrollmentStatusDescriptions(Locale locale)
Description copied from interface: CourseManagementService
Gets the known enrollment status codes and descriptions for Enrollments.

Specified by:
getEnrollmentStatusDescriptions in interface CourseManagementService
Returns:

getGradingSchemeDescriptions

public Map<String,String> getGradingSchemeDescriptions(Locale locale)
Description copied from interface: CourseManagementService
Gets the known grading scheme codes and descriptions for Enrollments.

Specified by:
getGradingSchemeDescriptions in interface CourseManagementService
Returns:

getMembershipStatusDescriptions

public Map<String,String> getMembershipStatusDescriptions(Locale locale)
Description copied from interface: CourseManagementService
Gets the known membership status codes and descriptions for Memberships.

Specified by:
getMembershipStatusDescriptions in interface CourseManagementService
Returns:

findActiveCourseOfferingsInCanonicalCourse

public List<CourseOffering> findActiveCourseOfferingsInCanonicalCourse(String eid)
Description copied from interface: CourseManagementService
Find the currently offered course offerings in the cannonical course

Specified by:
findActiveCourseOfferingsInCanonicalCourse in interface CourseManagementService
Returns:


Copyright © 2011 Sakai Project. All Rights Reserved.