public interface ResourceBatchAdminSession extends 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.
| Modifier and Type | Method and Description |
|---|---|
AliasResponseList |
aliasResources(AliasRequestList aliasRequests)
Adds an
Id to a Resource for the purpose
of creating compatibility. |
CreateResponseList |
createResources(ResourceBatchFormList resourceForms)
Creates a new set of
Resources. |
DeleteResponseList |
deleteAllResources()
Deletes all
Resources in this Bin . |
DeleteResponseList |
deleteResources(IdList resourceIds)
Deletes resources for the given
Ids. |
ResourceBatchFormList |
getResourceFormsForCreate(long number,
Type[] resourceRecordTypes)
Gets the resource forms for creating a bunch of new resources.
|
ResourceBatchFormList |
getResourceFormsForUpdate(IdList resourceIds)
Gets the resource forms for updating an existing set of resources.
|
UpdateResponseList |
updateResources(ResourceBatchFormList resourceForms)
Updates existing resources.
|
aliasResource, canCreateResources, canCreateResourceWithRecordTypes, canDeleteResources, canManageResourceAliases, canUpdateResources, createResource, deleteResource, getBin, getBinId, getResourceFormForCreate, getResourceFormForUpdate, updateResourcegetAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseResourceBatchFormList getResourceFormsForCreate(long number, Type[] resourceRecordTypes) throws OperationFailedException, PermissionDeniedException
number - the number of forms to retrieveresourceRecordTypes - array of resource record types to be
included in each create operation or an empty list if noneNullArgumentException - resourceRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to request forms with
given record typesmandatory - This method must be implemented. CreateResponseList createResources(ResourceBatchFormList resourceForms) throws OperationFailedException, PermissionDeniedException
Resources. This method returns an
error if the entire operation fails. Otherwise, the status of an
individual create operation is indicated in the
BatchCreateResponse .resourceForms - the resource formsNullArgumentException - resourceForms is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. ResourceBatchFormList getResourceFormsForUpdate(IdList resourceIds) throws NotFoundException, OperationFailedException, PermissionDeniedException
resourceIds - the Ids of the Resource
NotFoundException - a resourceId is not
foundNullArgumentException - resourceIds is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. UpdateResponseList updateResources(ResourceBatchFormList resourceForms) throws OperationFailedException, PermissionDeniedException
BatchCreateResponse .resourceForms - the form containing the elements to be updatedNullArgumentException - resourceForms is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. DeleteResponseList deleteAllResources() throws OperationFailedException, PermissionDeniedException
Resources in this Bin .OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. DeleteResponseList deleteResources(IdList resourceIds) throws OperationFailedException, PermissionDeniedException
Ids. resourceIds - the Ids of the resources to deleteNullArgumentException - resourceIds is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. AliasResponseList aliasResources(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException
Id to a Resource for the purpose
of creating compatibility. The primary Id of the
Resource is determined by the provider. The new Id
is an alias to the primary Id. If the alias is
a pointer to another resource, it is reassigned to the given entry
Id. aliasRequests - the alias requestsNullArgumentException - aliasRequests is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.