Interface LessonAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Lessons . 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 a
Lesson , a LessonForm is requested using
getLessonFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
LessonForm 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 LessonForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each LessonForm corresponds to an attempted
transaction.
For updates, LessonForms are requested to the Lesson
Id that is to be updated using getLessonForUpdate() .
Similarly, the LessonForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
LessonForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Lessons . To unmap a
Lesson from the current CourseCatalog , the
LessonCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the Lesson 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 TypeMethodDescriptionvoidaliasLesson(Id lessonId, Id aliasId) Adds anIdto aLessonfor the purpose of creating compatibility.booleanTests if this user can createLessons.booleancanCreateLessonWithRecordTypes(Type[] lessonRecordTypes) Tests if this user can create a singleLessonusing the desired record types.booleanTests if this user can deleteLessonsA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forLessons.booleanTests if this user can updateLessons.createLesson(LessonForm lessonForm) Creates a newLesson.voiddeleteLesson(Id lessonId) Deletes aLesson.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getLessonFormForCreate(Id planId, Id docetId, Type[] lessonRecordTypes) Gets the lesson form for creating new lessons.getLessonFormForUpdate(Id lessonId) Gets the lesson form for updating an existing lesson.voidupdateLesson(LessonForm lessonForm) Updates an existing lesson.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.
-
canCreateLessons
boolean canCreateLessons()Tests if this user can createLessons. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aLessonwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifLessoncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateLessonWithRecordTypes
Tests if this user can create a singleLessonusing the desired record types. WhileCoursePlanManager.getLessonRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificLesson. Providing an empty array tests if aLessoncan be created with no records.- Parameters:
lessonRecordTypes- array of lesson record types- Returns:
trueifLessoncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-lessonRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getLessonFormForCreate
LessonForm getLessonFormForCreate(Id planId, Id docetId, Type[] lessonRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the lesson form for creating new lessons. A new form should be requested for each create transaction.- Parameters:
planId- a planIddocetId- a docetIdlessonRecordTypes- array of lesson record types- Returns:
- the lesson form
- Throws:
NotFoundException-planIdordocetIdis not foundNullArgumentException-planId, docetIdorlessonRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createLesson
Lesson createLesson(LessonForm lessonForm) throws OperationFailedException, PermissionDeniedException Creates a newLesson.- Parameters:
lessonForm- the form for thisLesson- Returns:
- the new
Lesson - Throws:
IllegalStateException-lessonFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-lessonFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-lessonFormdid not originate fromgetLessonFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateLessons
boolean canUpdateLessons()Tests if this user can updateLessons. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aLessonwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifLessonmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getLessonFormForUpdate
LessonForm getLessonFormForUpdate(Id lessonId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the lesson form for updating an existing lesson. A new lesson form should be requested for each update transaction.- Parameters:
lessonId- theIdof theLesson- Returns:
- the lesson form
- Throws:
NotFoundException-lessonIdis not foundNullArgumentException-lessonIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateLesson
Updates an existing lesson.- Parameters:
lessonForm- the form containing the elements to be updated- Throws:
IllegalStateException-lessonFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-lessonFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-lessonFormdid not originate fromgetLessonFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteLessons
boolean canDeleteLessons()Tests if this user can deleteLessonsA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aLessonwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifLessondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteLesson
void deleteLesson(Id lessonId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aLesson.- Parameters:
lessonId- theIdof theLessonto remove- Throws:
NotFoundException-lessonIdnot foundNullArgumentException-lessonIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageLessonAliases
boolean canManageLessonAliases()Tests if this user can manageIdaliases forLessons. 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:
falseifLessonaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasLesson
void aliasLesson(Id lessonId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aLessonfor the purpose of creating compatibility. The primaryIdof theLessonis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another lesson, it is reassigned to the given lessonId.- Parameters:
lessonId- theIdof aLessonaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-lessonIdnot foundNullArgumentException-lessonIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-