Interface FunctionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
FunctionBatchAdminSession
This session creates, updates, and deletes Functions . 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
Function , a FunctionForm is requested using
getFunctionFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned FunctionForm 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 FunctionForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each FunctionForm corresponds to
an attempted transaction.
For updates, FunctionForms are requested to the
Function Id that is to be updated using
getFunctionFormForUpdate() . Similarly, the FunctionForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The FunctionForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Functions . To unmap a
Function from the current Vault , the
FunctionVaultAssignmentSession should be used. These delete operations
attempt to remove the Function itself thus removing it from all
known Vault catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasFunction(Id functionId, Id aliasId) Adds anIdto aFunctionfor the purpose of creating compatibility.booleanTests if this user can createFunctions.booleancanCreateFunctionWithRecordTypes(Type[] functionRecordTypes) Tests if this user can create a singleFunctionusing the desired record types.booleanTests if this user can deleteFunctions.booleanTests if this user can manageIdaliases forFunctions.booleanTests if this user can updateFunctions.createFunction(FunctionForm functionForm) Creates a newFunction.voiddeleteFunction(Id functionId) Deletes theFunctionidentified by the givenId.getFunctionFormForCreate(Type[] functionRecordTypes) Gets the function form for creating new functions.getFunctionFormForUpdate(Id functionId) Gets the function form for updating an existing function.getVault()Gets theVaultassociated with this session.Gets theVaultIdassociated with this session.voidupdateFunction(FunctionForm functionForm) Updates an existing function.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
-
getVaultId
Id getVaultId()Gets theVaultIdassociated with this session.- Returns:
- the
Vault Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getVault
Gets theVaultassociated with this session.- Returns:
- the vault
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateFunctions
boolean canCreateFunctions()Tests if this user can createFunctions. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aFunctionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifFunctioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateFunctionWithRecordTypes
Tests if this user can create a singleFunctionusing the desired record types. WhileAuthorizationManager.getFunctionRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificFunction. Providing an empty array tests if aFunctioncan be created with no records.- Parameters:
functionRecordTypes- array of function record types- Returns:
trueifFunctioncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-functionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getFunctionFormForCreate
FunctionForm getFunctionFormForCreate(Type[] functionRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the function form for creating new functions. A new form should be requested for each create transaction.- Parameters:
functionRecordTypes- array of function record types- Returns:
- the function form
- Throws:
NullArgumentException-functionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form qith requested record types- Compliance:
mandatory- This method must be implemented.
-
createFunction
Function createFunction(FunctionForm functionForm) throws OperationFailedException, PermissionDeniedException Creates a newFunction.- Parameters:
functionForm- the form for thisFunction- Returns:
- the new
Function - Throws:
IllegalStateException-functionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-functionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-functionFormdid not originate fromgetFunctionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateFunctions
boolean canUpdateFunctions()Tests if this user can updateFunctions. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aFunctionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif function modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getFunctionFormForUpdate
FunctionForm getFunctionFormForUpdate(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the function form for updating an existing function. A new function form should be requested for each update transaction.- Parameters:
functionId- theIdof theFunction- Returns:
- the function form
- Throws:
NotFoundException-functionIdis not foundNullArgumentException-functionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateFunction
void updateFunction(FunctionForm functionForm) throws OperationFailedException, PermissionDeniedException Updates an existing function.- Parameters:
functionForm- the form containing the elements to be updated- Throws:
IllegalStateException-functionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-functionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-functionFormdid not originate fromgetFunctionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteFunctions
boolean canDeleteFunctions()Tests if this user can deleteFunctions. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aFunctionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifFunctiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteFunction
void deleteFunction(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theFunctionidentified by the givenId.- Parameters:
functionId- theIdof theFunctionto delete- Throws:
NotFoundException- aFunctionwas not found identified by the givenIdNullArgumentException-functionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageFunctionAliases
boolean canManageFunctionAliases()Tests if this user can manageIdaliases forFunctions. 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:
falseifFunctionaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasFunction
void aliasFunction(Id functionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aFunctionfor the purpose of creating compatibility. The primaryIdof theFunctionis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another function, it is reassigned to the given functionId.- Parameters:
functionId- theIdof aFunctionaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-functionIdnot foundNullArgumentException-functionIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-