Java VotingServer Interface
package polaris.irv.service;
import java.util.List;
public interface VotingServer {
/**
* Returns a list of ElectionDTO objects
*
* Called by the client to retrieve information about available elections
* which can be viewed or voted in.
*
* @param email the email of the user
* @param password the password of the user
*/
public List getElections(String email, String password)
throws
DataTierException,
InvalidUserException;
/**
* Returns a list of CandidateDTO objects
*
* @param email the email of the user
* @param password the password of the user
* @param electionId the election to return the candidates for
*/
public List getCandidates(String email, String password, int electionId)
throws
DataTierException,
InvalidUserException,
InvalidElectionException,
IllegalElectionException;
/**
* Casts the users vote for an election.
*
* @param email the email of the user
* @param password the password of the user
* @param electionId the election to cast a vote for
* @param candidateOrder the order of the user's candidate preferences, with best first
*/
public void castVote(String email, String password, int electionId, List candidateOrder)
throws
DataTierException,
InvalidUserException,
InvalidElectionException,
IllegalElectionException,
NoSuchCandidateException,
RepeatedCandidateException,
EmptyCandidateListException,
InvalidListFormatException,
ElectionNotOpenException,
ElectionClosedException,
ApplicationTierException;
/**
* Returns list of CandidateDTO objects, with the ranking field set
*
* @param email the email of the user
* @param password the password of the user
* @param electionId the election to return the results for
*/
public List getResults(String email, String password, int electionId)
throws
DataTierException,
InvalidUserException,
InvalidElectionException,
IllegalElectionException,
ElectionNotTalliedException;
}