Interface BallotLookupSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods for retrieving ballots. A Ballot
is an arbitrary entity that may represent a person, place or thing used to
identify an object used in various services.
This lookup session defines several views:
- comparative view: elements may be silently omitted or re-ordered
- plenary view: provides a complete result set or is an error condition
- isolated polls view: All ballot methods in this session operate,
retrieve and pertain to ballots defined explicitly in the current
polls. Using an isolated view is useful for managing
Ballotswith theBallotAdminSession. - federated polls view: All ballot methods in this session operate, retrieve and pertain to all ballots defined in this polls and any other ballots implicitly available in this polls through polls inheritence.
- active ballot view: active ballots are returned from methods in this session
- any status ballot view: active and inactive ballots are returned from methods in this session
The methods useFederatedPollsView() and
useIsolatedPollsView() behave as a radio group and one should be selected
before invoking any lookup methods.
Ballots may have an additional records indicated by their respective
record types. The record may not be accessed through a cast of the
Ballot .
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can performBallotlookups.Gets theBallotspecified by itsId.Gets allBallots.getBallotsByCommissioner(Id resourceId) Gets aBallotListfrom the given commissioner..getBallotsByGenusType(Type ballotGenusType) Gets aBallotListcorresponding to the given ballot genusTypewhich does not include ballot of types derived from the specifiedType.getBallotsByIds(IdList ballotIds) Gets aBallotListcorresponding to the givenIdList.getBallotsByParentGenusType(Type ballotGenusType) Gets aBallotListcorresponding to the given ballot genusTypeand include any additional ballots with genus types derived from the specifiedType.getBallotsByRecordType(Type ballotRecordType) Gets aBallotListcontaining the given ballot recordType.getBallotsOnDate(DateTime from, DateTime to) Gets aBallotListthat are effective for the entire given date range but not confined to the date range.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.voidOnly active ballots are returned from methods in this session.voidBorth active and inactive ballots are returned from methods in this session.voidThe returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidFederates the view for methods in this session.voidIsolates the view for methods in this session.voidA complete view of theBallotreturns is desired.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.
-
Method Details
-
getPollsId
Id getPollsId()Gets thePollsIdassociated with this session.- Returns:
- the
Polls Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getPolls
Gets thePollsassociated with this session.- Returns:
- the
Pollsassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canLookupBallots
boolean canLookupBallots()Tests if this user can performBallotlookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.- Returns:
falseif lookup methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeBallotView
void useComparativeBallotView()The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.- Compliance:
mandatory- This method is must be implemented.
-
usePlenaryBallotView
void usePlenaryBallotView()A complete view of theBallotreturns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.- Compliance:
mandatory- This method is must be implemented.
-
useFederatedPollsView
void useFederatedPollsView()Federates the view for methods in this session. A federated view will include ballots in polls which are children of this polls in the polls hierarchy.- Compliance:
mandatory- This method is must be implemented.
-
useIsolatedPollsView
void useIsolatedPollsView()Isolates the view for methods in this session. An isolated view restricts lookups to this polls only.- Compliance:
mandatory- This method is must be implemented.
-
useActiveBallotView
void useActiveBallotView()Only active ballots are returned from methods in this session.- Compliance:
mandatory- This method is must be implemented.
-
useAnyStatusBallotView
void useAnyStatusBallotView()Borth active and inactive ballots are returned from methods in this session.- Compliance:
mandatory- This method is must be implemented.
-
getBallot
Ballot getBallot(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets theBallotspecified by itsId. In plenary mode, the exactIdis found or aNOT_FOUNDresults. Otherwise, the returnedBallotmay have a differentIdthan requested, such as the case where a duplicateIdwas assigned to aBallotand retained for compatibility. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
ballotId- theIdof theBallotto retrieve- Returns:
- the returned
Ballot - Throws:
NotFoundException- noBallotfound with the givenIdNullArgumentException-ballotIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsByIds
BallotList getBallotsByIds(IdList ballotIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets aBallotListcorresponding to the givenIdList. In plenary mode, the returned list contains all of the ballots specified in theIdlist, in the order of the list, including duplicates, or an error results if anIdin the supplied list is not found or inaccessible. Otherwise, inaccessibleBallotsmay be omitted from the list and may present the elements in any order including returning a unique set. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
ballotIds- the list ofIdsto retrieve- Returns:
- the returned
Ballotlist - Throws:
NotFoundException- anIdwas not foundNullArgumentException-ballotIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsByGenusType
BallotList getBallotsByGenusType(Type ballotGenusType) throws OperationFailedException, PermissionDeniedException Gets aBallotListcorresponding to the given ballot genusTypewhich does not include ballot of types derived from the specifiedType. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
ballotGenusType- a ballot genus type- Returns:
- the returned
Ballotlist - Throws:
NullArgumentException-ballotGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsByParentGenusType
BallotList getBallotsByParentGenusType(Type ballotGenusType) throws OperationFailedException, PermissionDeniedException Gets aBallotListcorresponding to the given ballot genusTypeand include any additional ballots with genus types derived from the specifiedType. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
ballotGenusType- a ballot genus type- Returns:
- the returned
Ballotlist - Throws:
NullArgumentException-ballotGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsByRecordType
BallotList getBallotsByRecordType(Type ballotRecordType) throws OperationFailedException, PermissionDeniedException Gets aBallotListcontaining the given ballot recordType. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
ballotRecordType- a ballot record type- Returns:
- the returned
Ballotlist - Throws:
NullArgumentException-ballotRecordTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsByCommissioner
BallotList getBallotsByCommissioner(Id resourceId) throws OperationFailedException, PermissionDeniedException Gets aBallotListfrom the given commissioner.. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
resourceId- a resourceId- Returns:
- the returned
Ballotlist - Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotsOnDate
BallotList getBallotsOnDate(DateTime from, DateTime to) throws OperationFailedException, PermissionDeniedException Gets aBallotListthat are effective for the entire given date range but not confined to the date range. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Parameters:
from- s atsrting dateto- an ending date- Returns:
- the returned
Ballotlist - Throws:
InvalidArgumentException-fromis greater thantoNullArgumentException-fromortoisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallots
Gets allBallots. In plenary mode, the returned list contains all known ballots or an error results. Otherwise, the returned list may contain only those ballots that are accessible through this session. In active mode, ballots are returned that are currently active. In any status mode, active and inactive ballots are returned.- Returns:
- a list of
Ballots - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-