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 record Type. This method is used to retrieve an object implementing the requested record. The repository_record_type may be the Type returned in get_record_types() or any of its parents in a Type hierarchy where has_record_type(repository_record_type) is true .

Parameters:repository_record_type (osid.type.Type) – a repository record type
Returns:the repository record
Return type:osid.repository.records.RepositoryRecord
Raise:NullArgumentrepository_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(repository_record_type) is false

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 a PermissionDenied. 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 otherwise
Return 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 its Id. In plenary mode, the exact Id is found or a NotFound results. Otherwise, the returned Asset may have a different Id than requested, such as the case where a duplicate Id was assigned to an Asset and retained for compatibility.

Parameters:asset_id (osid.id.Id) – the Id of the Asset to retrieve
Returns:the returned Asset
Return type:osid.repository.Asset
Raise:NotFound – no Asset found with the given Id
Raise:NullArgumentasset_id is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Repository.get_assets_by_ids(asset_ids)

Gets an AssetList corresponding to the given IdList. In plenary mode, the returned list contains all of the assets specified in the Id list, in the order of the list, including duplicates, or an error results if an Id in the supplied list is not found or inaccessible. Otherwise, inaccessible Assets 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 of Ids to retrieve
Returns:the returned Asset list
Return type:osid.repository.AssetList
Raise:NotFound – an Id was not found
Raise:NullArgumentasset_ids is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Repository.get_assets_by_genus_type(asset_genus_type)

Gets an AssetList corresponding to the given asset genus Type which does not include assets of types derived from the specified Type. 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 type
Returns:the returned Asset list
Return type:osid.repository.AssetList
Raise:NullArgumentasset_genus_type is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Repository.get_assets_by_parent_genus_type(asset_genus_type)

Gets an AssetList corresponding to the given asset genus Type and include any additional assets with genus types derived from the specified Type. 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 type
Returns:the returned Asset list
Return type:osid.repository.AssetList
Raise:NullArgumentasset_genus_type is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Repository.get_assets_by_record_type(asset_record_type)

Gets an AssetList containing the given asset record Type. 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 type
Returns:the returned Asset list
Return type:osid.repository.AssetList
Raise:NullArgumentasset_record_type is null
Raise:OperationFailed – unable to complete request
Raise: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 resource Id
Returns:the returned Asset list
Return type:osid.repository.AssetList
Raise:NullArgumentresource_id is null
Raise:OperationFailed – unable to complete request
Raise: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 request
Raise: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 a PermissionDenied. 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 otherwise
Return 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 query
Returns:the returned AssetList
Return type:osid.repository.AssetList
Raise:NullArgumentasset_query is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise:Unsupported – the asset_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 an Asset will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returns:false if Asset creation is not authorized, true otherwise
Return 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. 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.

Parameters:asset_record_types (osid.type.Type[]) – array of asset record types
Returns:true if Asset creation using the specified record Types is supported, false otherwise
Return type:boolean
Raise:NullArgumentasset_record_types is null
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 types
Returns:the asset form
Return type:osid.repository.AssetForm
Raise:NullArgumentasset_record_types is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise: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 this Asset
Returns:the new Asset
Return type:osid.repository.Asset
Raise:IllegalStateasset_form already used in a create transaction
Raise:InvalidArgument – one or more of the form elements is invalid
Raise:NullArgumentasset_form is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise:Unsupportedasset_form did not originate from get_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 an Asset will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returns:false if Asset modification is not authorized, true otherwise
Return 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) – the Id of the Asset
Returns:the asset form
Return type:osid.repository.AssetForm
Raise:NotFoundasset_id is not found
Raise:NullArgumentasset_id is null
Raise:OperationFailed – unable to complete request
Raise: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 updated
Raise:IllegalStateasset_form already used in anupdate transaction
Raise:InvalidArgument – the form contains an invalid value
Raise:NullArgumentasset_form is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise:Unsupportedasset_form did not originate from get_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 an Asset will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returns:false if Asset deletion is not authorized, true otherwise
Return type:boolean
Repository.delete_asset(asset_id)

Deletes an Asset.

Parameters:asset_id (osid.id.Id) – the Id of the Asset to remove
Raise:NotFoundasset_id not found
Raise:NullArgumentasset_id is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Repository.can_manage_asset_aliases()

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 PermissionDenied. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.

Returns:false if Asset aliasing is not authorized, true otherwise
Return type:boolean
Repository.alias_asset(asset_id, alias_id)

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.

Parameters:
  • asset_id (osid.id.Id) – the Id of an Asset
  • alias_id (osid.id.Id) – the alias Id
Raise:

AlreadyExistsalias_id is already assigned

Raise:

NotFoundasset_id not found

Raise:

NullArgumentasset_id or alias_id is null

Raise:

OperationFailed – unable to complete request

Raise:

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 an AssetContent will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returns:false if Asset content creation is not authorized, true otherwise
Return 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. 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.

Parameters:asset_content_record_types (osid.type.Type[]) – array of asset content record types
Returns:true if AssetContent creation using the specified Types is supported, false otherwise
Return type:boolean
Raise:NullArgumentasset_content_record_types is null
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) – the Id of an Asset
  • asset_content_record_types (osid.type.Type[]) – array of asset content record types
Returns:

the asset content form

Return type:

osid.repository.AssetContentForm

Raise:

NotFoundasset_id is not found

Raise:

NullArgumentasset_id or asset_content_record_types is null

Raise:

OperationFailed – unable to complete request

Raise:

PermissionDenied – authorization failure

Raise:

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 this AssetContent
Returns:the new AssetContent
Return type:osid.repository.AssetContent
Raise:IllegalStateasset_content_form already used in a create transaction
Raise:InvalidArgument – one or more of the form elements is invalid
Raise:NullArgumentasset_content_form is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise:Unsupportedasset_content_form did not originate from get_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 an AssetContent will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returns:false if AssetContent modification is not authorized, true otherwise
Return 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) – the Id of the AssetContent
Returns:the asset content form
Return type:osid.repository.AssetContentForm
Raise:NotFoundasset_content_id is not found
Raise:NullArgumentasset_content_id is null
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 updated
Raise:IllegalStateasset_content_form already used in an update transaction
Raise:InvalidArgument – the form contains an invalid value
Raise:NullArgumentasset_form is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure
Raise:Unsupportedasset_content_form did not originate from get_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 an AssetContent will result in a PermissionDenied. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returns:false if AssetContent deletion is not authorized, true otherwise
Return type:boolean
Repository.delete_asset_content(asset_content_id)

Deletes content from an Asset.

Parameters:asset_content_id (osid.id.Id) – the Id of the AssetContent
Raise:NotFoundasset_content_id is not found
Raise:NullArgumentasset_content_id is null
Raise:OperationFailed – unable to complete request
Raise:PermissionDenied – authorization failure