Interface BlockBatchAdminSession
- All Superinterfaces:
AutoCloseable, BlockAdminSession, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Blocks 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
Block , a BlockForm is requested using
getBlockFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
BlockForms 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 BlockForm is submiited to a create operation, it cannot be
reused with another create operation unless the first operation was
unsuccessful. Each BlockForm corresponds to an attempted
transaction.
The BlockForms returned from getBlockFormsForCreate()
may be linked to the originating request through the peer Ids of
the BlockForm . In the case where there may be duplicates, any
BlockForm of the same peer Ids may be used for a create
operation.
Once a batch of BlockForms are submitted for create, a
CreateResponse is returned for each BlockForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createBlocks() , errors specific to an
individual BlockForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
BlockForm through the BlockForm Id .
For updates, BlockForms are requested to the Block
Id that is to be updated using getBlockFormsForUpdate()
where the reference Id in the BlockForm may be used to
link the request. Similarly, the BlockForm has metadata about the
data that can be updated and it can perform validation before submitting
the update. The BlockForm can only be used once for a successful
update and cannot be reused.
Once a batch of BlockForms are submitted for update, an
UpdateResponse is returned for each BlockForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateBlocks() , errors specific to an
individual BlockForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
BlockForm through the BlockForm Id .
The delete operations delete Blocks in bulk. To unmap a
Block from the current Oubliette , the
BlockOublietteAssignmentSession should be used. These delete operations
attempt to remove the Block itself thus removing it from all known
Oubliette catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasBlocks(AliasRequestList aliasRequests) Adds anIdto aBlockfor the purpose of creating compatibility.createBlocks(BlockBatchFormList blockForms) Creates a new set ofBlocks.Deletes allBlocksin thisOubliette.deleteBlocks(IdList blockIds) Deletes blocks for the givenIds.getBlockFormsForCreate(long number, Type[] blockRecordTypes) Gets the block forms for creating a bunch of new blocks.getBlockFormsForUpdate(IdList blockIds) Gets the block forms for updating an existing set of blocks.updateBlocks(BlockBatchFormList blockForms) Updates existing blocks.Methods inherited from interface BlockAdminSession
aliasBlock, canCreateBlocks, canCreateBlockWithRecordTypes, canDeleteBlocks, canManageBlockAliases, canUpdateBlocks, createBlock, deleteBlock, getBlockFormForCreate, getBlockFormForUpdate, getOubliette, getOublietteId, updateBlockModifier and TypeMethodDescriptionvoidaliasBlock(Id blockId, Id aliasId) Adds anIdto aBlockfor the purpose of creating compatibility.booleanTests if this user can createBlocks.booleancanCreateBlockWithRecordTypes(Type[] blockRecordTypes) Tests if this user can create a singleBlockusing the desired record types.booleanTests if this user can deleteBlocks.booleanTests if this user can manageIdaliases forBlocks.booleanTests if this user can updateBlocks.createBlock(BlockForm blockForm) Creates a newBlock.voiddeleteBlock(Id blockId) Deletes aBlock.getBlockFormForCreate(Type[] blockRecordTypes) Gets the block form for creating new blocks.getBlockFormForUpdate(Id blockId) Gets the block form for updating an existing block.Gets theOublietteassociated with this session.Gets theOublietteIdassociated with this session.voidupdateBlock(BlockForm blockForm) Updates an existing block.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
-
getBlockFormsForCreate
BlockBatchFormList getBlockFormsForCreate(long number, Type[] blockRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the block forms for creating a bunch of new blocks.- Parameters:
number- the number of forms to retrieveblockRecordTypes- array of block record types to be included in each create operation or an empty list if none- Returns:
- the block forms
- Throws:
NullArgumentException-blockRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createBlocks
CreateResponseList createBlocks(BlockBatchFormList blockForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofBlocks. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
blockForms- the block forms- Returns:
- the create responses
- Throws:
NullArgumentException-blockFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBlockFormsForUpdate
BlockBatchFormList getBlockFormsForUpdate(IdList blockIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the block forms for updating an existing set of blocks. A new block form should be requested for each update transaction.- Parameters:
blockIds- theIdsof theBlock- Returns:
- the block form
- Throws:
NotFoundException- ablockIdis not foundNullArgumentException-blockIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBlocks
UpdateResponseList updateBlocks(BlockBatchFormList blockForms) throws OperationFailedException, PermissionDeniedException Updates existing blocks. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
blockForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-blockFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllBlocks
Deletes allBlocksin thisOubliette.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteBlocks
DeleteResponseList deleteBlocks(IdList blockIds) throws OperationFailedException, PermissionDeniedException Deletes blocks for the givenIds.- Parameters:
blockIds- theIdsof the blocks to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-blockIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasBlocks
AliasResponseList aliasBlocks(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aBlockfor the purpose of creating compatibility. The primaryIdof theBlockis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another block, it is reassigned to the given blockId.- 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.
-