Interface ModuleAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
ModuleBatchAdminSession

public interface ModuleAdminSession extends OsidSession

This session creates, updates, and deletes Modules . 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 Module , a ModuleForm is requested using getModuleFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned ModuleForm 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 ModuleForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ModuleForm corresponds to an attempted transaction.

For updates, ModuleForms are requested to the ModuleForm Id that is to be updated using getModuleFormForUpdate() . Similarly, the ModuleForm has metadata about the data that can be updated and it can perform validation before submitting the update. The ModuleForm can only be used once for a successful update and cannot be reused.

The delete operations delete Modules . To unmap a Module from the current CourseCatalog , the ModuleCourseCatalogAssignmentSession should be used. These delete operations attempt to remove the Module 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.
    • canCreateModules

      boolean canCreateModules()
      Tests if this user can create modules. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Module 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 Module creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateModuleWithRecordTypes

      boolean canCreateModuleWithRecordTypes(Type[] moduleRecordTypes)
      Tests if this user can create a single Module using the desired record types. While CourseSyllabusManager.getModuleRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Module . Providing an empty array tests if a Module can be created with no records.
      Parameters:
      moduleRecordTypes - array of module record types
      Returns:
      true if Module creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - moduleRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getModuleFormForCreate

      ModuleForm getModuleFormForCreate(Id syllabusId, Type[] moduleRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the module form for creating new modules. A new form should be requested for each create transaction.
      Parameters:
      syllabusId - a syllabus Id
      moduleRecordTypes - array of module record types
      Returns:
      the module form
      Throws:
      NotFoundException - syllabusId is not found
      NullArgumentException - syllabusId or moduleRecordTypes 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.
    • createModule

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

      boolean canUpdateModules()
      Tests if this user can update modules. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Module 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 Module modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getModuleFormForUpdate

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

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

      boolean canDeleteModules()
      Tests if this user can delete modules. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Module 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 Module deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteModule

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

      boolean canManageModuleAliases()
      Tests if this user can manage Id aliases for Modules . 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 Module aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasModule

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

      boolean canSequenceModules()
      Tests if this user can order Modules . 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 sequencing operations to an unauthorized user.
      Returns:
      false if Module ordering is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • moveModuleAhead

      void moveModuleAhead(Id moduleId, Id syllabusId, Id referenceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Reorders modules in a syllabus by moving the specified module in front of a reference module.
      Parameters:
      moduleId - the Id of a Module
      syllabusId - the Id of a Syllabus
      referenceId - the reference module Id
      Throws:
      NotFoundException - moduleId, syllabusId , or referenceId not found or, moduleId or referenceId not related to syllabusId
      NullArgumentException - moduleId, syllabusId , or referenceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • moveModuleBehind

      void moveModuleBehind(Id moduleId, Id syllabusId, Id referenceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Reorders modules in a syllabus by moving the specified module behind a reference module.
      Parameters:
      moduleId - the Id of a Module
      syllabusId - the Id of a Syllabus
      referenceId - the reference module Id
      Throws:
      NotFoundException - moduleId, syllabusId , or referenceId not found or, moduleId or referenceId not related to syllabusId
      NullArgumentException - moduleId, syllabusId , or referenceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • orderModules

      void orderModules(Id[] moduleIds, Id syllabusId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Reorders a set of modules in a syllabus.
      Parameters:
      moduleIds - the Ids for a set of Modules
      syllabusId - the Id of a Syllabus
      Throws:
      NotFoundException - moduleId not found or, a moduleId not related to syllabusId
      NullArgumentException - moduleIds or syllabusId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.