Interface RaceBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, RaceAdminSession
This session creates, updates, and deletes Races 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
Race , a RaceForm is requested using
getRaceFormsForCreate() specifying the ballot and desired record
Types or none if no record Types are needed. Each of the returned
RaceForms 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 RaceForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each RaceForm corresponds to an attempted
transaction.
The RaceForms returned from getRaceFormsForCreate()
may be linked to the originating request through the peer Ids of
the RaceForm . In the case where there may be duplicates, any
RaceForm of the same peer Ids may be used for a create
operation.
Once a batch of RaceForms are submitted for create, a
CreateResponse is returned for each RaceForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createRaces() , errors specific to an
individual RaceForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
RaceForm through the RaceForm Id .
For updates, RaceForms are requested to the Race
Id that is to be updated using getRaceFormsForUpdate()
where the reference Id in the RaceForm may be used to link
the request. Similarly, the RaceForm has metadata about the data
that can be updated and it can perform validation before submitting the
update. The RaceForm can only be used once for a successful update
and cannot be reused.
Once a batch of RaceForms are submitted for update, an
UpdateResponse is returned for each RaceForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateRaces() , errors specific to an
individual RaceForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
RaceForm through the RaceForm Id .
The delete operations delete Races in bulk. To unmap a
Race from the current Polls , the
RacePollsAssignmentSession should be used. These delete operations
attempt to remove the Race itself thus removing it from all known
Polls catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasRaces(AliasRequestList aliasRequests) Adds anIdto aRacefor the purpose of creating compatibility.createRaces(RaceBatchFormList raceForms) Creates a new set ofRaces.Deletes allRacesin thisPolls.deleteRaces(IdList raceIds) Deletes races for the givenIds.deleteRacesForBallot(Id ballotId) Deletes all races for the given ballot.getRaceFormsForCreate(IdList ballotIds, Type[] raceRecordTypes) Gets the race forms for creating a bunch of new races.getRaceFormsForUpdate(IdList raceIds) Gets the race forms for updating an existing set of races.updateRaces(RaceBatchFormList raceForms) Updates existing races.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 RaceAdminSession
aliasRace, canCreateRaces, canCreateRaceWithRecordTypes, canDeleteRaces, canManageRaceAliases, canUpdateRaces, createRace, deleteRace, getPolls, getPollsId, getRaceFormForCreate, getRaceFormForUpdate, updateRaceModifier and TypeMethodDescriptionvoidAdds anIdto aRacefor the purpose of creating compatibility.booleanTests if this user can createRacesA return of true does not guarantee successful authorization.booleancanCreateRaceWithRecordTypes(Type[] raceRecordTypes) Tests if this user can create a singleRaceusing the desired record types.booleanTests if this user can deleteRaces.booleanTests if this user can manageIdaliases forRaces.booleanTests if this user can updateRaces.createRace(RaceForm raceForm) Creates a newRace.voiddeleteRace(Id raceId) Deletes aRace.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.getRaceFormForCreate(Id ballotId, Type[] raceRecordTypes) Gets the race form for creating new races.getRaceFormForUpdate(Id raceId) Gets the race form for updating an existing race.voidupdateRace(RaceForm raceForm) Updates an existing race.
-
Method Details
-
getRaceFormsForCreate
RaceBatchFormList getRaceFormsForCreate(IdList ballotIds, Type[] raceRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the race forms for creating a bunch of new races. A RaceForm is returned for each ballotId.- Parameters:
ballotIds- anIdof a ballotraceRecordTypes- array of race record types to be included in each create operation or an empty list if none- Returns:
- the race forms
- Throws:
NotFoundException- aballotIdis not foundNullArgumentException-ballotIdorraceRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createRaces
CreateResponseList createRaces(RaceBatchFormList raceForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofRaces. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
raceForms- the race forms- Returns:
- the create responses
- Throws:
NullArgumentException-raceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getRaceFormsForUpdate
RaceBatchFormList getRaceFormsForUpdate(IdList raceIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the race forms for updating an existing set of races. A new race form should be requested for each update transaction.- Parameters:
raceIds- theIdsof theRace- Returns:
- the race form
- Throws:
NotFoundException- araceIdis not foundNullArgumentException-raceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRaces
UpdateResponseList updateRaces(RaceBatchFormList raceForms) throws OperationFailedException, PermissionDeniedException Updates existing races. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
raceForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-raceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllRaces
Deletes allRacesin thisPolls.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteRaces
DeleteResponseList deleteRaces(IdList raceIds) throws OperationFailedException, PermissionDeniedException Deletes races for the givenIds.- Parameters:
raceIds- theIdsof the races to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-raceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteRacesForBallot
DeleteResponseList deleteRacesForBallot(Id ballotId) throws OperationFailedException, PermissionDeniedException Deletes all races for the given ballot.- Parameters:
ballotId- anIdof a ballot- Returns:
- the delete responses
- Throws:
NullArgumentException-ballotIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasRaces
AliasResponseList aliasRaces(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aRacefor the purpose of creating compatibility. The primaryIdof theRaceis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another race, it is reassigned to the given raceId.- 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.
-