public interface BinAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasBin(Id binId,
Id aliasId)
Adds an
Id to a Bin for the purpose of
creating compatibility. |
boolean |
canCreateBins()
Tests if this user can create
Bins. |
boolean |
canCreateBinWithRecordTypes(Type[] binRecordTypes)
Tests if this user can create a single
Bin using the
desired record types. |
boolean |
canDeleteBins()
Tests if this user can delete
Bins. |
boolean |
canManageBinAliases()
Tests if this user can manage
Id aliases for
Bins. |
boolean |
canUpdateBins()
Tests if this user can update
Bins. |
Bin |
createBin(BinForm binForm)
Creates a new
Bin. |
void |
deleteBin(Id binId)
Deletes a
Bin. |
BinForm |
getBinFormForCreate(Type[] binRecordTypes)
Gets the bin form for creating new bins.
|
BinForm |
getBinFormForUpdate(Id binId)
Gets the bin form for updating an existing bin.
|
void |
updateBin(BinForm binForm)
Updates an existing bin.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateBins()
Bins.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Bin
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer create operations to
unauthorized users. false
if Bin
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateBinWithRecordTypes(Type[] binRecordTypes)
Bin
using the
desired record types. While ResourceManager.getBinRecordTypes()
can be used to examine which records are supported, this
method tests which record(s) are required for creating a specific
Bin.
Providing an empty array tests if a Bin
can be created with no records.binRecordTypes
- array of bin record types true
if Bin
creation using the
specified Types
is supported, false
otherwiseNullArgumentException
- binRecordTypes
is null
mandatory
- This method must be implemented. BinForm getBinFormForCreate(Type[] binRecordTypes) throws OperationFailedException, PermissionDeniedException
binRecordTypes
- array of bin record typesNullArgumentException
- binRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form with
requested record typesmandatory
- This method must be implemented. Bin createBin(BinForm binForm) throws OperationFailedException, PermissionDeniedException
Bin.
binForm
- the form for this Bin
Bin
IllegalStateException
- binForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- binForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- binForm
did not
originate from getBinFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateBins()
Bins.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Bin
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer update operations to
unauthorized users. false
if Bin
modification is not
authorized, true
otherwisemandatory
- This method must be implemented. BinForm getBinFormForUpdate(Id binId) throws NotFoundException, OperationFailedException, PermissionDeniedException
binId
- the Id
of the Bin
NotFoundException
- binId
is not foundNullArgumentException
- binId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateBin(BinForm binForm) throws OperationFailedException, PermissionDeniedException
binForm
- the form containing the elements to be updatedIllegalStateException
- binForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- binId
or
binForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- binForm
did not
originate from getBinFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteBins()
Bins.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Bin
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer delete operations to
unauthorized users. false
if Bin
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteBin(Id binId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Bin.
binId
- the Id
of the Bin
to
removeNotFoundException
- binId
not foundNullArgumentException
- binId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageBinAliases()
Id
aliases for
Bins.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Bin
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasBin(Id binId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Bin
for the purpose of
creating compatibility. The primary Id
of the
Bin
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another bin, it is reassigned to the given bin Id.
binId
- the Id
of a Bin
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- binId
not foundNullArgumentException
- binId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.