Interface BlockAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
BlockBatchAdminSession
This session creates, updates, and deletes Blocks . 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
getBlockFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned BlockForm 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 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.
For updates, BlockForms are requested to the Block
Id that is to be updated using getBlockFormForUpdate() .
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.
The delete operations delete Blocks . 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.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier 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
-
getOublietteId
Id getOublietteId()Gets theOublietteIdassociated with this session.- Returns:
- the
Oubliette Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getOubliette
Gets theOublietteassociated with this session.- Returns:
- the oubliette
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateBlocks
boolean canCreateBlocks()Tests if this user can createBlocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aBlockwill 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:
falseifBlockcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateBlockWithRecordTypes
Tests if this user can create a singleBlockusing the desired record types. WhileHoldManager.getBlockRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificBlock. Providing an empty array tests if aBlockcan be created with no records.- Parameters:
blockRecordTypes- array of block record types- Returns:
trueifBlockcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-blockRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getBlockFormForCreate
BlockForm getBlockFormForCreate(Type[] blockRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the block form for creating new blocks. A new form should be requested for each create transaction.- Parameters:
blockRecordTypes- array of block record types- Returns:
- the block form
- Throws:
NullArgumentException-blockRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createBlock
Creates a newBlock.- Parameters:
blockForm- the form for thisBlock- Returns:
- the new
Block - Throws:
IllegalStateException-blockFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-blockFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-blockFormdid not originate fromgetBlockFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateBlocks
boolean canUpdateBlocks()Tests if this user can updateBlocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBlockwill 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:
falseifBlockmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getBlockFormForUpdate
Gets the block form for updating an existing block. A new block form should be requested for each update transaction.- Parameters:
blockId- theIdof theBlock- Returns:
- the block form
- Throws:
NotFoundException-blockIdis not foundNullArgumentException-blockIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateBlock
Updates an existing block.- Parameters:
blockForm- the form containing the elements to be updated- Throws:
IllegalStateException-blockFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-blockIdorblockFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-blockFormdid not originate fromgetBlockFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteBlocks
boolean canDeleteBlocks()Tests if this user can deleteBlocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBlockwill 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:
falseifBlockdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteBlock
void deleteBlock(Id blockId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aBlock.- Parameters:
blockId- theIdof theBlockto remove- Throws:
NotFoundException-blockIdnot foundNullArgumentException-blockIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageBlockAliases
boolean canManageBlockAliases()Tests if this user can manageIdaliases forBlocks. 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:
falseifBlockaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasBlock
void aliasBlock(Id blockId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aBlockfor the purpose of creating compatibility. The primaryIdof theBlockis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another block, it is reassigned to the given blockId.- Parameters:
blockId- theIdof aBlockaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-blockIdnot foundNullArgumentException-blockIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-