Interface LessonAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface LessonAdminSession extends 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 Details

    • getCourseCatalogId

      Id getCourseCatalogId()
      Gets the CourseCatalog Id associated with this session.
      Returns:
      the CourseCatalog Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCourseCatalog

      Gets the CourseCatalog associated with this session.
      Returns:
      the course catalog
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateLessons

      boolean canCreateLessons()
      Tests if this user can create Lessons . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Lesson will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if Lesson creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateLessonWithRecordTypes

      boolean canCreateLessonWithRecordTypes(Type[] lessonRecordTypes)
      Tests if this user can create a single Lesson using the desired record types. While CoursePlanManager.getLessonRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Lesson . Providing an empty array tests if a Lesson can be created with no records.
      Parameters:
      lessonRecordTypes - array of lesson record types
      Returns:
      true if Lesson creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - lessonRecordTypes is null
      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 plan Id
      docetId - a docet Id
      lessonRecordTypes - array of lesson record types
      Returns:
      the lesson form
      Throws:
      NotFoundException - planId or docetId is not found
      NullArgumentException - planId, docetId or lessonRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createLesson

      Creates a new Lesson .
      Parameters:
      lessonForm - the form for this Lesson
      Returns:
      the new Lesson
      Throws:
      IllegalStateException - lessonForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - lessonForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - lessonForm did not originate from getLessonFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateLessons

      boolean canUpdateLessons()
      Tests if this user can update Lessons . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Lesson will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if Lesson modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getLessonFormForUpdate

      Gets the lesson form for updating an existing lesson. A new lesson form should be requested for each update transaction.
      Parameters:
      lessonId - the Id of the Lesson
      Returns:
      the lesson form
      Throws:
      NotFoundException - lessonId is not found
      NullArgumentException - lessonId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateLesson

      void updateLesson(LessonForm lessonForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing lesson.
      Parameters:
      lessonForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - lessonForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - lessonForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - lessonForm did not originate from getLessonFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteLessons

      boolean canDeleteLessons()
      Tests if this user can delete Lessons A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Lesson will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if Lesson deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteLesson

      Deletes a Lesson .
      Parameters:
      lessonId - the Id of the Lesson to remove
      Throws:
      NotFoundException - lessonId not found
      NullArgumentException - lessonId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageLessonAliases

      boolean canManageLessonAliases()
      Tests if this user can manage Id aliases for Lessons . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if Lesson aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasLesson

      Adds an Id to a Lesson for the purpose of creating compatibility. The primary Id of the Lesson is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another lesson, it is reassigned to the given lesson Id .
      Parameters:
      lessonId - the Id of a Lesson
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - lessonId not found
      NullArgumentException - lessonId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.