Interface FunctionBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, FunctionAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Functions in bulk.
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
getFunctionFormsForCreate() specifying the desired record Types
or none if no record Types are needed. Each of the returned
FunctionForms 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 a 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.
The FunctionForms returned from
getFunctionFormsForCreate() may be linked to the originating request
through the peer Ids of the FunctionForm . In the case
where there may be duplicates, any FunctionForm of the same peer
Ids may be used for a create operation.
Once a batch of FunctionForms are submitted for create, a
CreateResponse is returned for each FunctionForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createFunctions() ,
errors specific to an individual FunctionForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating FunctionForm through the
FunctionForm Id .
For updates, FunctionForms are requested to the
Function Id that is to be updated using
getFunctionFormsForUpdate() where the reference Id in the
FunctionForm may be used to link the request. 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.
Once a batch of FunctionForms are submitted for update, an
UpdateResponse is returned for each FunctionForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateFunctions() ,
errors specific to an individual FunctionForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating FunctionForm through the
FunctionForm Id .
The delete operations delete Functions in bulk. 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasFunctions(AliasRequestList aliasRequests) Adds anIdto aFunctionfor the purpose of creating compatibility.createFunctions(FunctionBatchFormList functionForms) Creates a new set ofFunctions.Deletes allFunctionsin thisVault.deleteFunctions(IdList functionIds) Deletes functions for the givenIds.getFunctionFormsForCreate(long number, Type[] functionRecordTypes) Gets the function forms for creating a bunch of new functions.getFunctionFormsForUpdate(IdList functionIds) Gets the function forms for updating an existing set of functions.updateFunctions(FunctionBatchFormList functionForms) Updates existing functions.Methods inherited from interface FunctionAdminSession
aliasFunction, canCreateFunctions, canCreateFunctionWithRecordTypes, canDeleteFunctions, canManageFunctionAliases, canUpdateFunctions, createFunction, deleteFunction, getFunctionFormForCreate, getFunctionFormForUpdate, getVault, getVaultId, updateFunctionModifier 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
-
getFunctionFormsForCreate
FunctionBatchFormList getFunctionFormsForCreate(long number, Type[] functionRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the function forms for creating a bunch of new functions.- Parameters:
number- the number of forms to retrievefunctionRecordTypes- array of function record types to be included in each create operation or an empty list if none- Returns:
- the function forms
- Throws:
NullArgumentException-functionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createFunctions
CreateResponseList createFunctions(FunctionBatchFormList functionForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofFunctions. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
functionForms- the function forms- Returns:
- the create responses
- Throws:
NullArgumentException-functionFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getFunctionFormsForUpdate
FunctionBatchFormList getFunctionFormsForUpdate(IdList functionIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the function forms for updating an existing set of functions. A new function form should be requested for each update transaction.- Parameters:
functionIds- theIdsof theFunction- Returns:
- the function form
- Throws:
NotFoundException- afunctionIdis not foundNullArgumentException-functionIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateFunctions
UpdateResponseList updateFunctions(FunctionBatchFormList functionForms) throws OperationFailedException, PermissionDeniedException Updates existing functions. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
functionForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-functionFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllFunctions
Deletes allFunctionsin thisVault.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteFunctions
DeleteResponseList deleteFunctions(IdList functionIds) throws OperationFailedException, PermissionDeniedException Deletes functions for the givenIds.- Parameters:
functionIds- theIdsof the functions to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-functionIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasFunctions
AliasResponseList aliasFunctions(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aFunctionfor the purpose of creating compatibility. The primaryIdof theFunctionis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another function, it is reassigned to the given entryId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-