Interface ModuleBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, ModuleAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Modules in bulk. 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
getModuleFormsForCreate() specifying the desired syllabus and record
Types or none if no record Types are needed. Each of the
returned ModuleForms 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 a 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.
The ModuleForm returned from getModuleFormsForCreate()
may be linked to the originating request through the peer Ids of
the ModuleForm . In the case where there may be duplicates, any
ModuletForm of the same peer Ids may be used for a create
operation.
Once a batch of ModuleForms are submitted for create, a
CreateResponse is returned for each ModuleForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createModules() , errors specific to
an individual ModuleForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
ModuleForm through the ModuleForm Id .
For updates, ModuleForms are requested to the Module
Id that is to be updated using getModuleFormsForUpdate()
where the reference Id in the ModuleForm may be used to
link the request. 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.
Once a batch of ModuleForms are submitted for update, an
UpdateResponse is returned for each ModuleForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateModuleForms() , errors specific
to an individual ModuleForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the
originating ModuleForm through the ModuleForm Id .
The delete operations delete Modules in bulk. To unmap s
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. Bulk delete operations
return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasModules(AliasRequestList aliasRequests) Adds anIdto aModulefor the purpose of creating compatibility.createModules(ModuleBatchFormList moduleForms) Creates a new set ofModules.Deletes allModulesin thisCourseCatalog.deleteModules(IdList moduleIds) Deletes modules for the givenIds.deleteModulesForSyllabus(Id syllabusId) Deletes modules for the given syllabus.getModuleFormsForCreate(IdList syllabusIds, Type[] moduleRecordTypes) Gets the module forms for creating a bunch of new modules.getModuleFormsForUpdate(IdList moduleIds) Gets the module forms for updating an existing set of modules.updateModules(ModuleBatchFormList moduleForms) Updates existing modules.Methods inherited from interface ModuleAdminSession
aliasModule, canCreateModules, canCreateModuleWithRecordTypes, canDeleteModules, canManageModuleAliases, canSequenceModules, canUpdateModules, createModule, deleteModule, getCourseCatalog, getCourseCatalogId, getModuleFormForCreate, getModuleFormForUpdate, moveModuleAhead, moveModuleBehind, orderModules, updateModuleModifier 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
-
getModuleFormsForCreate
ModuleBatchFormList getModuleFormsForCreate(IdList syllabusIds, Type[] moduleRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the module forms for creating a bunch of new modules. A new form isreturned for each supplied syllabus.- Parameters:
syllabusIds- a list of syllabusIdsmoduleRecordTypes- array of module record types to be included in each create operation or an empty list if none- Returns:
- the module forms
- Throws:
NotFoundException- asyllabusIdis no foundNullArgumentException-syllabusIdsormoduleRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createModules
CreateResponseList createModules(ModuleBatchFormList moduleForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofModules. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
moduleForms- the module forms- Returns:
- the create responses
- Throws:
NullArgumentException-moduleFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getModuleFormsForUpdate
ModuleBatchFormList getModuleFormsForUpdate(IdList moduleIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the module forms for updating an existing set of modules. A new module form should be requested for each update transaction.- Parameters:
moduleIds- theIdsof theModule- Returns:
- the module form
- Throws:
NotFoundException- amoduleIdis not foundNullArgumentException-moduleIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateModules
UpdateResponseList updateModules(ModuleBatchFormList moduleForms) throws OperationFailedException, PermissionDeniedException Updates existing modules. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
moduleForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-moduleFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllModules
Deletes allModulesin thisCourseCatalog.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteModules
DeleteResponseList deleteModules(IdList moduleIds) throws OperationFailedException, PermissionDeniedException Deletes modules for the givenIds.- Parameters:
moduleIds- theIdsof the modules to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-moduleIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteModulesForSyllabus
DeleteResponseList deleteModulesForSyllabus(Id syllabusId) throws OperationFailedException, PermissionDeniedException Deletes modules for the given syllabus.- Parameters:
syllabusId- theIdof a syllabus- Returns:
- the delete responses
- Throws:
NullArgumentException-syllabusIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasModules
AliasResponseList aliasModules(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aModulefor the purpose of creating compatibility. The primaryIdof theModuleis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another module, it is reassigned to the given moduleId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-