public interface RealmAdminSession extends OsidSession
This session creates, updates, and deletes Realms.
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
Realm,
a RealmForm
is requested using
getRealmFormForCreate()
specifying the desired record Types
or none if no record Types
are needed. The returned
RealmForm
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 RealmForm
is submitted to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each RealmForm
corresponds to an attempted transaction.
For updates, RealmForms
are requested to the
Realm
Id
that is to be updated using
getRealmFormForUpdate().
Similarly, the RealmForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The RealmForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Realms.
It is safer to
remove all mappings to the Realm
catalogs before deletion.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasRealm(Id realmId,
Id aliasId)
Adds an
Id to a Realm for the purpose of
creating compatibility. |
boolean |
canCreateRealms()
Tests if this user can create
Realms. |
boolean |
canCreateRealmWithRecordTypes(Type[] realmRecordTypes)
Tests if this user can create a single
Realm using the
desired record types. |
boolean |
canDeleteRealms()
Tests if this user can delete
Realms A return of true
does not guarantee successful authorization. |
boolean |
canManageRealmAliases()
Tests if this user can manage
Id aliases for
Realms. |
boolean |
canUpdateRealms()
Tests if this user can update
Realms. |
Realm |
createRealm(RealmForm realmForm)
Creates a new
Realm. |
void |
deleteRealm(Id realmId)
Deletes a
Realm. |
RealmForm |
getRealmFormForCreate(Type[] realmRecordTypes)
Gets the realm form for creating new realms.
|
RealmForm |
getRealmFormForUpdate(Id realmId)
Gets the realm form for updating an existing realm.
|
void |
updateRealm(RealmForm realmForm)
Updates an existing realm.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateRealms()
Realms.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Realm
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 Realm
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateRealmWithRecordTypes(Type[] realmRecordTypes)
Realm
using the
desired record types. While
PersonnelManager.getRealmRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Realm.
Providing an
empty array tests if a Realm
can be created with no
records.realmRecordTypes
- array of types true
if Realm
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- realmRecordTypes
is null
mandatory
- This method must be implemented. RealmForm getRealmFormForCreate(Type[] realmRecordTypes) throws OperationFailedException, PermissionDeniedException
realmRecordTypes
- array of typesNullArgumentException
- realmRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Realm createRealm(RealmForm realmForm) throws OperationFailedException, PermissionDeniedException
Realm.
realmForm
- the form for this Realm
Realm
IllegalStateException
- realmForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- realmForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- realmForm
did not
originate from getRealmFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateRealms()
Realms.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Realm
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 Realm
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. RealmForm getRealmFormForUpdate(Id realmId) throws NotFoundException, OperationFailedException, PermissionDeniedException
realmId
- the Id
of the Realm
NotFoundException
- realmId
is not foundNullArgumentException
- realmId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateRealm(RealmForm realmForm) throws OperationFailedException, PermissionDeniedException
realmForm
- the form containing the elements to be updatedIllegalStateException
- realmForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- realmForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- realmForm did not
originate from getRealmtFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteRealms()
Realms
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Realm
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 Realm
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteRealm(Id realmId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Realm.
realmId
- the Id
of the Realm
to
removeNotFoundException
- realmId
not foundNullArgumentException
- realmId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageRealmAliases()
Id
aliases for
Realms.
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 Realm
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasRealm(Id realmId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Realm
for the purpose of
creating compatibility. The primary Id
of the
Item
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is a
pointer to another realm, it is reassigned to the given realm
Id.
realmId
- the Id
of a Realm
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- realmId
not foundNullArgumentException
- realmId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.