Interface KeyBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, KeyAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Keys 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
Key , a KeyForm is requested using getKeyFormsForCreate()
specifying the desired agent and record Types or none if no record
Types are needed. Each of the returned KeyForms 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 KeyForm
is submiited to a create operation, it cannot be reused with another
create operation unless the first operation was unsuccessful. Each
KeyForm corresponds to an attempted transaction.
The KeyForms returned from getKeyFormsForCreate() may
be linked to the originating request through the peer Ids of the
KeyForm . In the case where there may be duplicates, any
KeyForm of the same peer Ids may be used for a create operation.
Once a batch of KeyForms are submitted for create, a
CreateResponse is returned for each KeyForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createKeys() , errors specific to an
individual KeyForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
KeyForm through the KeyForm Id .
For updates, KeyForms are requested to the Key
Id that is to be updated using getKeyFormsForUpdate() where the
reference Id in the KeyForm may be used to link the
request. Similarly, the KeyForm has metadata about the data that
can be updated and it can perform validation before submitting the update.
The KeyForm can only be used once for a successful update and
cannot be reused.
Once a batch of KeyForms are submitted for update, an
UpdateResponse is returned for each KeyForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateKeys() , errors specific to an
individual KeyForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
KeyForm through the KeyForm Id .
The delete operations delete Keys in bulk. To unmap a
Key from the current Agency , the
KeyAgencyAssignmentSession should be used. These delete operations
attempt to remove the Key itself thus removing it from all known
Agency catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasKeys(AliasRequestList aliasRequests) Adds anIdto aKeyfor the purpose of creating compatibility.createKeys(KeyBatchFormList keyForms) Creates a new set ofKeys.Deletes allKeysin thisAgency.deleteKeys(IdList keyIds) Deletes keys for the givenIds.deleteKeysForAgent(Id agentId) Deletes keys for the given agentId.getKeyFormsForCreate(IdList agentIds, Type[] keyRecordTypes) Gets the key forms for creating a bunch of new keys.getKeyFormsForUpdate(IdList keyIds) Gets the key forms for updating an existing set of keys.updateKeys(KeyBatchFormList keyForms) Updates existing keys.Methods inherited from interface KeyAdminSession
canCreateKeys, canCreateKeyWithRecordTypes, canDeleteKeys, canUpdateKeys, createKey, deleteKey, getAgency, getAgencyId, getKeyFormForCreate, getKeyFormForUpdate, updateKeyModifier and TypeMethodDescriptionbooleanTests if this user can createKeys.booleancanCreateKeyWithRecordTypes(Type[] keyRecordTypes) Tests if this user can create a singleKeyusing the desired record interface types.booleanTests if this user can deleteKeys.booleanTests if this user can updateKeys.Creates a newKey.voidDeletes aKey.Gets theAgencyassociated with this session.Gets theAgencyIdassociated with this session.getKeyFormForCreate(Id agentId, Type[] keyRecordTypes) Gets the key form for creating and updating new keys.getKeyFormForUpdate(Id keyId) Gets the key form for updating an existing key.voidUpdates a key for an agent.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
-
getKeyFormsForCreate
KeyBatchFormList getKeyFormsForCreate(IdList agentIds, Type[] keyRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the key forms for creating a bunch of new keys. A key form is returned for each supplied agent.- Parameters:
agentIds- a list of agentIdskeyRecordTypes- array of key record types to be included in each create operation or an empty list if none- Returns:
- the key forms
- Throws:
NotFoundException-an agentIdis not foundNullArgumentException-agentIdsorkeyRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createKeys
CreateResponseList createKeys(KeyBatchFormList keyForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofKeys. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
keyForms- the key forms- Returns:
- the create responses
- Throws:
NullArgumentException-keyFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getKeyFormsForUpdate
KeyBatchFormList getKeyFormsForUpdate(IdList keyIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the key forms for updating an existing set of keys. A new key form should be requested for each update transaction.- Parameters:
keyIds- theIdsof theKey- Returns:
- the key form
- Throws:
NotFoundException- akeyIdis not foundNullArgumentException-keyIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateKeys
UpdateResponseList updateKeys(KeyBatchFormList keyForms) throws OperationFailedException, PermissionDeniedException Updates existing keys. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
keyForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-keyFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllKeys
Deletes allKeysin thisAgency.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteKeys
DeleteResponseList deleteKeys(IdList keyIds) throws OperationFailedException, PermissionDeniedException Deletes keys for the givenIds.- Parameters:
keyIds- theIdsof the keys to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-keyIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteKeysForAgent
DeleteResponseList deleteKeysForAgent(Id agentId) throws OperationFailedException, PermissionDeniedException Deletes keys for the given agentId.- Parameters:
agentId- theIdof an agent- Returns:
- the delete responses
- Throws:
NullArgumentException-agentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasKeys
AliasResponseList aliasKeys(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aKeyfor the purpose of creating compatibility. The primaryIdof theKeyis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another key, it is reassigned to the given keyId.- 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.
-