Interface AssetAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
AssetBatchAdminSession
This session creates, updates, and deletes Assets . 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
getAssetFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
AssetyForm 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 the 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.
For updates, AssetForms are requested to the Asset
Id that is to be updated using getAssetFormForUpdate() .
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.
The delete operations delete Assets . To unmap an
Asset from the current Repository , the
AssetRepositoryAssignmentSession should be used. These delete operations
attempt to remove the Bid itself thus removing it from all known
Repository catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
The view of the administrative methods defined in this session is
determined by the provider. For an instance of this session where no
repository has been specified, it may not be parallel to the
AssetLookupSession . For example, a default AssetLookupSession
may view the entire repository hierarchy while the default
AssetAdminSession uses an isolated Repository to create new
Assets or a specific repository to operate on a predetermined set
of Assets . Another scenario is a federated provider who does not
wish to permit administrative operations for the federation unaware.
Example create:
if (!session.canCreateAssets()) {
return "asset creation not permitted";
}
Type types[1];
types[0] = assetPhotographType;
if (!session.canCreateAssetWithRecordTypes(types)) {
return "creating an asset with a photograph type is not supported";
}
AssetForm form = session.getAssetFormForCreate();
Metadata metadata = form.getDisplayNameMetadata();
if (metadata.isReadOnly()) {
return "cannot set display name";
}
form.setDisplayName("my photo");
PhotographRecordForm photoForm = (PhotographRecordForm) form.getRecordForm(assetPhotogaphType);
Metadata metadata = form.getApertureMetadata();
if (metadata.isReadOnly()) {
return ("cannot set aperture");
}
photoForm.setAperture("5.6");
if (!form.isValid()) {
return form.getValidationMessage();
}
Asset newAsset = session.createAsset(form);
-
Method Summary
Modifier 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
-
getRepositoryId
Id getRepositoryId()Gets theRepositoryIdassociated with this session.- Returns:
- the
Repository Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getRepository
Gets theRepositoryassociated with this session.- Returns:
- the
Repositoryassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateAssets
boolean canCreateAssets()Tests if this user can createAssets. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAssetwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifAssetcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAssetWithRecordTypes
Tests if this user can create a singleAssetusing the desired record types. WhileRepositoryManager.getAssetRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAsset. Providing an empty array tests if anAssetcan be created with no records.- Parameters:
assetRecordTypes- array of asset record types- Returns:
trueifAssetcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-assetRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAssetFormForCreate
AssetForm getAssetFormForCreate(Type[] assetRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the asset form for creating new assets. A new form should be requested for each create transaction.- Parameters:
assetRecordTypes- array of asset record types- Returns:
- the asset form
- Throws:
NullArgumentException-assetRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAsset
Creates a newAsset.- Parameters:
assetForm- the form for thisAsset- Returns:
- the new
Asset - Throws:
IllegalStateException-assetFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-assetFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-assetFormdid not originate fromgetAssetFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAssets
boolean canUpdateAssets()Tests if this user can updateAssets. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAssetwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifAssetmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAssetFormForUpdate
AssetForm getAssetFormForUpdate(Id assetId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the asset form for updating an existing asset. A new asset form should be requested for each update transaction.- Parameters:
assetId- theIdof theAsset- Returns:
- the asset form
- Throws:
NotFoundException-assetIdis not foundNullArgumentException-assetIdis nullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAsset
Updates an existing asset.- Parameters:
assetForm- the form containing the elements to be updated- Throws:
IllegalStateException-assetFormalready used in anupdate transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-assetFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-assetFormdid not originate fromgetAssetFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAssets
boolean canDeleteAssets()Tests if this user can deleteAssets. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAssetwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifAssetdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAsset
void deleteAsset(Id assetId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anAsset.- Parameters:
assetId- theIdof theAssetto remove- Throws:
NotFoundException-assetIdnot foundNullArgumentException-assetIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageAssetAliases
boolean canManageAssetAliases()Tests if this user can manageIdaliases forAssets. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifAssetaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasAsset
void aliasAsset(Id assetId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anAssetfor the purpose of creating compatibility. The primaryIdof theAssetis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another asset, it is reassigned to the given assetId.- Parameters:
assetId- theIdof anAssetaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-assetIdnot foundNullArgumentException-assetIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateAssetContent
Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Tests if this user can create content forAssets. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAssetContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifAssetcontent creation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAssetContentWithRecordTypes
Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Tests if this user can create anAssetContentusing the desired record types. WhileRepositoryManager.getAssetContentRecordTypes()can be used to test which records are supported, this method tests which records are required for creating a specificAssetContent. Providing an empty array tests if anAssetContentcan be created with no records.- Parameters:
assetContentRecordTypes- array of asset content record types- Returns:
trueifAssetContentcreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-assetContentRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAssetContentFormForCreate
@Deprecated AssetContentForm getAssetContentFormForCreate(Id assetId, Type[] assetContentRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Gets an asset content form for creating new assets.- Parameters:
assetId- theIdof anAssetassetContentRecordTypes- array of asset content record types- Returns:
- the asset content form
- Throws:
NotFoundException-assetIdis not foundNullArgumentException-assetIdorassetContentRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAssetContent
@Deprecated AssetContent createAssetContent(AssetContentForm assetContentForm) throws OperationFailedException, PermissionDeniedException Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Creates newAssetContentfor a given asset.- Parameters:
assetContentForm- the form for thisAssetContent- Returns:
- the new
AssetContent - Throws:
IllegalStateException-assetContentFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-assetContentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-assetContentFormdid not originate fromgetAssetContentFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAssetContents
Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Tests if this user can updateAssetContent. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAssetContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifAssetContentmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAssetContentFormForUpdate
@Deprecated AssetContentForm getAssetContentFormForUpdate(Id assetContentId) throws NotFoundException, OperationFailedException Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Gets the asset content form for updating an existing asset content. A new asset content form should be requested for each update transaction.- Parameters:
assetContentId- theIdof theAssetContent- Returns:
- the asset content form
- Throws:
NotFoundException-assetContentIdis not foundNullArgumentException-assetContentIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateAssetContent
@Deprecated void updateAssetContent(AssetContentForm assetContentForm) throws OperationFailedException, PermissionDeniedException Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Updates an existing asset content.- Parameters:
assetContentForm- the form containing the elements to be updated- Throws:
IllegalStateException-assetContentFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-assetFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-assetContentFormdid not originate fromgetAssetContentFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAssetContents
Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Tests if this user can deleteAssetsContents. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAssetContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifAssetContentdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAssetContent
@Deprecated void deleteAssetContent(Id assetContentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deprecated.as of 3.0.0rc6. Method moved toAssetContentAdminSession.Deletes content from anAsset.- Parameters:
assetContentId- theIdof theAssetContent- Throws:
NotFoundException-assetContentIdis not foundNullArgumentException-assetContentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-