Interface ResponseBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, ResponseAdminSession
This session creates, updates, and deletes Responses in bulk.
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
getResponseFormsForCreate() specifying the desired inquiry, resource, and
record Types or none if no record Types are needed. Each
of the returned ResponseForms 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 a 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.
The ResponseForms returned from
getResponseFormsForCreate() may be linked to the originating request
through the peer Ids of the ResponseForm . In the case
where there may be duplicates, any ResponseForm of the same peer
Ids may be used for a create operation.
Once a batch of ResponseForm are submitted for create, a
CreateResponse is returned for each ResponseForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createResponses() ,
errors specific to an individual ResponseForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating ResponseForm through the
ResponseForm Id .
For updates, ResponseForms are requested to the
Response Id that is to be updated using
getResponseFormsForUpdate() where the reference Id in the
ResponseForm may be used to link the request. 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.
Once a batch of ResponseForms are submitted for update, an
UpdateResponse is returned for each ResponseForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateResponses() ,
errors specific to an individual ResponseForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating ResponseForm through the
ResponseForm Id .
The delete operations delete Responses in bulk. To unmap a
Response from the current Inquiry , the
ResponseInquiryAssignmentSession should be used. These delete operations
attempt to remove the Response itself thus removing it from all
known Inquiry catalogs. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasResponses(AliasRequestList aliasRequests) Adds anIdto aResponsefor the purpose of creating compatibility.createResponses(ResponseBatchFormList responseForms) Creates a new set ofResponses.Deletes allResponsesin thisInquiry.Deletes responses expired before the given date.deleteResponses(IdList responseIds) Deletes responses for the givenIds.deleteResponsesForInquiry(Id inquiryId) Deletes responses for the givenInquiry.deleteResponsesForResource(Id resourceId) Deletes responses for the givenResource.getResponseFormsForCreate(ResponsePeerList peers, Type[] responseRecordTypes) Gets the response forms for creating a bunch of new responses.getResponseFormsForUpdate(IdList responseIds) Gets the response forms for updating an existing set of responses.updateResponses(ResponseBatchFormList responseForms) Updates existing responses.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.Methods inherited from interface ResponseAdminSession
aliasResponse, canCreateResponses, canCreateResponseWithRecordTypes, canDeleteResponses, canManageResponseAliases, canUpdateResponses, createResponse, deleteResponse, getInquest, getInquestId, getResponseFormForCreate, getResponseFormForUpdate, updateResponseModifier 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.
-
Method Details
-
getResponseFormsForCreate
ResponseBatchFormList getResponseFormsForCreate(ResponsePeerList peers, Type[] responseRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the response forms for creating a bunch of new responses. A form is retrieved for each inquiry and resource pair.- Parameters:
peers- list of inquiry resource peersresponseRecordTypes- array of response record types to be included in each create operation or an empty list if none- Returns:
- the response forms
- Throws:
NotFoundException- aninquiryIdorresourceIdis not foundNullArgumentException-peersorresponseRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createResponses
CreateResponseList createResponses(ResponseBatchFormList responseForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofResponses. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
responseForms- the response forms- Returns:
- the create responses
- Throws:
NullArgumentException-responseFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getResponseFormsForUpdate
ResponseBatchFormList getResponseFormsForUpdate(IdList responseIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the response forms for updating an existing set of responses. A new response form should be requested for each update transaction.- Parameters:
responseIds- theIdsof theResponse- Returns:
- the response form
- Throws:
NotFoundException- aresponseIdis not foundNullArgumentException-responseIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateResponses
UpdateResponseList updateResponses(ResponseBatchFormList responseForms) throws OperationFailedException, PermissionDeniedException Updates existing responses. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
responseForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-responseFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllResponses
Deletes allResponsesin thisInquiry.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteResponses
DeleteResponseList deleteResponses(IdList responseIds) throws OperationFailedException, PermissionDeniedException Deletes responses for the givenIds.- Parameters:
responseIds- theIdsof the responses to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-responseIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteResponsesForInquiry
DeleteResponseList deleteResponsesForInquiry(Id inquiryId) throws OperationFailedException, PermissionDeniedException Deletes responses for the givenInquiry.- Parameters:
inquiryId- an inquiryId- Returns:
- the delete responses
- Throws:
NullArgumentException-inquiryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteResponsesForResource
DeleteResponseList deleteResponsesForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes responses for the givenResource.- Parameters:
resourceId- a resourceId- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveResponsesByDate
DeleteResponseList deleteIneffectiveResponsesByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes responses expired before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasResponses
AliasResponseList aliasResponses(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aResponsefor the purpose of creating compatibility. The primaryIdof theResponseis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another response, it is reassigned to the given responseId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-