Interface ModuleAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ModuleBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaliasModule(Id moduleId, Id aliasId) Adds anIdto aModulefor the purpose of creating compatibility.booleanTests if this user can create modules.booleancanCreateModuleWithRecordTypes(Type[] moduleRecordTypes) Tests if this user can create a singleModuleusing the desired record types.booleanTests if this user can delete modules.booleanTests if this user can manageIdaliases forModules.booleanTests if this user can orderModules.booleanTests if this user can update modules.createModule(ModuleForm moduleForm) Creates a newModule.voiddeleteModule(Id moduleId) Deletes aModule.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getModuleFormForCreate(Id syllabusId, Type[] moduleRecordTypes) Gets the module form for creating new modules.getModuleFormForUpdate(Id moduleId) Gets the module form for updating an existing module.voidmoveModuleAhead(Id moduleId, Id syllabusId, Id referenceId) Reorders modules in a syllabus by moving the specified module in front of a reference module.voidmoveModuleBehind(Id moduleId, Id syllabusId, Id referenceId) Reorders modules in a syllabus by moving the specified module behind a reference module.voidorderModules(Id[] moduleIds, Id syllabusId) Reorders a set of modules in a syllabus.voidupdateModule(ModuleForm moduleForm) Updates an existing module.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.
-
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 aModulewill 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:
falseifModulecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateModuleWithRecordTypes
Tests if this user can create a singleModuleusing the desired record types. WhileCourseSyllabusManager.getModuleRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificModule. Providing an empty array tests if aModulecan be created with no records.- Parameters:
moduleRecordTypes- array of module record types- Returns:
trueifModulecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-moduleRecordTypesisnull- 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 syllabusIdmoduleRecordTypes- array of module record types- Returns:
- the module form
- Throws:
NotFoundException-syllabusIdis not foundNullArgumentException-syllabusIdormoduleRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createModule
Module createModule(ModuleForm moduleForm) throws OperationFailedException, PermissionDeniedException Creates a newModule.- Parameters:
moduleForm- the form for thisModule- Returns:
- the new
Module - Throws:
IllegalStateException-moduleFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-moduleFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-moduleFormdid not originate fromgetModuleFormForCreate()- 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 aModulewill 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:
falseifModulemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getModuleFormForUpdate
ModuleForm getModuleFormForUpdate(Id moduleId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the module form for updating an existing module. A new module form should be requested for each update transaction.- Parameters:
moduleId- theIdof theModule- Returns:
- the module form
- Throws:
NotFoundException-moduleIdis not foundNullArgumentException-moduleIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateModule
Updates an existing module.- Parameters:
moduleForm- the form containing the elements to be updated- Throws:
IllegalStateException-moduleFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-moduleFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-moduleFormdid not originate fromgetModuleFormForUpdate()- 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 aModulewill 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:
falseifModuledeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteModule
void deleteModule(Id moduleId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aModule.- Parameters:
moduleId- theIdof theModuleto remove- Throws:
NotFoundException-moduleIdnot foundNullArgumentException-moduleIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageModuleAliases
boolean canManageModuleAliases()Tests if this user can manageIdaliases forModules. 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:
falseifModulealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasModule
void aliasModule(Id moduleId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aModulefor the purpose of creating compatibility. The primaryIdof theModuleis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another module, it is reassigned to the given moduleId.- Parameters:
moduleId- theIdof aModulealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-moduleIdnot foundNullArgumentException-moduleIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canSequenceModules
boolean canSequenceModules()Tests if this user can orderModules. 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 sequencing operations to an unauthorized user.- Returns:
falseifModuleordering is not authorized,trueotherwise- 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- theIdof aModulesyllabusId- theIdof aSyllabusreferenceId- the reference moduleId- Throws:
NotFoundException-moduleId, syllabusId, orreferenceIdnot found or,moduleIdorreferenceIdnot related tosyllabusIdNullArgumentException-moduleId, syllabusId, orreferenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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- theIdof aModulesyllabusId- theIdof aSyllabusreferenceId- the reference moduleId- Throws:
NotFoundException-moduleId, syllabusId, orreferenceIdnot found or,moduleIdorreferenceIdnot related tosyllabusIdNullArgumentException-moduleId, syllabusId, orreferenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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- theIdsfor a set ofModulessyllabusId- theIdof aSyllabus- Throws:
NotFoundException-moduleIdnot found or, amoduleIdnot related tosyllabusIdNullArgumentException-moduleIdsorsyllabusIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-