Interface OfficeAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
OfficeBatchAdminSession
This session creates, updates, and deletes Offices . The data
for create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create an
Office , an OfficeForm is requested using
getOfficeFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
OfficeForm 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 OfficeForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each OfficeForm corresponds to an attempted
transaction.
For updates, OfficeForms are requested to the Office
Id that is to be updated using getOfficeFormForUpdate() .
Similarly, the OfficeForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
OfficeForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Offices .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasOffice(Id officeId, Id aliasId) Adds anIdto anOfficefor the purpose of creating compatibility.booleanTests if this user can createOffices.booleancanCreateOfficeWithRecordTypes(Type[] officeRecordTypes) Tests if this user can create a singleOfficeusing the desired record types.booleanTests if this user can deleteOffices.booleanTests if this user can manageIdaliases forOffices.booleanTests if this user can updateOffices.createOffice(OfficeForm officeForm) Creates a newOffice.voiddeleteOffice(Id officeId) Deletes anOffice.getOfficeFormForCreate(Type[] officeRecordTypes) Gets the office form for creating new offices.getOfficeFormForUpdate(Id officeId) Gets the office form for updating an existing office.voidupdateOffice(OfficeForm officeForm) Updates an existing officeMethods 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
-
canCreateOffices
boolean canCreateOffices()Tests if this user can createOffices. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anOffice. will 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:
falseifOfficecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateOfficeWithRecordTypes
Tests if this user can create a singleOfficeusing the desired record types. WhileWorkflowManager.getOfficeRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificOffice. Providing an empty array tests if anOfficecan be created with no records.- Parameters:
officeRecordTypes- array of office record types- Returns:
trueifOfficecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-officeRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getOfficeFormForCreate
OfficeForm getOfficeFormForCreate(Type[] officeRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the office form for creating new offices. A new form should be requested for each create transaction.- Parameters:
officeRecordTypes- array of office record types- Returns:
- the office form
- Throws:
NullArgumentException-officeRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createOffice
Office createOffice(OfficeForm officeForm) throws OperationFailedException, PermissionDeniedException Creates a newOffice.- Parameters:
officeForm- the form for thisOffice- Returns:
- the new
Office - Throws:
IllegalStateException-officeFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-officeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-officeFormdid not originate fromgetOfficeFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateOffices
boolean canUpdateOffices()Tests if this user can updateOffices. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anOfficewill 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:
falseifOfficemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOfficeFormForUpdate
OfficeForm getOfficeFormForUpdate(Id officeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the office form for updating an existing office. A new office form should be requested for each update transaction.- Parameters:
officeId- theIdof theOffice- Returns:
- the office form
- Throws:
NotFoundException-officeIdis not foundNullArgumentException-officeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateOffice
Updates an existing office- Parameters:
officeForm- the form containing the elements to be updated- Throws:
IllegalStateException-officeFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-officeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-officeFormdid not originate fromgetOfficeFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteOffices
boolean canDeleteOffices()Tests if this user can deleteOffices. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anOfficewill 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:
falseifOfficedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteOffice
void deleteOffice(Id officeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anOffice.- Parameters:
officeId- theIdof theOfficeto remove- Throws:
NotFoundException-officeIdnot foundNullArgumentException-officeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageOfficeAliases
boolean canManageOfficeAliases()Tests if this user can manageIdaliases forOffices. 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:
falseifOfficealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasOffice
void aliasOffice(Id officeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anOfficefor the purpose of creating compatibility. The primaryIdof theOfficeis determined by the provider. The newIdperforms as an alias to the primaryId.- Parameters:
officeId- theIdof anOfficealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-officeIdnot foundNullArgumentException-officeIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-