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
RepositoryrecordType. This method is used to retrieve an object implementing the requested record. Therepository_record_typemay be theTypereturned inget_record_types()or any of its parents in aTypehierarchy 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.RepositoryRecordRaise: NullArgument–repository_record_typeisnullRaise: 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
Assetlookups. 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: falseif lookup methods are not authorized,trueotherwiseReturn 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
Assetreturns 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
Assetspecified by itsId. In plenary mode, the exactIdis found or aNotFoundresults. Otherwise, the returnedAssetmay have a differentIdthan requested, such as the case where a duplicateIdwas assigned to anAssetand retained for compatibility.
Parameters: asset_id ( osid.id.Id) – theIdof theAssetto retrieveReturns: the returned AssetReturn type: osid.repository.AssetRaise: NotFound– noAssetfound with the givenIdRaise: NullArgument–asset_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.get_assets_by_ids(asset_ids)¶Gets an
AssetListcorresponding to the givenIdList. In plenary mode, the returned list contains all of the assets specified in theIdlist, in the order of the list, including duplicates, or an error results if anIdin the supplied list is not found or inaccessible. Otherwise, inaccessibleAssetsmay 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 ofIdsto retrieveReturns: the returned Asset listReturn type: osid.repository.AssetListRaise: NotFound– anIdwas not foundRaise: NullArgument–asset_idsisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.get_assets_by_genus_type(asset_genus_type)¶Gets an
AssetListcorresponding to the given asset genusTypewhich 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 listReturn type: osid.repository.AssetListRaise: NullArgument–asset_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.get_assets_by_parent_genus_type(asset_genus_type)¶Gets an
AssetListcorresponding to the given asset genusTypeand 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 listReturn type: osid.repository.AssetListRaise: NullArgument–asset_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.get_assets_by_record_type(asset_record_type)¶Gets an
AssetListcontaining 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 listReturn type: osid.repository.AssetListRaise: NullArgument–asset_record_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.get_assets_by_provider(resource_id)¶Gets an
AssetListfrom 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 resourceIdReturns: the returned Asset listReturn type: osid.repository.AssetListRaise: NullArgument–resource_idisnullRaise: 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 AssetsReturn type: osid.repository.AssetListRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Asset Query Methods¶
Repository.can_search_assets()¶Tests if this user can perform
Assetsearches. 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: falseif search methods are not authorized,trueotherwiseReturn 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
Assetsmatching the given asset query.
Parameters: asset_query ( osid.repository.AssetQuery) – the asset queryReturns: the returned AssetListReturn type: osid.repository.AssetListRaise: NullArgument–asset_queryisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported– theasset_queryis 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 anAssetwill 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: falseifAssetcreation is not authorized,trueotherwiseReturn type: boolean
Repository.can_create_asset_with_record_types(asset_record_types)¶Tests if this user can create a single
Assetusing 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: asset_record_types ( osid.type.Type[]) – array of asset record typesReturns: trueifAssetcreation using the specified recordTypesis supported,falseotherwiseReturn type: booleanRaise: NullArgument–asset_record_typesisnull
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.AssetFormRaise: NullArgument–asset_record_typesisnullRaise: 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 thisAssetReturns: the new AssetReturn type: osid.repository.AssetRaise: IllegalState–asset_formalready used in a create transactionRaise: InvalidArgument– one or more of the form elements is invalidRaise: NullArgument–asset_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–asset_formdid 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 anAssetwill 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: falseifAssetmodification is not authorized,trueotherwiseReturn 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) – theIdof theAssetReturns: the asset form Return type: osid.repository.AssetFormRaise: NotFound–asset_idis not foundRaise: NullArgument–asset_idis 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_formalready used in anupdate transactionRaise: InvalidArgument– the form contains an invalid valueRaise: NullArgument–asset_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–asset_formdid 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 anAssetwill 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: falseifAssetdeletion is not authorized,trueotherwiseReturn type: boolean
Repository.delete_asset(asset_id)¶Deletes an
Asset.
Parameters: asset_id ( osid.id.Id) – theIdof theAssetto removeRaise: NotFound–asset_idnot foundRaise: NullArgument–asset_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Repository.can_manage_asset_aliases()¶Tests if this user can manage
Idaliases 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: falseifAssetaliasing is not authorized,trueotherwiseReturn type: boolean
Repository.alias_asset(asset_id, alias_id)¶Adds an
Idto 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:
- asset_id (
osid.id.Id) – theIdof anAsset- alias_id (
osid.id.Id) – the aliasIdRaise:
AlreadyExists–alias_idis already assignedRaise:
NotFound–asset_idnot foundRaise:
NullArgument–asset_idoralias_idisnullRaise:
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 anAssetContentwill 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: falseifAssetcontent creation is not authorized,trueotherwiseReturn type: boolean
Repository.can_create_asset_content_with_record_types(asset_content_record_types)¶Tests if this user can create an
AssetContentusing 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: asset_content_record_types ( osid.type.Type[]) – array of asset content record typesReturns: trueifAssetContentcreation using the specifiedTypesis supported,falseotherwiseReturn type: booleanRaise: NullArgument–asset_content_record_typesisnull
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) – theIdof anAsset- asset_content_record_types (
osid.type.Type[]) – array of asset content record typesReturns: the asset content form
Return type:
osid.repository.AssetContentFormRaise:
NotFound–asset_idis not foundRaise:
NullArgument–asset_idorasset_content_record_typesisnullRaise:
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
AssetContentfor a given asset.
Parameters: asset_content_form ( osid.repository.AssetContentForm) – the form for thisAssetContentReturns: the new AssetContentReturn type: osid.repository.AssetContentRaise: IllegalState–asset_content_formalready used in a create transactionRaise: InvalidArgument– one or more of the form elements is invalidRaise: NullArgument–asset_content_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–asset_content_formdid 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 anAssetContentwill 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: falseifAssetContentmodification is not authorized,trueotherwiseReturn 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) – theIdof theAssetContentReturns: the asset content form Return type: osid.repository.AssetContentFormRaise: NotFound–asset_content_idis not foundRaise: NullArgument–asset_content_idisnullRaise: 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_formalready used in an update transactionRaise: InvalidArgument– the form contains an invalid valueRaise: NullArgument–asset_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–asset_content_formdid 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 anAssetContentwill 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: falseifAssetContentdeletion is not authorized,trueotherwiseReturn type: boolean
Repository.delete_asset_content(asset_content_id)¶Deletes content from an
Asset.
Parameters: asset_content_id ( osid.id.Id) – theIdof theAssetContentRaise: NotFound–asset_content_idis not foundRaise: NullArgument–asset_content_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure