Interface PersonAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
PersonBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasPerson(Id personId, Id aliasId) Adds anIdto aPersonfor the purpose of creating compatibility.booleanTests if this user can create persons.booleancanCreatePersonWithRecordTypes(Type[] personRecordTypes) Tests if this user can create a singlePersonusing the desired record types.booleanTests if this user can delete persons.booleanTests if this user can manageIdaliases forPersons.booleanTests if this user can update persons.createPerson(PersonForm personForm) Creates a newPerson.voiddeletePerson(Id personId) Deletes aPerson.getPersonFormForCreate(Type[] personRecordTypes) Gets the person form for creating new persons.getPersonFormForUpdate(Id personId) Gets the person form for updating an existing person.getRealm()Gets theRealmassociated with this session.Gets theRealmIdassociated with this session.voidupdatePerson(PersonForm personForm) Updates an existing person.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
-
getRealmId
Id getRealmId()Gets theRealmIdassociated with this session.- Returns:
- the
Realm Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getRealm
Gets theRealmassociated with this session.- Returns:
- the realm
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreatePersons
boolean canCreatePersons()Tests if this user can create persons. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPersonwill 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:
falseifPersoncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePersonWithRecordTypes
Tests if this user can create a singlePersonusing the desired record types. WhilePersonnelManager.getPersonRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPerson. Providing an empty array tests if aPersoncan be created with no records.- Parameters:
personRecordTypes- array of person record types- Returns:
trueifPersoncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-personRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPersonFormForCreate
PersonForm getPersonFormForCreate(Type[] personRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the person form for creating new persons. A new form should be requested for each create transaction.- Parameters:
personRecordTypes- array of person record types to be included in the create operation or an empty list if none- Returns:
- the person form
- Throws:
NullArgumentException-personRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createPerson
Person createPerson(PersonForm personForm) throws OperationFailedException, PermissionDeniedException Creates a newPerson.- Parameters:
personForm- the form for thisPerson- Returns:
- the new
Person - Throws:
IllegalStateException-personFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-personFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-personFormdid not originate fromgetPersonFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePersons
boolean canUpdatePersons()Tests if this user can update persons. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPersonwill 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:
falseifPersonmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getPersonFormForUpdate
PersonForm getPersonFormForUpdate(Id personId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the person form for updating an existing person. A new person form should be requested for each update transaction.- Parameters:
personId- theIdof thePerson- Returns:
- the person form
- Throws:
NotFoundException-personIdis not foundNullArgumentException-personIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePerson
Updates an existing person.- Parameters:
personForm- the form containing the elements to be updated- Throws:
IllegalStateException-personFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-personFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-personFormdid not originate fromgetPersonFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePersons
boolean canDeletePersons()Tests if this user can delete persons. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anPersonwill 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:
falseifPersondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deletePerson
void deletePerson(Id personId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aPerson.- Parameters:
personId- theIdof thePersonto remove- Throws:
NotFoundException-personIdnot foundNullArgumentException-personIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePersonAliases
boolean canManagePersonAliases()Tests if this user can manageIdaliases forPersons. 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:
falseifPersonaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPerson
void aliasPerson(Id personId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPersonfor the purpose of creating compatibility. The primaryIdof thePersonis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another person, it is reassigned to the given personId.- Parameters:
personId- theIdof aPersonaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-personIdnot foundNullArgumentException-personIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-