Interface AssetBatchAdminSession
- All Superinterfaces:
AssetAdminSession, AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Assets 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
Asset , an AssetForm is requested using
getAssetFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
AssetForms 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 AssetForm is submiited to a create operation, it cannot be
reused with another create operation unless the first operation was
unsuccessful. Each AssetForm corresponds to an attempted
transaction.
The AssetForms returned from getAssetFormsForCreate()
may be linked to the originating request through the peer Ids of
the AssetForm . In the case where there may be duplicates, any
AssetForm of the same peer Ids may be used for a create
operation.
Once a batch of AssetForms are submitted for create, a
CreateResponse is returned for each AssetForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createAssets() , errors specific to an
individual AssetForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
AssetForm through the AssetForm Id .
For updates, AssetForms are requested to the Asset
Id that is to be updated using getAssetFormsForUpdate()
where the reference Id in the AssetForm may be used to
link the request. Similarly, the AssetForm has metadata about the
data that can be updated and it can perform validation before submitting
the update. The AssetForm can only be used once for a successful
update and cannot be reused.
Once a batch of AssetForms are submitted for update, an
UpdateResponse is returned for each AssetForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateAssets() , errors specific to an
individual AssetForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
AssetForm through the AssetForm Id .
The delete operations delete Assets in bulk. To unmap an
Asset from the current Repository , the
AssetRepositoryAssignmentSession should be used. These delete operations
attempt to remove the Asset itself thus removing it from all known
Repository catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasAssets(AliasRequestList aliasRequests) Adds anIdto anAssetfor the purpose of creating compatibility.createAssets(AssetBatchFormList assetForms) Creates a new set ofAssets.Deletes allAssetsin thisRepository.deleteAssets(IdList assetIds) Deletes assets for the givenIds.getAssetFormsForCreate(long number, Type[] assetRecordTypes) Gets the asset forms for creating a bunch of new assets.getAssetFormsForUpdate(IdList assetIds) Gets the asset forms for updating an existing set of assets.updateAssets(AssetBatchFormList assetForms) Updates existing assets.Methods inherited from interface AssetAdminSession
aliasAsset, canCreateAssetContent, canCreateAssetContentWithRecordTypes, canCreateAssets, canCreateAssetWithRecordTypes, canDeleteAssetContents, canDeleteAssets, canManageAssetAliases, canUpdateAssetContents, canUpdateAssets, createAsset, createAssetContent, deleteAsset, deleteAssetContent, getAssetContentFormForCreate, getAssetContentFormForUpdate, getAssetFormForCreate, getAssetFormForUpdate, getRepository, getRepositoryId, updateAsset, updateAssetContentModifier and TypeMethodDescriptionvoidaliasAsset(Id assetId, Id aliasId) Adds anIdto anAssetfor the purpose of creating compatibility.booleanDeprecated.as of 3.0.0rc6.booleancanCreateAssetContentWithRecordTypes(Type[] assetContentRecordTypes) Deprecated.as of 3.0.0rc6.booleanTests if this user can createAssets.booleancanCreateAssetWithRecordTypes(Type[] assetRecordTypes) Tests if this user can create a singleAssetusing the desired record types.booleanDeprecated.as of 3.0.0rc6.booleanTests if this user can deleteAssets.booleanTests if this user can manageIdaliases forAssets.booleanDeprecated.as of 3.0.0rc6.booleanTests if this user can updateAssets.createAsset(AssetForm assetForm) Creates a newAsset.createAssetContent(AssetContentForm assetContentForm) Deprecated.as of 3.0.0rc6.voiddeleteAsset(Id assetId) Deletes anAsset.voiddeleteAssetContent(Id assetContentId) Deprecated.as of 3.0.0rc6.getAssetContentFormForCreate(Id assetId, Type[] assetContentRecordTypes) Deprecated.as of 3.0.0rc6.getAssetContentFormForUpdate(Id assetContentId) Deprecated.as of 3.0.0rc6.getAssetFormForCreate(Type[] assetRecordTypes) Gets the asset form for creating new assets.getAssetFormForUpdate(Id assetId) Gets the asset form for updating an existing asset.Gets theRepositoryassociated with this session.Gets theRepositoryIdassociated with this session.voidupdateAsset(AssetForm assetForm) Updates an existing asset.voidupdateAssetContent(AssetContentForm assetContentForm) Deprecated.as of 3.0.0rc6.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
-
getAssetFormsForCreate
AssetBatchFormList getAssetFormsForCreate(long number, Type[] assetRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the asset forms for creating a bunch of new assets.- Parameters:
number- the number of forms to retrieveassetRecordTypes- array of asset record types to be included in each create operation or an empty list if none- Returns:
- the asset forms
- Throws:
NullArgumentException-assetRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createAssets
CreateResponseList createAssets(AssetBatchFormList assetForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofAssets. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
assetForms- the asset forms- Returns:
- the create responses
- Throws:
NullArgumentException-assetFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAssetFormsForUpdate
AssetBatchFormList getAssetFormsForUpdate(IdList assetIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the asset forms for updating an existing set of assets. A new asset form should be requested for each update transaction.- Parameters:
assetIds- theIdsof theAsset- Returns:
- the asset forms
- Throws:
NotFoundException- anassetIdis not foundNullArgumentException-assetIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAssets
UpdateResponseList updateAssets(AssetBatchFormList assetForms) throws OperationFailedException, PermissionDeniedException Updates existing assets. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
assetForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-assetFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllAssets
Deletes allAssetsin thisRepository.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAssets
DeleteResponseList deleteAssets(IdList assetIds) throws OperationFailedException, PermissionDeniedException Deletes assets for the givenIds.- Parameters:
assetIds- theIdsof the assets to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-assetIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasAssets
AliasResponseList aliasAssets(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anAssetfor the purpose of creating compatibility. The primaryIdof theAssetis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another asset, it is reassigned to the given assetId.- 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.
-