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 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 Business , the
ActivityBusinessAssignmentSession should be used. These delete operations
attempt to remove the Activity itself thus removing it from all
known Business 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.Deletes allActivitiesin thisBusiness.getActivityFormsForCreate(long number, Type[] activityRecordTypes) Gets the activityforms 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, getBusiness, getBusinessId, 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 forActivities.booleanTests if this user can updateActivities.createActivity(ActivityForm activityForm) Creates a newActivity.voiddeleteActivity(Id activityId) Deletes anActivity.getActivityFormForCreate(Type[] activityRecordTypes) Gets the activity form for creating new activities.getActivityFormForUpdate(Id activityId) Gets the activity form for updating an existing activity.Gets theBusinessassociated with this session.Gets theBusinessIdassociated 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(long number, Type[] activityRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the activityforms for creating a bunch of new activities.- Parameters:
number- the number of forms to retrieveactivityRecordTypes- array of activity record types to be included in each create operation or an empty list if none- Returns:
- the activity forms
- Throws:
NullArgumentException-activityRecordTypesisnullOperationFailedException- 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 activityform 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 thisBusiness.- 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.
-
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.
-