Interface BinAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
BinBatchAdminSession
This session creates, updates, and deletes Bins . 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
Bin , a BinForm is requested using getBinFormForCreate()
specifying the desired record Types or none if no record
Types are needed. The returned BinForm 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 BinForm is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each BinForm
corresponds to an attempted transaction.
For updates, BinForms are requested to the Bin
Id that is to be updated using getBinFormForUpdate() . Similarly,
the BinForm has metadata about the data that can be updated and it
can perform validation before submitting the update. The BinForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Bins .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aBinfor the purpose of creating compatibility.booleanTests if this user can createBins.booleancanCreateBinWithRecordTypes(Type[] binRecordTypes) Tests if this user can create a singleBinusing the desired record types.booleanTests if this user can deleteBins.booleanTests if this user can manageIdaliases forBins.booleanTests if this user can updateBins.Creates a newBin.voidDeletes aBin.getBinFormForCreate(Type[] binRecordTypes) Gets the bin form for creating new bins.getBinFormForUpdate(Id binId) Gets the bin form for updating an existing bin.voidUpdates an existing bin.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
-
canCreateBins
boolean canCreateBins()Tests if this user can createBins. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aBinwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifBincreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateBinWithRecordTypes
Tests if this user can create a singleBinusing the desired record types. WhileResourceManager.getBinRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificBin. Providing an empty array tests if aBincan be created with no records.- Parameters:
binRecordTypes- array of bin record types- Returns:
trueifBincreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-binRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getBinFormForCreate
BinForm getBinFormForCreate(Type[] binRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the bin form for creating new bins.- Parameters:
binRecordTypes- array of bin record types- Returns:
- the bin form
- Throws:
NullArgumentException-binRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createBin
Creates a newBin.- Parameters:
binForm- the form for thisBin- Returns:
- the new
Bin - Throws:
IllegalStateException-binFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-binFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-binFormdid not originate fromgetBinFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateBins
boolean canUpdateBins()Tests if this user can updateBins. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBinwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifBinmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getBinFormForUpdate
BinForm getBinFormForUpdate(Id binId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the bin form for updating an existing bin. A new bin form should be requested for each update transaction.- Parameters:
binId- theIdof theBin- Returns:
- the bin form
- Throws:
NotFoundException-binIdis not foundNullArgumentException-binIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBin
Updates an existing bin.- Parameters:
binForm- the form containing the elements to be updated- Throws:
IllegalStateException-binFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-binIdorbinFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-binFormdid not originate fromgetBinFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteBins
boolean canDeleteBins()Tests if this user can deleteBins. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBinwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifBindeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteBin
void deleteBin(Id binId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aBin.- Parameters:
binId- theIdof theBinto remove- Throws:
NotFoundException-binIdnot foundNullArgumentException-binIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageBinAliases
boolean canManageBinAliases()Tests if this user can manageIdaliases forBins. 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:
falseifBinaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasBin
void aliasBin(Id binId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aBinfor the purpose of creating compatibility. The primaryIdof theBinis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another bin, it is reassigned to the given binId.- Parameters:
binId- theIdof aBinaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-binIdnot foundNullArgumentException-binIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-