Interface EnrollmentAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
EnrollmentBatchAdminSession
This session creates, updates, and deletes Enrollments . The
data for create and update is provided by the consumer via the form
object. OsidForms are requested for each create or update and may
not be reused.
Create and update operations differ in their usage. To create an
Enrollment , an EnrollmentForm is requested using
getEnrollmentFormFormForCreate() specifying the desired record
Types or none if no record Types are needed. The returned
EnrollmentForm will indicate that it is to be used with a create
operation and can be used to examine metdata or validate data prior to
creation. Once the EnrollmentForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each EnrollmentForm corresponds
to an attempted transaction.
For updates, EnrollmentForms are requested to the
EnrollmentForm Id that is to be updated using
getEnrollmentFormForUpdate() . Similarly, the EnrollmentForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The EnrollmentForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Enrollments . To unmap an
EnrollmentForm from the current CourseCatalog , the
EnrollmentCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the EnrollmentForm itself thus
removing it from all known CourseCatalog catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasEnrollment(Id enrollmentId, Id aliasId) Adds anIdto anEnrollmentfor the purpose of creating compatibility.booleanTests if this user can createEnrollments.booleancanCreateEnrollmentWithRecordTypes(Type[] enrollmentRecordTypes) Tests if this user can create a singleEnrollmentusing the desired record types.booleanTests if this user can deleteEnrollments.booleanTests if this user can manageIdaliases forEnrollments.booleanTests if this user can updateEnrollments.createEnrollment(EnrollmentForm enrollmentForm) Creates a newEnrollment.voiddeleteEnrollment(Id enrollmentId) Deletes anEnrollment.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getEnrollmentFormForCreate(Id programOfferingId, Id resourceId, Type[] enrollmentRecordTypes) Gets the course form for creating new enrollments.getEnrollmentFormForUpdate(Id enrollmentId) Gets the enrollment form for updating an existing enrollment.voidupdateEnrollment(EnrollmentForm enrollmentForm) Updates an existing enrollment.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getCourseCatalogId
Id getCourseCatalogId()Gets theCourseCatalogIdassociated with this session.- Returns:
- the
CourseCatalog Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCourseCatalog
Gets theCourseCatalogassociated with this session.- Returns:
- the course catalog
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateEnrollments
boolean canCreateEnrollments()Tests if this user can createEnrollments. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anEnrollmentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifEnrollmentcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateEnrollmentWithRecordTypes
Tests if this user can create a singleEnrollmentusing the desired record types. WhileCourseProgramManager.getEnrollmentRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificEnrollment. Providing an empty array tests if anEnrollmentcan be created with no records.- Parameters:
enrollmentRecordTypes- array of enrollment record types- Returns:
trueifEnrollmentcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-enrollmentRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getEnrollmentFormForCreate
EnrollmentForm getEnrollmentFormForCreate(Id programOfferingId, Id resourceId, Type[] enrollmentRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the course form for creating new enrollments. A new form should be requested for each create transaction.- Parameters:
programOfferingId- theIdfor aProgramOfferingresourceId- theIdfor aResourceenrollmentRecordTypes- array of enrollment record types- Returns:
- the enrollment form
- Throws:
NotFoundException-programOfferingId, orresourceIdis not foundNullArgumentException-programOfferingId, resourceId, orenrollmentRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested recod types- Compliance:
mandatory- This method must be implemented.
-
createEnrollment
Enrollment createEnrollment(EnrollmentForm enrollmentForm) throws OperationFailedException, PermissionDeniedException Creates a newEnrollment.- Parameters:
enrollmentForm- the form for thisEnrollment- Returns:
- the new
Enrollment - Throws:
IllegalStateException-enrollmentFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-enrollmentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-enrollmentFormdid not originate fromgetEnrollmentFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateEnrollments
boolean canUpdateEnrollments()Tests if this user can updateEnrollments. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anEnrollmentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifEnrollmentmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getEnrollmentFormForUpdate
EnrollmentForm getEnrollmentFormForUpdate(Id enrollmentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the enrollment form for updating an existing enrollment. A new enrollment form should be requested for each update transaction.- Parameters:
enrollmentId- theIdof theEnrollment- Returns:
- the enrollment form
- Throws:
NotFoundException-enrollmentIdis not foundNullArgumentException-enrollmentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateEnrollment
void updateEnrollment(EnrollmentForm enrollmentForm) throws OperationFailedException, PermissionDeniedException Updates an existing enrollment.- Parameters:
enrollmentForm- the form containing the elements to be updated- Throws:
IllegalStateException-enrollmentFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-enrollmentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-enrollmentFormdid not originate fromgetEnrollmentFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteEnrollments
boolean canDeleteEnrollments()Tests if this user can deleteEnrollments. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anEnrollmentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifEnrollmentdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteEnrollment
void deleteEnrollment(Id enrollmentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anEnrollment.- Parameters:
enrollmentId- theIdof theEnrollmentto remove- Throws:
NotFoundException-enrollmentIdnot foundNullArgumentException-enrollmentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageEnrollmentAliases
boolean canManageEnrollmentAliases()Tests if this user can manageIdaliases forEnrollments. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifEnrollmentaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasEnrollment
void aliasEnrollment(Id enrollmentId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anEnrollmentfor the purpose of creating compatibility. The primaryIdof theEnrollmentis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another enrollment, it is reassigned to the given enrollmentId.- Parameters:
enrollmentId- theIdof anEnrollmentaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-enrollmentIdnot foundNullArgumentException-enrollmentIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-