Interface ResourceBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, ResourceAdminSession
This session creates, updates, and deletes Resources 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
Resource , a ResourceForm is requested using
getResourceFormsForCreate() specifying the desired record Types
or none if no record Types are needed. Each of the returned
ResourceForms 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 ResourceForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each ResourceForm corresponds to an attempted
transaction.
The ResourceForms returned from
getResourceFormsForCreate() may be linked to the originating request
through the peer Ids of the ResourceForm . In the case
where there may be duplicates, any ResourceForm of the same peer
Ids may be used for a create operation.
Once a batch of ResourceForms are submitted for create, a
CreateResponse is returned for each ResourceForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createResources() ,
errors specific to an individual ResourceForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating ResourceForm through the
ResourceForm Id .
For updates, ResourceForms are requested to the
Resource Id that is to be updated using
getResourceFormsForUpdate() where the reference Id in the
ResourceForm may be used to link the request. Similarly, the
ResourceForm has metadata about the data that can be updated and it can
perform validation before submitting the update. The ResourceForm
can only be used once for a successful update and cannot be reused.
Once a batch of ResourceForms are submitted for update, an
UpdateResponse is returned for each ResourceForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateResources() ,
errors specific to an individual ResourceForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating ResourceForm through the
ResourceForm Id .
The delete operations delete Resources in bulk. To unmap a
Resource from the current Bin , the
ResourceBinAssignmentSession should be used. These delete operations
attempt to remove the Resource itself thus removing it from all
known Bin catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasResources(AliasRequestList aliasRequests) Adds anIdto aResourcefor the purpose of creating compatibility.createResources(ResourceBatchFormList resourceForms) Creates a new set ofResources.Deletes allResourcesin thisBin.deleteResources(IdList resourceIds) Deletes resources for the givenIds.getResourceFormsForCreate(long number, Type[] resourceRecordTypes) Gets the resource forms for creating a bunch of new resources.getResourceFormsForUpdate(IdList resourceIds) Gets the resource forms for updating an existing set of resources.updateResources(ResourceBatchFormList resourceForms) Updates existing resources.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.Methods inherited from interface ResourceAdminSession
aliasResource, canCreateResources, canCreateResourceWithRecordTypes, canDeleteResources, canManageResourceAliases, canUpdateResources, createResource, deleteResource, getBin, getBinId, getResourceFormForCreate, getResourceFormForUpdate, updateResourceModifier and TypeMethodDescriptionvoidaliasResource(Id resourceId, Id aliasId) Adds anIdto aResourcefor the purpose of creating compatibility.booleanTests if this user can createResources.booleancanCreateResourceWithRecordTypes(Type[] resourceRecordTypes) Tests if this user can create a singleResourceusing the desired record types.booleanTests if this user can deleteResources.booleanTests if this user can manageIdaliases forResources.booleanTests if this user can updateResources.createResource(ResourceForm resourceForm) Creates a newResource.voiddeleteResource(Id resourceId) Deletes aResource.getBin()Gets theBinassociated with this session.getBinId()Gets theBinIdassociated with this session.getResourceFormForCreate(Type[] resourceRecordTypes) Gets the resource form for creating new resources.getResourceFormForUpdate(Id resourceId) Gets the resource form for updating an existing resource.voidupdateResource(ResourceForm resourceForm) Updates an existing resource.
-
Method Details
-
getResourceFormsForCreate
ResourceBatchFormList getResourceFormsForCreate(long number, Type[] resourceRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the resource forms for creating a bunch of new resources.- Parameters:
number- the number of forms to retrieveresourceRecordTypes- array of resource record types to be included in each create operation or an empty list if none- Returns:
- the resource forms
- Throws:
NullArgumentException-resourceRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createResources
CreateResponseList createResources(ResourceBatchFormList resourceForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofResources. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
resourceForms- the resource forms- Returns:
- the create responses
- Throws:
NullArgumentException-resourceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getResourceFormsForUpdate
ResourceBatchFormList getResourceFormsForUpdate(IdList resourceIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the resource forms for updating an existing set of resources. A new resource form should be requested for each update transaction.- Parameters:
resourceIds- theIdsof theResource- Returns:
- the resource form
- Throws:
NotFoundException- aresourceIdis not foundNullArgumentException-resourceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateResources
UpdateResponseList updateResources(ResourceBatchFormList resourceForms) throws OperationFailedException, PermissionDeniedException Updates existing resources. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
resourceForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-resourceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllResources
Deletes allResourcesin thisBin.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteResources
DeleteResponseList deleteResources(IdList resourceIds) throws OperationFailedException, PermissionDeniedException Deletes resources for the givenIds.- Parameters:
resourceIds- theIdsof the resources to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasResources
AliasResponseList aliasResources(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aResourcefor the purpose of creating compatibility. The primaryIdof theResourceis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another resource, it is reassigned to the given entryId.- 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.
-