Interface PollsAdminSession

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

public interface PollsAdminSession extends OsidSession

This session creates, updates, and deletes Polls . 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 Polls , a PollsForm is requested using getPollsFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned PollsForm 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 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.

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

The delete operations delete Polls .

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

  • Method Details

    • canCreatePolls

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

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

      PollsForm getPollsFormForCreate(Type[] pollsRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the polls form for creating new polls.
      Parameters:
      pollsRecordTypes - array of polls record types
      Returns:
      the polls form
      Throws:
      NullArgumentException - pollsRecordTypes 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.
    • createPolls

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

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

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

      void updatePolls(PollsForm pollsForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing polls.
      Parameters:
      pollsForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - pollsForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - pollsId or pollsForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - pollsForm did not originate from getPollsFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeletePolls

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

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

      boolean canManagePollsAliases()
      Tests if this user can manage Id aliases for Polls . 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 Polls aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasPolls

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