public interface PersonAdminSession extends OsidSession
This session creates, updates, and deletes Persons.
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
Person,
a PersonForm
is requested using
getPersonFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned PersonForm
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 PersonForm
is submitted to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each PersonForm
corresponds to an attempted transaction.
For updates, PersonForms
are requested to the
Person
Id
that is to be updated using
getPersonFormForUpdate().
Similarly, the PersonForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The PersonForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Persons.
To unmap a
Person
from the current Realm,
the
PersonRealmAssignmentSession
should be used. These delete
operations attempt to remove the Person
itself thus
removing it from all known Realm
catalogs.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasPerson(Id personId,
Id aliasId)
Adds an
Id to a Person for the purpose
of creating compatibility. |
boolean |
canCreatePersons()
Tests if this user can create persons.
|
boolean |
canCreatePersonWithRecordTypes(Type[] personRecordTypes)
Tests if this user can create a single
Person using the
desired record types. |
boolean |
canDeletePersons()
Tests if this user can delete persons.
|
boolean |
canManagePersonAliases()
Tests if this user can manage
Id aliases for
Persons. |
boolean |
canUpdatePersons()
Tests if this user can update persons.
|
Person |
createPerson(PersonForm personForm)
Creates a new
Person. |
void |
deletePerson(Id personId)
Deletes a
Person. |
PersonForm |
getPersonFormForCreate(Type[] personRecordTypes)
Gets the person form for creating new persons.
|
PersonForm |
getPersonFormForUpdate(Id personId)
Gets the person form for updating an existing person.
|
Realm |
getRealm()
Gets the
Realm associated with this session. |
Id |
getRealmId()
Gets the
Realm Id associated with this
session. |
void |
updatePerson(PersonForm personForm)
Updates an existing person.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getRealmId()
Realm
Id
associated with this
session. Realm Id
associated with this sessionmandatory
- This method must be implemented. Realm getRealm() throws OperationFailedException, PermissionDeniedException
Realm
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreatePersons()
Person
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 Person
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreatePersonWithRecordTypes(Type[] personRecordTypes)
Person
using the
desired record types. While
PersonnelManager.getPersonRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Person.
Providing an
empty array tests if a Person
can be created with no
records.personRecordTypes
- array of person record types true
if Person
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- personRecordTypes
is null
mandatory
- This method must be implemented. PersonForm getPersonFormForCreate(Type[] personRecordTypes) throws OperationFailedException, PermissionDeniedException
personRecordTypes
- array of person record types to be included
in the create operation or an empty list if noneNullArgumentException
- personRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Person createPerson(PersonForm personForm) throws OperationFailedException, PermissionDeniedException
Person.
personForm
- the form for this Person
Person
IllegalStateException
- personForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- personForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- personForm
did
not originate from getPersonFormForCreate()
mandatory
- This method must be implemented. boolean canUpdatePersons()
Person
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 Person
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. PersonForm getPersonFormForUpdate(Id personId) throws NotFoundException, OperationFailedException, PermissionDeniedException
personId
- the Id
of the Person
NotFoundException
- personId
is not
foundNullArgumentException
- personId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updatePerson(PersonForm personForm) throws OperationFailedException, PermissionDeniedException
personForm
- the form containing the elements to be updatedIllegalStateException
- personForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- personForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- personForm
did
not originate from getPersonFormForUpdate()
mandatory
- This method must be implemented. boolean canDeletePersons()
Person
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 Person
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deletePerson(Id personId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Person.
personId
- the Id
of the Person
to
removeNotFoundException
- personId
not foundNullArgumentException
- personId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManagePersonAliases()
Id
aliases for
Persons.
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 Person
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasPerson(Id personId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Person
for the purpose
of creating compatibility. The primary Id
of the
Person
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is
a pointer to another person, it is reassigned to the given person
Id.
personId
- the Id
of a Person
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- personId
not foundNullArgumentException
- personId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.