Interface PositionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
PositionBatchAdminSession
This session creates, updates, and deletes Positions . 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
Position , a PositionForm is requested using
getPositionFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
PositionForm 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 PositionForm is submitted to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each PositionForm corresponds to an attempted
transaction.
For updates, PositionForms are requested to the
Position Id that is to be updated using
getPositionFormForUpdate() . Similarly, the PositionForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The PositionForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Positions . To unmap a
Position from the current Realm , the
PositionRealmAssignmentSession should be used. These delete operations
attempt to remove the Position 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 TypeMethodDescriptionvoidaliasPosition(Id positionId, Id aliasId) Adds anIdto aPositionfor the purpose of creating compatibility.booleanTests if this user can create positions.booleancanCreatePositionWithRecordTypes(Type[] positionRecordTypes) Tests if this user can create a singlePositionusing the desired record types.booleanTests if this user can delete positions.booleanTests if this user can manageIdaliases forPositions.booleanTests if this user can update positions.createPosition(PositionForm positionForm) Creates a newPosition.voiddeletePosition(Id positionId) Deletes aPosition.getPositionFormForCreate(Id organizationId, Type[] positionRecordTypes) Gets the position form for creating new positions.getPositionFormForUpdate(Id positionId) Gets the position form for updating an existing position.getRealm()Gets theRealmassociated with this session.Gets theRealmIdassociated with this session.voidupdatePosition(PositionForm positionForm) Updates an existing position.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.
-
canCreatePositions
boolean canCreatePositions()Tests if this user can create positions. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPositionwill 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:
falseifPositioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePositionWithRecordTypes
Tests if this user can create a singlePositionusing the desired record types. WhilePersonnelManager.getPositionRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPosition. Providing an empty array tests if aPositioncan be created with no records.- Parameters:
positionRecordTypes- array of position record types- Returns:
trueifPositioncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-positionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPositionFormForCreate
PositionForm getPositionFormForCreate(Id organizationId, Type[] positionRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the position form for creating new positions. A new form should be requested for each create transaction.- Parameters:
organizationId- the organizationIdto which this position belongspositionRecordTypes- array of position record types to be included in the create operation or an empty list if none- Returns:
- the position form
- Throws:
NotFoundException-organizationIdis not foundNullArgumentException-organizationIdorpositionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createPosition
Position createPosition(PositionForm positionForm) throws OperationFailedException, PermissionDeniedException Creates a newPosition.- Parameters:
positionForm- the form for thisPosition- Returns:
- the new
Position - Throws:
IllegalStateException-positionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-positionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-positionFormdid not originate fromgetPositionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePositions
boolean canUpdatePositions()Tests if this user can update positions. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPositionwill 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:
falseifPositionmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getPositionFormForUpdate
PositionForm getPositionFormForUpdate(Id positionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the position form for updating an existing position. A new position form should be requested for each update transaction.- Parameters:
positionId- theIdof thePosition- Returns:
- the position form
- Throws:
NotFoundException-positionIdis not foundNullArgumentException-positionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePosition
void updatePosition(PositionForm positionForm) throws OperationFailedException, PermissionDeniedException Updates an existing position.- Parameters:
positionForm- the form containing the elements to be updated- Throws:
IllegalStateException-positionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-positionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-positionFormdid not originate fromgetPositionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePositions
boolean canDeletePositions()Tests if this user can delete positions. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anPositionwill 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:
falseifPositiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deletePosition
void deletePosition(Id positionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aPosition.- Parameters:
positionId- theIdof thePositionto remove- Throws:
NotFoundException-positionIdnot foundNullArgumentException-positionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePositionAliases
boolean canManagePositionAliases()Tests if this user can manageIdaliases forPositions. 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:
falseifPositionaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPosition
void aliasPosition(Id positionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPositionfor the purpose of creating compatibility. The primaryIdof thePositionis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another position, it is reassigned to the given positionId.- Parameters:
positionId- theIdof aPositionaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-positionIdnot foundNullArgumentException-positionIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-