Interface PollsBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, PollsAdminSession
This session creates, updates, and deletes Polls 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 an
Polls , an PollsForm is requested using
getPollsFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
PollsForms 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 an PollsForm is submiited to a create operation, it cannot be
reused with another create operation unless the first operation was
unsuccessful. Each PollsForm corresponds to an attempted
transaction.
The PollsForms returned from getPollsFormsForCreate()
may be linked to the originating request through the peer Ids of
the PollsForm . In the case where there may be duplicates, any
PollsForm of the same peer Ids may be used for a create
operation.
Once a batch of PollsForms are submitted for create, a
CreateResponse is returned for each PollsForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createPolls() , errors specific to an
individual PollsForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
PollsForm through the PollsForm Id .
For updates, PollsForms are requested to the Polls
Id that is to be updated using getPollsFormsForUpdate()
where the reference Id in the PollsForm may be used to
link the request. Similarly, the PollsForm has metadata about the
data that can be updated and it can perform validation before submitting
the update. The PollsForm can only be used once for a successful
update and cannot be reused.
Once a batch of PollsForms are submitted for update, an
UpdateResponse is returned for each PollsForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updatePolls() , errors specific to an
individual PollsForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
PollsForm through the PollsForm Id .
The delete operations delete Polls in bulk. Bulk delete
operations return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasPolls(AliasRequestList aliasRequests) Adds anIdto anPollsfor the purpose of creating compatibility.createPolls(PollsBatchFormList pollsForms) Creates a new set ofPolls.Deletes allPolls.deletePolls(IdList pollsIds) Deletes polls for the givenIds.getPollsFormsForCreate(long number, Type[] pollsRecordTypes) Gets the polls forms for creating a bunch of new polls.getPollsFormsForUpdate(IdList pollsIds) Gets the polls forms for updating an existing set of polls.updatePolls(PollsBatchFormList pollsForms) Updates existing polls.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 PollsAdminSession
aliasPolls, canCreatePolls, canCreatePollsWithRecordTypes, canDeletePolls, canManagePollsAliases, canUpdatePolls, createPolls, deletePolls, getPollsFormForCreate, getPollsFormForUpdate, updatePollsModifier and TypeMethodDescriptionvoidaliasPolls(Id pollsId, Id aliasId) Adds anIdto aPollsfor the purpose of creating compatibility.booleanTests if this user can createPolls.booleancanCreatePollsWithRecordTypes(Type[] pollsRecordTypes) Tests if this user can create a singlePollsusing the desired record types.booleanTests if this user can deletePolls.booleanTests if this user can manageIdaliases forPolls.booleanTests if this user can updatePolls.createPolls(PollsForm pollsForm) Creates a newPolls.voiddeletePolls(Id pollsId) Deletes aPolls.getPollsFormForCreate(Type[] pollsRecordTypes) Gets the polls form for creating new polls.getPollsFormForUpdate(Id pollsId) Gets the polls form for updating an existing polls.voidupdatePolls(PollsForm pollsForm) Updates an existing polls.
-
Method Details
-
getPollsFormsForCreate
PollsBatchFormList getPollsFormsForCreate(long number, Type[] pollsRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the polls forms for creating a bunch of new polls.- Parameters:
number- the number of forms to retrievepollsRecordTypes- array of polls record types to be included in each create operation or an empty list if none- Returns:
- the polls forms
- Throws:
NullArgumentException-pollsRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createPolls
CreateResponseList createPolls(PollsBatchFormList pollsForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofPolls. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
pollsForms- the polls forms- Returns:
- the create responses
- Throws:
NullArgumentException-pollsFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getPollsFormsForUpdate
PollsBatchFormList getPollsFormsForUpdate(IdList pollsIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the polls forms for updating an existing set of polls. A new polls form should be requested for each update transaction.- Parameters:
pollsIds- theIdsof thePolls- Returns:
- the polls form
- Throws:
NotFoundException- anpollsIdis not foundNullArgumentException-pollsIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePolls
UpdateResponseList updatePolls(PollsBatchFormList pollsForms) throws OperationFailedException, PermissionDeniedException Updates existing polls. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
pollsForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-pollsFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllPolls
Deletes allPolls.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deletePolls
DeleteResponseList deletePolls(IdList pollsIds) throws OperationFailedException, PermissionDeniedException Deletes polls for the givenIds.- Parameters:
pollsIds- theIdsof the polls to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-pollsIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasPolls
AliasResponseList aliasPolls(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anPollsfor the purpose of creating compatibility. The primaryIdof thePollsis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another polls, it is reassigned to the given pollsId.- 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.
-