Interface AssetRepositoryAssignmentSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods to re-assign Assets to
Repositories . An Asset may map to multiple Repository
objects and removing the last reference to an Asset is the
equivalent of deleting it. Each Repository may have its own
authorizations governing who is allowed to operate on it.
Moving or adding a reference of an Asset to another
Repository is not a copy operation (eg: does not change its Id ).
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignAssetToRepository(Id assetId, Id repositoryId) Adds an existingAssetto aRepository.booleanTests if this user can alter asset/repository mappings.booleancanAssignAssetsToRepository(Id repositoryId) Tests if this user can alter asset/repository mappings.getAssignableRepositoryIds(Id repositoryId) Gets a list of repositories including and under the given repository node in which any asset can be assigned.getAssignableRepositoryIdsForAsset(Id repositoryId, Id assetId) Gets a list of repositories including and under the given repository node in which a specific asset can be assigned.voidreassignAssetToRepository(Id assetId, Id fromRepositoryId, Id toRepositoryId) Moves anAssetfrom oneRepositoryto another.voidunassignAssetFromRepository(Id assetId, Id repositoryId) Removes anAssetfrom aRepository.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
-
canAssignAssets
boolean canAssignAssets()Tests if this user can alter asset/repository mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Returns:
falseif mapping is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canAssignAssetsToRepository
Tests if this user can alter asset/repository mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Parameters:
repositoryId- theIdof theRepository- Returns:
falseif mapping is not authorized,trueotherwise- Throws:
NullArgumentException-repositoryIdisnull- Compliance:
mandatory- This method must be implemented.
-
getAssignableRepositoryIds
Gets a list of repositories including and under the given repository node in which any asset can be assigned.- Parameters:
repositoryId- theIdof theRepository- Returns:
- list of assignable repository
Ids - Throws:
NullArgumentException-repositoryIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
getAssignableRepositoryIdsForAsset
IdList getAssignableRepositoryIdsForAsset(Id repositoryId, Id assetId) throws OperationFailedException Gets a list of repositories including and under the given repository node in which a specific asset can be assigned.- Parameters:
repositoryId- theIdof theRepositoryassetId- theIdof theAsset- Returns:
- list of assignable repository
Ids - Throws:
NullArgumentException-repositoryIdorassetIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
assignAssetToRepository
void assignAssetToRepository(Id assetId, Id repositoryId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds an existingAssetto aRepository.- Parameters:
assetId- theIdof theAssetrepositoryId- theIdof theRepository- Throws:
AlreadyExistsException-assetIdalready assigned torepositoryIdNotFoundException-assetIdorrepositoryIdnot foundNullArgumentException-assetIdorrepositoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
unassignAssetFromRepository
void unassignAssetFromRepository(Id assetId, Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes anAssetfrom aRepository.- Parameters:
assetId- theIdof theAssetrepositoryId- theIdof theRepository- Throws:
NotFoundException-assetIdorrepositoryIdnot found orassetIdnot assigned torepositoryIdNullArgumentException-assetIdorrepositoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
reassignAssetToRepository
void reassignAssetToRepository(Id assetId, Id fromRepositoryId, Id toRepositoryId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Moves anAssetfrom oneRepositoryto another. Mappings to otherRepositoriesare unaffected.- Parameters:
assetId- theIdof theAssetfromRepositoryId- theIdof the currentRepositorytoRepositoryId- theIdof the destinationRepository- Throws:
AlreadyExistsException-assetIdalready assigned totoRepositoryIdNotFoundException-assetId, fromRepositoryId, ortoRepositoryIdnot found orassetIdnot mapped tofromRepositoryIdNullArgumentException-assetId, fromRepositoryId, ortoRepositoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-