Interface AssetRepositoryAssignmentSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface AssetRepositoryAssignmentSession extends 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 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 a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.
      Returns:
      false if mapping is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canAssignAssetsToRepository

      boolean canAssignAssetsToRepository(Id repositoryId)
      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 a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.
      Parameters:
      repositoryId - the Id of the Repository
      Returns:
      false if mapping is not authorized, true otherwise
      Throws:
      NullArgumentException - repositoryId is null
      Compliance:
      mandatory - This method must be implemented.
    • getAssignableRepositoryIds

      IdList getAssignableRepositoryIds(Id repositoryId) throws OperationFailedException
      Gets a list of repositories including and under the given repository node in which any asset can be assigned.
      Parameters:
      repositoryId - the Id of the Repository
      Returns:
      list of assignable repository Ids
      Throws:
      NullArgumentException - repositoryId is null
      OperationFailedException - 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 - the Id of the Repository
      assetId - the Id of the Asset
      Returns:
      list of assignable repository Ids
      Throws:
      NullArgumentException - repositoryId or assetId is null
      OperationFailedException - 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 existing Asset to a Repository .
      Parameters:
      assetId - the Id of the Asset
      repositoryId - the Id of the Repository
      Throws:
      AlreadyExistsException - assetId already assigned to repositoryId
      NotFoundException - assetId or repositoryId not found
      NullArgumentException - assetId or repositoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • unassignAssetFromRepository

      void unassignAssetFromRepository(Id assetId, Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Removes an Asset from a Repository .
      Parameters:
      assetId - the Id of the Asset
      repositoryId - the Id of the Repository
      Throws:
      NotFoundException - assetId or repositoryId not found or assetId not assigned to repositoryId
      NullArgumentException - assetId or repositoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • reassignAssetToRepository

      void reassignAssetToRepository(Id assetId, Id fromRepositoryId, Id toRepositoryId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Moves an Asset from one Repository to another. Mappings to other Repositories are unaffected.
      Parameters:
      assetId - the Id of the Asset
      fromRepositoryId - the Id of the current Repository
      toRepositoryId - the Id of the destination Repository
      Throws:
      AlreadyExistsException - assetId already assigned to toRepositoryId
      NotFoundException - assetId, fromRepositoryId , or toRepositoryId not found or assetId not mapped to fromRepositoryId
      NullArgumentException - assetId, fromRepositoryId , or toRepositoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.