public interface ValueAdminSession extends OsidSession
This session creates, updates, and deletes Values
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
Value,
a ValueForm
is requested using
getValueFormForCreate()
specifying the desired parameter and
record Types
or none if no record Types
are
needed. The returned ValueForm
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 ValueForm
is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
ValueForm
corresponds to an attempted transaction.
For updates, ValueForms
are requested to the
Value
Id
that is to be updated using
getValueFormForUpdate().
Similarly, the ValueForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The ValueForm
can
only be used once for a successful update and cannot be reused.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasValue(Id valueId,
Id aliasId)
Adds an
Id to a Value for the purpose of
creating compatibility. |
boolean |
canCreateValues()
Tests if this user can create
Values. |
boolean |
canCreateValueWithRecordTypes(Type[] valueRecordTypes)
Tests if this user can create a single
Value using the
desired record types. |
boolean |
canDeleteValues()
Tests if this user can delete
Values. |
boolean |
canManageValueAliases()
Tests if this user can manage
Id aliases for
Values. |
boolean |
canUpdateValues()
Tests if this user can update
Values. |
Value |
createValue(ValueForm valueForm)
Creates a value.
|
void |
deleteValue(Id valueId)
Deletes the specified value.
|
Configuration |
getConfiguration()
Gets the
Configuration associated with this session. |
Id |
getConfigurationId()
Gets the
Configuration Id associated
with this session. |
ValueForm |
getValueFormForCreate(Id parameterId,
Type[] valueRecordTypes)
Gets the form for creating new values.
|
ValueForm |
getValueFormForUpdate(Id valueId)
Gets the value form for updating an existing value.
|
boolean |
supportValueConditions()
Tests if applying conditions to values is supported.
|
void |
updateValue(ValueForm valueForm)
Updates an existing value.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getConfigurationId()
Configuration
Id
associated
with this session. Configuration
Id
associated
with this sessionmandatory
- This method must be implemented. Configuration getConfiguration() throws OperationFailedException, PermissionDeniedException
Configuration
associated with this session. Configuration
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean supportValueConditions()
true
if Value
conditions are
supported, false
otherwisemandatory
- This method must be implemented. boolean canCreateValues()
Values.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Value
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer create operations to an
unauthorized user. false
if Value
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateValueWithRecordTypes(Type[] valueRecordTypes)
Value
using the
desired record types. While
ConfigurationManager.getValueRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Value.
Providing
an empty array tests if a Value
can be created with no
records.valueRecordTypes
- array of value record types true
if Value
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- valueRecordTypes
is null
mandatory
- This method must be implemented. ValueForm getValueFormForCreate(Id parameterId, Type[] valueRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
parameterId
- the parametervalueRecordTypes
- array of value record typesNotFoundException
- parameterId
is not
foundNullArgumentException
- parameterId
or
valueRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Value createValue(ValueForm valueForm) throws OperationFailedException, PermissionDeniedException
valueForm
- the formIllegalStateException
- valueForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- valueForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- valueForm
did not
originate from getValueFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateValues()
Values.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Value
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer update operations to an
unauthorized user. false
if Value
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. ValueForm getValueFormForUpdate(Id valueId) throws NotFoundException, OperationFailedException, PermissionDeniedException
valueId
- the Id
of the Value
NotFoundException
- the value is not foundNullArgumentException
- parameterId
or
valueId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateValue(ValueForm valueForm) throws OperationFailedException, PermissionDeniedException
valueForm
- the form containing the elemnts to be updatedIllegalStateException
- valueForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- parameterId, valueId
or valueForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- valueForm
did not
originate from getValueFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteValues()
Values.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Value
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer delete operations to an
unauthorized user. false
if Value
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteValue(Id valueId) throws NotFoundException, OperationFailedException, PermissionDeniedException
valueId
- the Id
of the Value
to
deleteNotFoundException
- valueId
is not foundNullArgumentException
- valueId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageValueAliases()
Id
aliases for
Values.
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 Value
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasValue(Id valueId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Value
for the purpose of
creating compatibility. The primary Id
of the
Value
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another value it is reassigned to the given value
Id.
valueId
- the Id
of a Value
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- valueId
not foundNullArgumentException
- valueId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.