Interface VoteEnablerAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface VoteEnablerAdminSession extends OsidSession

This session creates, updates, and deletes VoteEnablers . 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 VoteEnabler , a VoteEnablerForm is requested using getVoteEnablerFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned VoteEnablerForm 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 VoteEnablerForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each VoteEnablerForm corresponds to an attempted transaction.

For updates, VoteEnablerForms are requested to the VoteEnabler Id that is to be updated using getVoteEnablerFormForUpdate() . Similarly, the VoteEnablerForm has metadata about the data that can be updated and it can perform validation before submitting the update. The VoteEnablerForm can only be used once for a successful update and cannot be reused.

The delete operations delete VoteEnablers . To unmap a VoteEnabler from the current Polls , the VoteEnablerPollsAssignmentSession should be used. These delete operations attempt to remove the VoteEnabler 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
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateVoteEnablers

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

      boolean canCreateVoteEnablerWithRecordTypes(Type[] voteEnablerRecordTypes)
      Tests if this user can create a single VoteEnabler using the desired record types. While VotingRulesManager.getVoteEnablerRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific VoteEnabler . Providing an empty array tests if a VoteEnabler can be cre ated with no records.
      Parameters:
      voteEnablerRecordTypes - array of vote enabler record types
      Returns:
      true if VoteEnabler creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - voteEnablerRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getVoteEnablerFormForCreate

      VoteEnablerForm getVoteEnablerFormForCreate(Type[] voteEnablerRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the vote enabler form for creating new vote enablers. A new form should be requested for each create transaction.
      Parameters:
      voteEnablerRecordTypes - array of vote enabler record types
      Returns:
      the vote enabler form
      Throws:
      NullArgumentException - voteEnablerRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createVoteEnabler

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

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

      VoteEnablerForm getVoteEnablerFormForUpdate(Id voteEnablerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the vote enabler form for updating an existing vote enabler. A new vote enabler form should be requested for each update transaction.
      Parameters:
      voteEnablerId - the Id of the VoteEnabler
      Returns:
      the vote enabler form
      Throws:
      NotFoundException - voteEnablerId is not found
      NullArgumentException - voteEnablerId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateVoteEnabler

      void updateVoteEnabler(VoteEnablerForm voteEnablerForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing vote enabler.
      Parameters:
      voteEnablerForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - voteEnablerForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - voteEnablerForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - voteEnablerForm did not originate from getVoteEnablerFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteVoteEnablers

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

      void deleteVoteEnabler(Id voteEnablerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a VoteEnabler .
      Parameters:
      voteEnablerId - the Id of the VoteEnabler to remove
      Throws:
      NotFoundException - voteEnablerId not found
      NullArgumentException - voteEnablerId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageVoteEnablerAliases

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

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