public interface RepositoryAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasRepository(Id repositoryId,
Id aliasId)
Adds an
Id to a Repository for the
purpose of creating compatibility. |
boolean |
canCreateRepositories()
Tests if this user can create
Repositories. |
boolean |
canCreateRepositoryWithRecordTypes(Type[] repositoryRecordTypes)
Tests if this user can create a single
Repository using
the desired record types. |
boolean |
canDeleteRepositories()
Tests if this user can delete
Repositories. |
boolean |
canManageRepositoryAliases()
Tests if this user can manage
Id aliases for
repositories. |
boolean |
canUpdateRepositories()
Tests if this user can update
Repositories. |
Repository |
createRepository(RepositoryForm repositoryForm)
Creates a new
Repository. |
void |
deleteRepository(Id repositoryId)
Deletes a
Repository. |
RepositoryForm |
getRepositoryFormForCreate(Type[] repositoryRecordTypes)
Gets the repository form for creating new repositories.
|
RepositoryForm |
getRepositoryFormForUpdate(Id repositoryId)
Gets the repository form for updating an existing repository.
|
void |
updateRepository(RepositoryForm repositoryForm)
Updates an existing repository.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateRepositories()
Repositories.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Repository
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer create operations to
unauthorized users. false
if Repository
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateRepositoryWithRecordTypes(Type[] repositoryRecordTypes)
Repository
using
the desired record types. While
RepositoryManager.getRepositoryRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Repository.
Providing an empty array tests if a Repository
can be
created with no records.repositoryRecordTypes
- array of repository record types true
if Repository
creation
using the specified Types
is supported,
false
otherwiseNullArgumentException
- repositoryRecordTypes
is null
mandatory
- This method must be implemented. RepositoryForm getRepositoryFormForCreate(Type[] repositoryRecordTypes) throws OperationFailedException, PermissionDeniedException
repositoryRecordTypes
- array of repository record typesNullArgumentException
- repositoryRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Repository createRepository(RepositoryForm repositoryForm) throws OperationFailedException, PermissionDeniedException
Repository.
repositoryForm
- the form for this Repository
Repository
IllegalStateException
- repositoryForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- repositoryForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- repositoryForm
did not originate from getRepositoryFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateRepositories()
Repositories.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Repository
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer update operations to
unauthorized users. false
if Repository
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. RepositoryForm getRepositoryFormForUpdate(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
repositoryId
- the Id
of the Repository
NotFoundException
- repositoryId
is not
foundNullArgumentException
- repositoryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateRepository(RepositoryForm repositoryForm) throws OperationFailedException, PermissionDeniedException
repositoryForm
- the form containing the elements to be updatedIllegalStateException
- repositoryForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- repositoryForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- repositoryForm
did not originate from getRepositoryFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteRepositories()
Repositories.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Repository
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer delete operations to
unauthorized users. false
if Repository
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteRepository(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Repository.
repositoryId
- the Id
of the Repository
to removeNotFoundException
- repositoryId
not
foundNullArgumentException
- repositoryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageRepositoryAliases()
Id
aliases 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 a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Repository
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasRepository(Id repositoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Repository
for the
purpose of creating compatibility. The primary Id
of
the Repository
is determined by the provider. The new
Id
is an alias to the primary Id.
If the
alias is a pointer to another repository, it is reassigned to the
given repository Id.
repositoryId
- the Id
of a Repository
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- repositoryId
not
foundNullArgumentException
- repositoryId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.