Interface ValueAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ValueBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasValue(Id valueId, Id aliasId) Adds anIdto aValuefor the purpose of creating compatibility.booleanTests if this user can createValues.booleancanCreateValueWithRecordTypes(Type[] valueRecordTypes) Tests if this user can create a singleValueusing the desired record types.booleanTests if this user can deleteValues.booleanTests if this user can manageIdaliases forValues.booleanTests if this user can updateValues.createValue(ValueForm valueForm) Creates a value.voiddeleteValue(Id valueId) Deletes the specified value.Gets theConfigurationassociated with this session.Gets theConfigurationIdassociated with this session.getValueFormForCreate(Id parameterId, Type[] valueRecordTypes) Gets the form for creating new values.getValueFormForUpdate(Id valueId) Gets the value form for updating an existing value.booleanTests if applying conditions to values is supported.voidupdateValue(ValueForm valueForm) Updates an existing value.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
-
getConfigurationId
Id getConfigurationId()Gets theConfigurationIdassociated with this session.- Returns:
- the
ConfigurationIdassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getConfiguration
Gets theConfigurationassociated with this session.- Returns:
- the
Configurationassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
supportValueConditions
boolean supportValueConditions()Tests if applying conditions to values is supported.- Returns:
trueifValueconditions are supported,falseotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateValues
boolean canCreateValues()Tests if this user can createValues. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aValuewill 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:
falseifValuecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateValueWithRecordTypes
Tests if this user can create a singleValueusing the desired record types. WhileConfigurationManager.getValueRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificValue. Providing an empty array tests if aValuecan be created with no records.- Parameters:
valueRecordTypes- array of value record types- Returns:
trueifValuecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-valueRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getValueFormForCreate
ValueForm getValueFormForCreate(Id parameterId, Type[] valueRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the form for creating new values. A new form should be requested for each create transaction.- Parameters:
parameterId- the parametervalueRecordTypes- array of value record types- Returns:
- the value form
- Throws:
NotFoundException-parameterIdis not foundNullArgumentException-parameterIdorvalueRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createValue
Creates a value.- Parameters:
valueForm- the form- Returns:
- the value
- Throws:
IllegalStateException-valueFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-valueFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-valueFormdid not originate fromgetValueFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateValues
boolean canUpdateValues()Tests if this user can updateValues. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aValuewill 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:
falseifValuemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getValueFormForUpdate
ValueForm getValueFormForUpdate(Id valueId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the value form for updating an existing value. A new value form should be requested for each update transaction.- Parameters:
valueId- theIdof theValue- Returns:
- the value form
- Throws:
NotFoundException- the value is not foundNullArgumentException-parameterIdorvalueIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateValue
Updates an existing value.- Parameters:
valueForm- the form containing the elemnts to be updated- Throws:
IllegalStateException-valueFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-parameterId, valueIdorvalueFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-valueFormdid not originate fromgetValueFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteValues
boolean canDeleteValues()Tests if this user can deleteValues. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aValuewill 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:
falseifValuedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteValue
void deleteValue(Id valueId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes the specified value.- Parameters:
valueId- theIdof theValueto delete- Throws:
NotFoundException-valueIdis not foundNullArgumentException-valueIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageValueAliases
boolean canManageValueAliases()Tests if this user can manageIdaliases forValues. 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:
falseifValuealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasValue
void aliasValue(Id valueId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aValuefor the purpose of creating compatibility. The primaryIdof theValueis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another value it is reassigned to the given valueId.- Parameters:
valueId- theIdof aValuealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-valueIdnot foundNullArgumentException-valueIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-