Interface ActivityUnitBatchAdminSession
- All Superinterfaces:
ActivityUnitAdminSession, AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes ActivityUnits 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 an
ActivityUnit, an ActivityUnitForm is requested using
getActivityUnitFormsForCreate() specifying the desired course and
record Types or none if no record Types are needed. Each
of the returned ActivityUnitForms will indicate that it is to be
used with a create operation and can be used to examine metadata or
validate data prior to creation. Once an ActivityUnitForm is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
ActivityUnitForm corresponds to an attempted transaction.
The ActivityUnitForms returned from
getActivityUnitFormsForCreate() may be linked to the originating request
through the peer Ids of the ActivityUnitForm. In the case
where there may be duplicates, any ActivityUnitForm of the same
peer Ids may be used for a create operation.
Once a batch of ActivityUnitForms are submitted for create, a
CreateResponse is returned for each ActivityUnitForm,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createActivityUnits(),
errors specific to an individual ActivityUnitForm are indicated in
the corresponding CreateResponse. CreateResponses may be
linked to the originating ActivityUnitForm through the
ActivityUnitForm Id.
For updates, ActivityUnitForms are requested to the
ActivityUnit Id that is to be updated using
getActivityUnitFormsForUpdate() where the reference Id in the
ActivityUnitForm may be used to link the request. Similarly, the
ActivityUnitForm has metadata about the data that can be updated
and it can perform validation before submitting the update. The
ActivityUnitForm can only be used once for a successful update and cannot
be reused.
Once a batch of ActivityUnitForms are submitted for update, an
UpdateResponse is returned for each ActivityUnitForm,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateActivityUnits(),
errors specific to an individual ActivityUnitForm are indicated in
the corresponding UpdateResponse. UpdateResponses may be
linked to the originating ActivityUnitForm through the
ActivityUnitForm Id.
The delete operations delete ActivityUnits in bulk. To unmap
an ActivityUnit from the current CourseCatalog, the
ActivityUnitCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the ActivityUnit itself thus removing
it from all known CourseCatalog catalogs. Bulk delete operations
return the results in DeleteResponses.
Like all OsidSessions, ActivityUnitBatchAdminSessions
are dedicated to single processing threads and a single authenticated
user.
-
Method Summary
Modifier and TypeMethodDescriptionaliasActivityUnits(AliasRequestList aliasRequests) Adds anIdto anActivityUnitfor the purpose of creating compatibility.createActivityUnits(ActivityUnitBatchFormList activityUnitForms) Creates a new set ofActivityUnits.deleteActivityUnits(IdList activityUnitIds) Deletes activity units for the givenIds.deleteActivityUnitsForCourse(Id courseId) Deletes all activity units mapped to the given course.Deletes allActivityUnitsin thisCourseCatalog.getActivityUnitFormsForCreate(IdList courseIds, Type[] activityUnitRecordTypes) Gets the activity unitforms for creating a bunch of new activity units.getActivityUnitFormsForUpdate(IdList activityUnitIds) Gets the activity unit forms for updating an existing set of activity units.updateActivityUnits(ActivityUnitBatchFormList activityUnitForms) Updates existing activity units.Methods inherited from interface ActivityUnitAdminSession
aliasActivityUnit, canCreateActivityUnits, canCreateActivityUnitWithRecordTypes, canDeleteActivityUnits, canManageActivityUnitAliases, canUpdateActivityUnits, createActivityUnit, deleteActivityUnit, getActivityUnitFormForCreate, getActivityUnitFormForUpdate, getCourseCatalog, getCourseCatalogId, updateActivityUnitMethods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatTypes, getLocales, isAuthenticated, startTransaction, supportsTransactions
-
Method Details
-
getActivityUnitFormsForCreate
ActivityUnitBatchFormList getActivityUnitFormsForCreate(IdList courseIds, Type[] activityUnitRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity unitforms for creating a bunch of new activity units. A new activity form is returned for each supplied course.- Parameters:
courseIds- a list of courseIdsactivityUnitRecordTypes- array of activity unit record types to be included in each create operation or an empty list if none- Returns:
- the activity unitforms
- Throws:
NotFoundException- acourseIdis not foundNullArgumentException-courseIdsoractivityUnitRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createActivityUnits
CreateResponseList createActivityUnits(ActivityUnitBatchFormList activityUnitForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofActivityUnits. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
activityUnitForms- the activity unit forms- Returns:
- the create responses
- Throws:
NullArgumentException-activityUnitFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getActivityUnitFormsForUpdate
ActivityUnitBatchFormList getActivityUnitFormsForUpdate(IdList activityUnitIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity unit forms for updating an existing set of activity units. A new activity unitform should be requested for each update transaction.- Parameters:
activityUnitIds- theIdsof theActivityUnit- Returns:
- the activity unit form
- Throws:
NotFoundException- anactivityUnitIdis not foundNullArgumentException-activityUnitIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateActivityUnits
UpdateResponseList updateActivityUnits(ActivityUnitBatchFormList activityUnitForms) throws OperationFailedException, PermissionDeniedException Updates existing activity units. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
activityUnitForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-activityUnitFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllActivityUnits
DeleteResponseList deleteAllActivityUnits() throws OperationFailedException, PermissionDeniedExceptionDeletes allActivityUnitsin thisCourseCatalog.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteActivityUnits
DeleteResponseList deleteActivityUnits(IdList activityUnitIds) throws OperationFailedException, PermissionDeniedException Deletes activity units for the givenIds.- Parameters:
activityUnitIds- theIdsof the activity units to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-activityUnitIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteActivityUnitsForCourse
DeleteResponseList deleteActivityUnitsForCourse(Id courseId) throws OperationFailedException, PermissionDeniedException Deletes all activity units mapped to the given course.- Parameters:
courseId- anIdof a course- Returns:
- the delete responses
- Throws:
NullArgumentException-courseIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasActivityUnits
AliasResponseList aliasActivityUnits(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anActivityUnitfor the purpose of creating compatibility. The primaryIdof theActivityUnitis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another activity unit, it is reassigned to the given activity unitId.- 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.
-