Interface ProcedureAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ProcedureBatchAdminSession
This session creates, updates, and deletes Procedures . 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
Procedure , a ProcedureForm is requested using
getProcedureFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
ProcedureForm 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 ProcedureForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each ProcedureForm corresponds to an attempted
transaction.
For updates, ProcedureForms are requested to the
Procedure Id that is to be updated using
getProcedureFormForUpdate() . Similarly, the ProcedureForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The ProcedureForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Procedures . To unmap a
Procedure from the current Cookbook , the
ProcedureCookbookAssignmentSession should be used. These delete
operations attempt to remove the Procedure itself thus removing it
from all known Cookbook catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasProcedure(Id procedureId, Id aliasId) Adds anIdto aProcedurefor the purpose of creating compatibility.booleanTests if this user can create procedures.booleancanCreateProcedureWithRecordTypes(Type[] procedureRecordTypes) Tests if this user can create a singleProcedureusing the desired record types.booleancanDeleteProcedure(Id procedureId) Tests if this user can delete a specifiedProcedure.booleanTests if this user can delete procedures.booleanTests if this user can manageIdaliases forComnents.booleancanUpdateProcedure(Id procedureId) Tests if this user can update a specifiedProcedure.booleanTests if this user can update procedures.createProcedure(ProcedureForm procedureForm) Creates a newProcedure.voiddeleteProcedure(Id procedureId) Deletes aProcedure.voidDeletes allProceduresin thisCookbook.Gets theCookbookassociated with this session.Gets theCookbookIdassociated with this session.getProcedureFormForCreate(Type[] procedureRecordTypes) Gets the procedure form for creating new procedures.getProcedureFormForUpdate(Id procedureId) Gets the procedure form for updating an existing procedure.voidupdateProcedure(ProcedureForm procedureForm) Updates an existing procedure.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
-
getCookbookId
Id getCookbookId()Gets theCookbookIdassociated with this session.- Returns:
- the
Cookbook Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCookbook
Gets theCookbookassociated with this session.- Returns:
- the cookbook
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateProcedures
boolean canCreateProcedures()Tests if this user can create procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aProcedurewill 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:
falseifProcedurecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateProcedureWithRecordTypes
Tests if this user can create a singleProcedureusing the desired record types. WhileRecipeManager.getProcedureRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificProcedure. Providing an empty array tests if aProcedurecan be created with no records.- Parameters:
procedureRecordTypes- array of procedure record types- Returns:
trueifProcedurecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-procedureRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getProcedureFormForCreate
ProcedureForm getProcedureFormForCreate(Type[] procedureRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the procedure form for creating new procedures. A new form should be requested for each create transaction.- Parameters:
procedureRecordTypes- array of procedure record types- Returns:
- the procedure form
- Throws:
NullArgumentException-procedureRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createProcedure
Procedure createProcedure(ProcedureForm procedureForm) throws OperationFailedException, PermissionDeniedException Creates a newProcedure.- Parameters:
procedureForm- the form for thisProcedure- Returns:
- the new
Procedure - Throws:
IllegalStateException-procedureFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-procedureFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-procedureFormdid not originate fromgetProcedureFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateProcedures
boolean canUpdateProcedures()Tests if this user can update procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aProcedurewill 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:
falseifProceduremodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canUpdateProcedure
Tests if this user can update a specifiedProcedure. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating theProcedurewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Parameters:
procedureId- theIdof theProcedure- Returns:
falseif procedure modification is not authorized,trueotherwise- Throws:
NullArgumentException-procedureIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code procedureId} is not found, then it is acceptable to return false to indicate the lack of an update available.
-
getProcedureFormForUpdate
ProcedureForm getProcedureFormForUpdate(Id procedureId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the procedure form for updating an existing procedure. A new procedure form should be requested for each update transaction.- Parameters:
procedureId- theIdof theProcedure- Returns:
- the procedure form
- Throws:
NotFoundException-procedureIdis not foundNullArgumentException-procedureIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateProcedure
void updateProcedure(ProcedureForm procedureForm) throws OperationFailedException, PermissionDeniedException Updates an existing procedure.- Parameters:
procedureForm- the form containing the elements to be updated- Throws:
IllegalStateException-procedureFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-procedureIdorprocedureFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-procedureFormdid not originate fromgetProcedureFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteProcedures
boolean canDeleteProcedures()Tests if this user can delete procedures. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anProcedurewill 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:
falseifProceduredeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canDeleteProcedure
Tests if this user can delete a specifiedProcedure. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting theProcedurewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Parameters:
procedureId- theIdof theProcedure- Returns:
falseif deletion of thisProcedureis not authorized,trueotherwise- Throws:
NullArgumentException-procedureIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code procedureId} is not found, then it is acceptable to return false to indicate the lack of a delete available.
-
deleteProcedure
void deleteProcedure(Id procedureId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aProcedure.- Parameters:
procedureId- theIdof theProcedureto remove- Throws:
NotFoundException-procedureIdnot foundNullArgumentException-procedureIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteProcedures
Deletes allProceduresin thisCookbook.- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageProcedureAliases
boolean canManageProcedureAliases()Tests if this user can manageIdaliases forComnents. 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:
falseifProcedurealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasProcedure
void aliasProcedure(Id procedureId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aProcedurefor the purpose of creating compatibility. The primaryIdof theProcedureis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another procedure, it is reassigned to the given procedureId.- Parameters:
procedureId- theIdof aProcedurealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-procedureIdnot foundNullArgumentException-procedureIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-