Repository¶
Repository¶
-
class
dlkit.services.repository.
Repository
¶ Bases:
dlkit.osid.objects.OsidCatalog
,dlkit.osid.sessions.OsidSession
-
get_repository_record
(repository_record_type)¶ Gets the record corresponding to the given
Repository
recordType
. This method is used to retrieve an object implementing the requested record. Therepository_record_type
may be theType
returned inget_record_types()
or any of its parents in aType
hierarchy wherehas_record_type(repository_record_type)
istrue
.Parameters: repository_record_type ( osid.type.Type
) – a repository record typeReturns: the repository record Return type: osid.repository.records.RepositoryRecord
Raise: NullArgument
–repository_record_type
isnull
Raise: OperationFailed
– unable to complete requestRaise: Unsupported
–has_record_type(repository_record_type)
isfalse
-
Asset Lookup Methods¶
Repository.
can_lookup_assets
()¶Tests if this user can perform
Asset
lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer lookup operations.
Returns: false
if lookup methods are not authorized,true
otherwiseReturn type: boolean
Repository.
use_comparative_asset_view
()¶The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.
Repository.
use_plenary_asset_view
()¶A complete view of the
Asset
returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.
Repository.
use_federated_repository_view
()¶Federates the view for methods in this session. A federated view will include assets in repositories which are children of this repository in the repository hierarchy.
Repository.
use_isolated_repository_view
()¶Isolates the view for methods in this session. An isolated view restricts lookups to this repository only.
Repository.
get_asset
(asset_id)¶Gets the
Asset
specified by itsId
. In plenary mode, the exactId
is found or aNotFound
results. Otherwise, the returnedAsset
may have a differentId
than requested, such as the case where a duplicateId
was assigned to anAsset
and retained for compatibility.
Parameters: asset_id ( osid.id.Id
) – theId
of theAsset
to retrieveReturns: the returned Asset
Return type: osid.repository.Asset
Raise: NotFound
– noAsset
found with the givenId
Raise: NullArgument
–asset_id
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
get_assets_by_ids
(asset_ids)¶Gets an
AssetList
corresponding to the givenIdList
. In plenary mode, the returned list contains all of the assets specified in theId
list, in the order of the list, including duplicates, or an error results if anId
in the supplied list is not found or inaccessible. Otherwise, inaccessibleAssets
may be omitted from the list and may present the elements in any order including returning a unique set.
Parameters: asset_ids ( osid.id.IdList
) – the list ofIds
to retrieveReturns: the returned Asset list
Return type: osid.repository.AssetList
Raise: NotFound
– anId
was not foundRaise: NullArgument
–asset_ids
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
get_assets_by_genus_type
(asset_genus_type)¶Gets an
AssetList
corresponding to the given asset genusType
which does not include assets of types derived from the specifiedType
. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session.
Parameters: asset_genus_type ( osid.type.Type
) – an asset genus typeReturns: the returned Asset list
Return type: osid.repository.AssetList
Raise: NullArgument
–asset_genus_type
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
get_assets_by_parent_genus_type
(asset_genus_type)¶Gets an
AssetList
corresponding to the given asset genusType
and include any additional assets with genus types derived from the specifiedType
. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session.
Parameters: asset_genus_type ( osid.type.Type
) – an asset genus typeReturns: the returned Asset list
Return type: osid.repository.AssetList
Raise: NullArgument
–asset_genus_type
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
get_assets_by_record_type
(asset_record_type)¶Gets an
AssetList
containing the given asset recordType
. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session.
Parameters: asset_record_type ( osid.type.Type
) – an asset record typeReturns: the returned Asset list
Return type: osid.repository.AssetList
Raise: NullArgument
–asset_record_type
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
get_assets_by_provider
(resource_id)¶Gets an
AssetList
from the given provider. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session.
Parameters: resource_id ( osid.id.Id
) – a resourceId
Returns: the returned Asset list
Return type: osid.repository.AssetList
Raise: NullArgument
–resource_id
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
assets
¶Gets all
Assets
. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session.
Returns: a list of Assets
Return type: osid.repository.AssetList
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Asset Query Methods¶
Repository.
can_search_assets
()¶Tests if this user can perform
Asset
searches. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer search operations to unauthorized users.
Returns: false
if search methods are not authorized,true
otherwiseReturn type: boolean
Repository.
use_federated_repository_view
()Federates the view for methods in this session. A federated view will include assets in repositories which are children of this repository in the repository hierarchy.
Repository.
use_isolated_repository_view
()Isolates the view for methods in this session. An isolated view restricts lookups to this repository only.
Repository.
asset_query
¶Gets an asset query.
Returns: the asset query Return type: osid.repository.AssetQuery
Repository.
get_assets_by_query
(asset_query)¶Gets a list of
Assets
matching the given asset query.
Parameters: asset_query ( osid.repository.AssetQuery
) – the asset queryReturns: the returned AssetList
Return type: osid.repository.AssetList
Raise: NullArgument
–asset_query
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
– theasset_query
is not of this service
Asset Admin Methods¶
Repository.
can_create_assets
()¶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 anAsset
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
Returns: false
ifAsset
creation is not authorized,true
otherwiseReturn type: boolean
Repository.
can_create_asset_with_record_types
(asset_record_types)¶Tests if this user can create a single
Asset
using 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 anAsset
can be created with no records.
Parameters: asset_record_types ( osid.type.Type[]
) – array of asset record typesReturns: true
ifAsset
creation using the specified recordTypes
is supported,false
otherwiseReturn type: boolean
Raise: NullArgument
–asset_record_types
isnull
Repository.
get_asset_form_for_create
(asset_record_types)¶Gets the asset form for creating new assets. A new form should be requested for each create transaction.
Parameters: asset_record_types ( osid.type.Type[]
) – array of asset record typesReturns: the asset form Return type: osid.repository.AssetForm
Raise: NullArgument
–asset_record_types
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
– unable to get form for requested record types
Repository.
create_asset
(asset_form)¶Creates a new
Asset
.
Parameters: asset_form ( osid.repository.AssetForm
) – the form for thisAsset
Returns: the new Asset
Return type: osid.repository.Asset
Raise: IllegalState
–asset_form
already used in a create transactionRaise: InvalidArgument
– one or more of the form elements is invalidRaise: NullArgument
–asset_form
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
–asset_form
did not originate fromget_asset_form_for_create()
Repository.
can_update_assets
()¶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 anAsset
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
Returns: false
ifAsset
modification is not authorized,true
otherwiseReturn type: boolean
Repository.
get_asset_form_for_update
(asset_id)¶Gets the asset form for updating an existing asset. A new asset form should be requested for each update transaction.
Parameters: asset_id ( osid.id.Id
) – theId
of theAsset
Returns: the asset form Return type: osid.repository.AssetForm
Raise: NotFound
–asset_id
is not foundRaise: NullArgument
–asset_id
is nullRaise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
update_asset
(asset_form)¶Updates an existing asset.
Parameters: asset_form ( osid.repository.AssetForm
) – the form containing the elements to be updatedRaise: IllegalState
–asset_form
already used in anupdate transactionRaise: InvalidArgument
– the form contains an invalid valueRaise: NullArgument
–asset_form
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
–asset_form
did not originate fromget_asset_form_for_update()
Repository.
can_delete_assets
()¶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 anAsset
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
Returns: false
ifAsset
deletion is not authorized,true
otherwiseReturn type: boolean
Repository.
delete_asset
(asset_id)¶Deletes an
Asset
.
Parameters: asset_id ( osid.id.Id
) – theId
of theAsset
to removeRaise: NotFound
–asset_id
not foundRaise: NullArgument
–asset_id
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure
Repository.
can_manage_asset_aliases
()¶Tests if this user can manage
Id
aliases 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 aPermissionDenied
. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
Returns: false
ifAsset
aliasing is not authorized,true
otherwiseReturn type: boolean
Repository.
alias_asset
(asset_id, alias_id)¶Adds an
Id
to anAsset
for the purpose of creating compatibility. The primaryId
of theAsset
is determined by the provider. The newId
performs as an alias to the primaryId
. If the alias is a pointer to another asset, it is reassigned to the given assetId
.
Parameters:
- asset_id (
osid.id.Id
) – theId
of anAsset
- alias_id (
osid.id.Id
) – the aliasId
Raise:
AlreadyExists
–alias_id
is already assignedRaise:
NotFound
–asset_id
not foundRaise:
NullArgument
–asset_id
oralias_id
isnull
Raise:
OperationFailed
– unable to complete requestRaise:
PermissionDenied
– authorization failure
Repository.
can_create_asset_content
()¶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 anAssetContent
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
Returns: false
ifAsset
content creation is not authorized,true
otherwiseReturn type: boolean
Repository.
can_create_asset_content_with_record_types
(asset_content_record_types)¶Tests if this user can create an
AssetContent
using 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 anAssetContent
can be created with no records.
Parameters: asset_content_record_types ( osid.type.Type[]
) – array of asset content record typesReturns: true
ifAssetContent
creation using the specifiedTypes
is supported,false
otherwiseReturn type: boolean
Raise: NullArgument
–asset_content_record_types
isnull
Repository.
get_asset_content_form_for_create
(asset_id, asset_content_record_types)¶Gets an asset content form for creating new assets.
Parameters:
- asset_id (
osid.id.Id
) – theId
of anAsset
- asset_content_record_types (
osid.type.Type[]
) – array of asset content record typesReturns: the asset content form
Return type:
osid.repository.AssetContentForm
Raise:
NotFound
–asset_id
is not foundRaise:
NullArgument
–asset_id
orasset_content_record_types
isnull
Raise:
OperationFailed
– unable to complete requestRaise:
PermissionDenied
– authorization failureRaise:
Unsupported
– unable to get form for requested record types
Repository.
create_asset_content
(asset_content_form)¶Creates new
AssetContent
for a given asset.
Parameters: asset_content_form ( osid.repository.AssetContentForm
) – the form for thisAssetContent
Returns: the new AssetContent
Return type: osid.repository.AssetContent
Raise: IllegalState
–asset_content_form
already used in a create transactionRaise: InvalidArgument
– one or more of the form elements is invalidRaise: NullArgument
–asset_content_form
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
–asset_content_form
did not originate fromget_asset_content_form_for_create()
Repository.
can_update_asset_contents
()¶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 anAssetContent
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
Returns: false
ifAssetContent
modification is not authorized,true
otherwiseReturn type: boolean
Repository.
get_asset_content_form_for_update
(asset_content_id)¶Gets the asset content form for updating an existing asset content. A new asset content form should be requested for each update transaction.
Parameters: asset_content_id ( osid.id.Id
) – theId
of theAssetContent
Returns: the asset content form Return type: osid.repository.AssetContentForm
Raise: NotFound
–asset_content_id
is not foundRaise: NullArgument
–asset_content_id
isnull
Raise: OperationFailed
– unable to complete request
Repository.
update_asset_content
(asset_content_form)¶Updates an existing asset content.
Parameters: asset_content_form ( osid.repository.AssetContentForm
) – the form containing the elements to be updatedRaise: IllegalState
–asset_content_form
already used in an update transactionRaise: InvalidArgument
– the form contains an invalid valueRaise: NullArgument
–asset_form
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failureRaise: Unsupported
–asset_content_form
did not originate fromget_asset_content_form_for_update()
Repository.
can_delete_asset_contents
()¶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 anAssetContent
will result in aPermissionDenied
. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
Returns: false
ifAssetContent
deletion is not authorized,true
otherwiseReturn type: boolean
Repository.
delete_asset_content
(asset_content_id)¶Deletes content from an
Asset
.
Parameters: asset_content_id ( osid.id.Id
) – theId
of theAssetContent
Raise: NotFound
–asset_content_id
is not foundRaise: NullArgument
–asset_content_id
isnull
Raise: OperationFailed
– unable to complete requestRaise: PermissionDenied
– authorization failure