Interface RaceAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
RaceBatchAdminSession

public interface RaceAdminSession extends OsidSession

This session creates, updates, and deletes Races . 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 getRaceFormForCreate() specifying the Ballot and desired record Types or none if no record Types are needed. The returned RaceForm 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 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.

For updates, RaceForms are requested to the Race Id that is to be updated using getRaceFormForUpdate() . 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.

The delete operations delete Races . 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.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getPollsId

      Id getPollsId()
      Gets the Polls Id associated with this session.
      Returns:
      the Polls Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getPolls

      Gets the Polls associated with this session.
      Returns:
      the Polls associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateRaces

      boolean canCreateRaces()
      Tests if this user can create Races A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Race will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if Race creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateRaceWithRecordTypes

      boolean canCreateRaceWithRecordTypes(Type[] raceRecordTypes)
      Tests if this user can create a single Race using the desired record types. While VotingManager.getRaceRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Race . Providing an empty array tests if a Race can be created with no records.
      Parameters:
      raceRecordTypes - array of race record types
      Returns:
      true if Race creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - raceRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getRaceFormForCreate

      RaceForm getRaceFormForCreate(Id ballotId, Type[] raceRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the race form for creating new races. A new form should be requested for each create transaction.
      Parameters:
      ballotId - a ballot Id
      raceRecordTypes - array of race record types
      Returns:
      the race form
      Throws:
      NotFoundException - raceId is not found
      NullArgumentException - raceId or raceRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form with requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createRace

      Creates a new Race .
      Parameters:
      raceForm - the form for this Race
      Returns:
      the new Race
      Throws:
      IllegalStateException - raceForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - raceForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - raceForm did not originate from getRaceFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateRaces

      boolean canUpdateRaces()
      Tests if this user can update Races . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Race will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if Race modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getRaceFormForUpdate

      Gets the race form for updating an existing race. A new race form should be requested for each update transaction.
      Parameters:
      raceId - the Id of the Race
      Returns:
      the race form
      Throws:
      NotFoundException - raceId is not found
      NullArgumentException - raceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateRace

      void updateRace(RaceForm raceForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing race.
      Parameters:
      raceForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - raceForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - raceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - raceForm did not originate from getRaceFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteRaces

      boolean canDeleteRaces()
      Tests if this user can delete Races . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Race will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if Race deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteRace

      Deletes a Race .
      Parameters:
      raceId - the Id of the Race to remove
      Throws:
      NotFoundException - raceId is not found
      NullArgumentException - raceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageRaceAliases

      boolean canManageRaceAliases()
      Tests if this user can manage Id aliases for Races . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if Race aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasRace

      Adds an Id to a Race for the purpose of creating compatibility. The primary Id of the Race is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another race, it is reassigned to the given race Id .
      Parameters:
      raceId - the Id of a Race
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - raceId not found
      NullArgumentException - raceId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.