Interface ResponseAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ResponseBatchAdminSession
This session creates, updates, and deletes Responses . 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
Response , a ResponseForm is requested using
getResponseFormForCreate() specifying the desired inquiry, resource, and
record Types or none if no record Types are needed. The
returned ResponseForm 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 ResponseForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each ResponseForm corresponds to
an attempted transaction.
For updates, ResponseForms are requested to the
Response Id that is to be updated using
getResponseFormForUpdate() . Similarly, the ResponseForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The ResponseForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Responses . To unmap a
Response from the current Inquest , the
ResponseInquestAssignmentSession should be used. These delete operations
attempt to remove the Response itself thus removing it from all
known Inquest catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasResponse(Id responseId, Id aliasId) Adds anIdto aResponsefor the purpose of creating compatibility.booleanTests if this user can create responses.booleancanCreateResponseWithRecordTypes(Type[] responseRecordTypes) Tests if this user can create a singleResponseusing the desired record types.booleanTests if this user can delete responses.booleanTests if this user can manageIdaliases forResponses.booleanTests if this user can update responses.createResponse(ResponseForm responseForm) Creates a newResponse.voiddeleteResponse(Id responseId) Deletes aResponse.Gets theInquestassociated with this session.Gets theInquestIdassociated with this session.getResponseFormForCreate(Id inquiryId, Id resourceId, Type[] responseRecordTypes) Gets the response form for creating new responses.getResponseFormForUpdate(Id responseId) Gets the response form for updating an existing response.voidupdateResponse(ResponseForm responseForm) Updates an existing response.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
-
getInquestId
Id getInquestId()Gets theInquestIdassociated with this session.- Returns:
- the
Inquest Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getInquest
Gets theInquestassociated with this session.- Returns:
- the inquest
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateResponses
boolean canCreateResponses()Tests if this user can create responses. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aResponsewill 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:
falseifResponsecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateResponseWithRecordTypes
Tests if this user can create a singleResponseusing the desired record types. WhileControlManager.getResponseRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificResponse. Providing an empty array tests if aResponsecan be created with no records.- Parameters:
responseRecordTypes- array of response record types- Returns:
trueifResponsecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-responseRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getResponseFormForCreate
ResponseForm getResponseFormForCreate(Id inquiryId, Id resourceId, Type[] responseRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the response form for creating new responses. A new form should be requested for each create transaction.- Parameters:
inquiryId- theIdfor the inquiryresourceId- theIdfor the responding resourceresponseRecordTypes- array of response record types- Returns:
- the response form
- Throws:
NotFoundException-inquiryIdorresourceIdis not foundNullArgumentException-inquiryId,resourceId, or responseRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createResponse
Response createResponse(ResponseForm responseForm) throws OperationFailedException, PermissionDeniedException Creates a newResponse.- Parameters:
responseForm- the form for thisResponse- Returns:
- the new
Response - Throws:
IllegalStateException-responseFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-responseFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-responseFormdid not originate fromgetResponseFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateResponses
boolean canUpdateResponses()Tests if this user can update responses. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aResponsewill 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:
falseifResponsemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getResponseFormForUpdate
ResponseForm getResponseFormForUpdate(Id responseId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the response form for updating an existing response. A new response form should be requested for each update transaction.- Parameters:
responseId- theIdof theResponse- Returns:
- the response form
- Throws:
NotFoundException-responseIdis not foundNullArgumentException-responseIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateResponse
void updateResponse(ResponseForm responseForm) throws OperationFailedException, PermissionDeniedException Updates an existing response.- Parameters:
responseForm- the form containing the elements to be updated- Throws:
IllegalStateException-responseFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-responseFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-responseFormdid not originate fromgetResponseFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteResponses
boolean canDeleteResponses()Tests if this user can delete responses. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aResponsewill 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:
falseifResponsedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteResponse
void deleteResponse(Id responseId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aResponse.- Parameters:
responseId- theIdof theResponseto remove- Throws:
NotFoundException-responseIdnot foundNullArgumentException-responseIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageResponseAliases
boolean canManageResponseAliases()Tests if this user can manageIdaliases forResponses. 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:
falseifResponsealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasResponse
void aliasResponse(Id responseId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aResponsefor the purpose of creating compatibility. The primaryIdof theResponseis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another response, it is reassigned to the given responseId.- Parameters:
responseId- theIdof aResponsealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-responseIdnot foundNullArgumentException-responseIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-