OSID Logo
OSID Specifications
repository package
Version 3.0.0
Release Candidate Preview
Interfaceosid.repository.AssetAdminSession
Implementsosid.OsidSession
Description

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 = (PhotographRecordForn) 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);
                     
                                 
                     
                
MethodgetRepositoryId
Description

Gets the Repository Id associated with this session.

Returnosid.id.Idthe Repository Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetRepository
Description

Gets the Repository associated with this session.

Returnosid.repository.Repositorythe Repository associated with this session
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanCreateAssets
Description

Tests if this user can create Assets. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Asset will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returnboolean false if Asset creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateAssetWithRecordTypes
Description

Tests if this user can create a single Asset using the desired record types. While RepositoryManager.getAssetRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Asset. Providing an empty array tests if an Asset can be created with no records.

Parametersosid.type.Type[]assetRecordTypesarray of asset record types
Returnboolean true if Asset creation using the specified record Types is supported, false otherwise
ErrorsNULL_ARGUMENT assetRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetAssetFormForCreate
Description

Gets the asset form for creating new assets. A new form should be requested for each create transaction.

Parametersosid.type.Type[]assetRecordTypesarray of asset record types
Returnosid.repository.AssetFormthe asset form
ErrorsNULL_ARGUMENT assetRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form for requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateAsset
Description

Creates a new Asset.

Parametersosid.repository.AssetFormassetFormthe form for this Asset
Returnosid.repository.Assetthe new Asset
ErrorsILLEGAL_STATE assetForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT assetForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED assetForm did not originate from getAssetFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateAssets
Description

Tests if this user can update Assets. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Asset will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returnboolean false if Asset modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetAssetFormForUpdate
Description

Gets the asset form for updating an existing asset. A new asset form should be requested for each update transaction.

Parametersosid.id.IdassetIdthe Id of the Asset
Returnosid.repository.AssetFormthe asset form
ErrorsNOT_FOUND assetId is not found
NULL_ARGUMENT assetId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateAsset
Description

Updates an existing asset.

Parametersosid.repository.AssetFormassetFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE assetForm already used in anupdate transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT assetForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED assetForm did not originate from getAssetFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteAssets
Description

Tests if this user can delete Assets. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Asset will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returnboolean false if Asset deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteAsset
Description

Deletes an Asset.

Parametersosid.id.IdassetIdthe Id of the Asset to remove
ErrorsNOT_FOUND assetId not found
NULL_ARGUMENT assetId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageAssetAliases
Description

Tests if this user can manage Id aliases for Assets. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.

Returnboolean false if Asset aliasing is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodaliasAsset
Description

Adds an Id to an Asset for the purpose of creating compatibility. The primary Id of the Asset is determined by the provider. The new Id performs as an alias to the primary Id. If the alias is a pointer to another asset, it is reassigned to the given asset Id.

Parametersosid.id.IdassetIdthe Id of an Asset
osid.id.IdaliasIdthe alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND assetId not found
NULL_ARGUMENT assetId or aliasId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanCreateAssetContent
Description

Tests if this user can create content for Assets. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an AssetContent will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returnboolean false if Asset content creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateAssetContentWithRecordTypes
Description

Tests if this user can create an AssetContent using the desired record types. While RepositoryManager.getAssetContentRecordTypes() can be used to test which records are supported, this method tests which records are required for creating a specific AssetContent. Providing an empty array tests if an AssetContent can be created with no records.

Parametersosid.type.Type[]assetContentRecordTypesarray of asset content record types
Returnboolean true if AssetContent creation using the specified Types is supported, false otherwise
ErrorsNULL_ARGUMENT assetContentRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetAssetContentFormForCreate
Description

Gets an asset content form for creating new assets.

Parametersosid.id.IdassetIdthe Id of an Asset
osid.type.Type[]assetContentRecordTypesarray of asset content record types
Returnosid.repository.AssetContentFormthe asset content form
ErrorsNOT_FOUND assetId is not found
NULL_ARGUMENT assetId or assetContentRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form for requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateAssetContent
Description

Creates new AssetContent for a given asset.

Parametersosid.repository.AssetContentFormassetContentFormthe form for this AssetContent
Returnosid.repository.AssetContentthe new AssetContent
ErrorsILLEGAL_STATE assetContentForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT assetContentForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED assetContentForm did not originate from getAssetContentFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateAssetContents
Description

Tests if this user can update AssetContent. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an AssetContent will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returnboolean false if AssetContent modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetAssetContentFormForUpdate
Description

Gets the asset content form for updating an existing asset content. A new asset content form should be requested for each update transaction.

Parametersosid.id.IdassetContentIdthe Id of the AssetContent
Returnosid.repository.AssetContentFormthe asset content form
ErrorsNOT_FOUND assetContentId is not found
NULL_ARGUMENT assetContentId is null
OPERATION_FAILEDunable to complete request
CompliancemandatoryThis method must be implemented.
MethodupdateAssetContent
Description

Updates an existing asset content.

Parametersosid.repository.AssetContentFormassetContentFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE assetContentForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT assetForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED assetContentForm did not originate from getAssetContentFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteAssetContents
Description

Tests if this user can delete AssetsContents. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an AssetContent will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returnboolean false if AssetContent deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteAssetContent
Description

Deletes content from an Asset.

Parametersosid.id.IdassetContentIdthe Id of the AssetContent
ErrorsNOT_FOUND assetContentId is not found
NULL_ARGUMENT assetContentId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.