Interface RepositoryAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
RepositoryBatchAdminSession
This session creates, updates, and deletes Repositories . The
data for create and update is provided by the consumer via the form
object. OsidForms are requested for each create or update and may
not be reused.
Create and update operations differ in their usage. To create a
Repository , a RepositoryForm is requested using
getRepositoryFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
RepositoryForm will indicate that it is to be used with a create
operation and can be used to examine metdata or validate data prior to
creation. Once the RepositoryForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each RepositoryForm corresponds
to an attempted transaction.
For updates, RepositoryForms are requested to the
Repository Id that is to be updated using
getRepositoryFormForUpdate() . Similarly, the RepositoryForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The RepositoryForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Repositories . This session
includes an Id aliasing mechanism to assign an external Id
to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasRepository(Id repositoryId, Id aliasId) Adds anIdto aRepositoryfor the purpose of creating compatibility.booleanTests if this user can createRepositories.booleancanCreateRepositoryWithRecordTypes(Type[] repositoryRecordTypes) Tests if this user can create a singleRepositoryusing the desired record types.booleanTests if this user can deleteRepositories.booleanTests if this user can manageIdaliases for repositories.booleanTests if this user can updateRepositories.createRepository(RepositoryForm repositoryForm) Creates a newRepository.voiddeleteRepository(Id repositoryId) Deletes aRepository.getRepositoryFormForCreate(Type[] repositoryRecordTypes) Gets the repository form for creating new repositories.getRepositoryFormForUpdate(Id repositoryId) Gets the repository form for updating an existing repository.voidupdateRepository(RepositoryForm repositoryForm) Updates an existing repository.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
-
canCreateRepositories
boolean canCreateRepositories()Tests if this user can createRepositories. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aRepositorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifRepositorycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateRepositoryWithRecordTypes
Tests if this user can create a singleRepositoryusing the desired record types. WhileRepositoryManager.getRepositoryRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificRepository. Providing an empty array tests if aRepositorycan be created with no records.- Parameters:
repositoryRecordTypes- array of repository record types- Returns:
trueifRepositorycreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-repositoryRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getRepositoryFormForCreate
RepositoryForm getRepositoryFormForCreate(Type[] repositoryRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the repository form for creating new repositories. A new form should be requested for each create transaction.- Parameters:
repositoryRecordTypes- array of repository record types- Returns:
- the repository form
- Throws:
NullArgumentException-repositoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createRepository
Repository createRepository(RepositoryForm repositoryForm) throws OperationFailedException, PermissionDeniedException Creates a newRepository.- Parameters:
repositoryForm- the form for thisRepository- Returns:
- the new
Repository - Throws:
IllegalStateException-repositoryFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-repositoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-repositoryFormdid not originate fromgetRepositoryFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateRepositories
boolean canUpdateRepositories()Tests if this user can updateRepositories. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aRepositorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifRepositorymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRepositoryFormForUpdate
RepositoryForm getRepositoryFormForUpdate(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the repository form for updating an existing repository. A new repository form should be requested for each update transaction.- Parameters:
repositoryId- theIdof theRepository- Returns:
- the repository form
- Throws:
NotFoundException-repositoryIdis not foundNullArgumentException-repositoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRepository
void updateRepository(RepositoryForm repositoryForm) throws OperationFailedException, PermissionDeniedException Updates an existing repository.- Parameters:
repositoryForm- the form containing the elements to be updated- Throws:
IllegalStateException-repositoryFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-repositoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-repositoryFormdid not originate fromgetRepositoryFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteRepositories
boolean canDeleteRepositories()Tests if this user can deleteRepositories. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aRepositorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifRepositorydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteRepository
void deleteRepository(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aRepository.- Parameters:
repositoryId- theIdof theRepositoryto remove- Throws:
NotFoundException-repositoryIdnot foundNullArgumentException-repositoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageRepositoryAliases
boolean canManageRepositoryAliases()Tests if this user can manageIdaliases for repositories. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifRepositoryaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasRepository
void aliasRepository(Id repositoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aRepositoryfor the purpose of creating compatibility. The primaryIdof theRepositoryis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another repository, it is reassigned to the given repositoryId.- Parameters:
repositoryId- theIdof aRepositoryaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-repositoryIdnot foundNullArgumentException-repositoryIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-