Interface ActivityBatchAdminSession
- All Superinterfaces:
ActivityAdminSession, AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Activities 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
Activity , an ActivityForm is requested using
getActivityFormsForCreate() specifying the desired objective and record
Types or none if no record Types are needed. Each of the
returned ActivityForms 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 an ActivityForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each ActivityForm corresponds to
an attempted transaction.
The ActivityForms returned from
getActivityFormsForCreate() may be linked to the originating request
through the peer Ids of the ActivityForm . In the case
where there may be duplicates, any ActivityForm of the same peer
Ids may be used for a create operation.
Once a batch of ActivityForms are submitted for create, a
CreateResponse is returned for each ActivityForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createActivities() ,
errors specific to an individual ActivityForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating ActivityForm through the
ActivityForm Id .
For updates, ActivityForms are requested to the
Activity Id that is to be updated using
getActivityFormsForUpdate() where the reference Id in the
ActivityForm may be used to link the request. Similarly, the
ActivityForm has metadata about the data that can be updated and it can
perform validation before submitting the update. The ActivityForm
can only be used once for a successful update and cannot be reused.
Once a batch of ActivityForms are submitted for update, an
UpdateResponse is returned for each ActivityForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateActivities() ,
errors specific to an individual ActivityForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating ActivityForm through the
ActivityForm Id .
The delete operations delete Activities in bulk. To unmap an
Activity from the current ObjectiveBank , the
ActivityObjectiveBankAssignmentSession should be used. These delete
operations attempt to remove the Activity itself thus removing it
from all known ObjectiveBank catalogs. Bulk delete operations
return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasActivities(AliasRequestList aliasRequests) Adds anIdto anActivityfor the purpose of creating compatibility.createActivities(ActivityBatchFormList activityForms) Creates a new set ofActivities.deleteActivities(IdList activityIds) Deletes activities for the givenIds.deleteActivitiesForObjective(Id objectiveId) Deletes activities for the given objective.Deletes allActivitiesin thisObjectiveBank.getActivityFormsForCreate(IdList objectiveIds, Type[] activityRecordTypes) Gets the activity forms for creating a bunch of new activities.getActivityFormsForUpdate(IdList activityIds) Gets the activity forms for updating an existing set of activities.updateActivities(ActivityBatchFormList activityForms) Updates existing activities.Methods inherited from interface ActivityAdminSession
aliasActivity, canCreateActivities, canCreateActivityWithRecordTypes, canDeleteActivities, canManageActivityAliases, canUpdateActivities, createActivity, deleteActivity, getActivityFormForCreate, getActivityFormForUpdate, getObjectiveBank, getObjectiveBankId, updateActivityModifier and TypeMethodDescriptionvoidaliasActivity(Id activityId, Id aliasId) Adds anIdto anActivityfor the purpose of creating compatibility.booleanTests if this user can createActivities.booleancanCreateActivityWithRecordTypes(Type[] activityRecordTypes) Tests if this user can create a singleActivityusing the desired record types.booleanTests if this user can deleteActivities.booleanTests if this user can manageIdaliases for activities.booleanTests if this user can updateActivities.createActivity(ActivityForm activityForm) Creates a newActivity.voiddeleteActivity(Id activityId) Deletes theActivityidentified by the givenId.getActivityFormForCreate(Id objectiveId, Type[] activityRecordTypes) Gets the activity form for creating new activities.getActivityFormForUpdate(Id activityId) Gets the activity form for updating an existing activity.Gets theObjectiveBankassociated with this session.Gets theObjectiveBankIdassociated with this session.voidupdateActivity(ActivityForm activityForm) Updates an existing activity,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
-
getActivityFormsForCreate
ActivityBatchFormList getActivityFormsForCreate(IdList objectiveIds, Type[] activityRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity forms for creating a bunch of new activities. A form is returned for each supplied objective.- Parameters:
objectiveIds- a list of objectiveIdsactivityRecordTypes- array of activity record types to be included in each create operation or an empty list if none- Returns:
- the activity forms
- Throws:
NotFoundException- anobjectiveIdis not foundNullArgumentException-objectiveIdsoractivityRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createActivities
CreateResponseList createActivities(ActivityBatchFormList activityForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofActivities. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
activityForms- the activity forms- Returns:
- the create responses
- Throws:
NullArgumentException-activityFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getActivityFormsForUpdate
ActivityBatchFormList getActivityFormsForUpdate(IdList activityIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity forms for updating an existing set of activities. A new activity form should be requested for each update transaction.- Parameters:
activityIds- theIdsof theActivity- Returns:
- the activity form
- Throws:
NotFoundException- anactivityIdis not foundNullArgumentException-activityIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateActivities
UpdateResponseList updateActivities(ActivityBatchFormList activityForms) throws OperationFailedException, PermissionDeniedException Updates existing activities. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
activityForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-activityFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllActivities
Deletes allActivitiesin thisObjectiveBank.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteActivities
DeleteResponseList deleteActivities(IdList activityIds) throws OperationFailedException, PermissionDeniedException Deletes activities for the givenIds.- Parameters:
activityIds- theIdsof the activities to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-activityIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteActivitiesForObjective
DeleteResponseList deleteActivitiesForObjective(Id objectiveId) throws OperationFailedException, PermissionDeniedException Deletes activities for the given objective.- Parameters:
objectiveId- anIdof an objective- Returns:
- the delete responses
- Throws:
NullArgumentException-objectiveIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasActivities
AliasResponseList aliasActivities(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anActivityfor the purpose of creating compatibility. The primaryIdof theActivityis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another activity, it is reassigned to the given activityId.- 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.
-