@ThreadSafe public abstract class VoterInputTable<S extends VoterService> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
VoterInputTable.BadInputException
Thrown when voter input is unacceptable for storage.
|
static class |
VoterInputTable.XMLColumnAppender
An XML column appender for a voter input table.
|
static class |
VoterInputTable.XMLColumnBuilder
An XML column appender for a voter input table that sinks to a string builder.
|
Modifier and Type | Field and Description |
---|---|
protected Database |
database |
static int |
MAX_INPUT_LENGTH
Maximum length of a single input string, in characters.
|
protected String |
statementKeyBase |
protected String |
tableName |
protected S |
voterService |
Modifier | Constructor and Description |
---|---|
protected |
VoterInputTable(S _voterService,
String _tableName)
Partially constructs a VoterInputTable.
|
Modifier and Type | Method and Description |
---|---|
Database |
database()
The database in which this table is stored.
|
void |
delete(String voterEmail)
Removes a voter's data from the table if any is stored there.
|
String |
get(String voterEmail)
Retrieves a voter's data from the 'xml' column.
|
void |
init()
Finishes constructing a VoterInputTable, physically creating it if it does not
already exist.
|
static String |
lengthConstrained(String inputString)
Throws a BadInputException if the input string is longer than MAX_INPUT_LENGTH; otherwise returns the same input string.
|
VotorolaRuntimeException |
newUnparseableInputException(String voterEmail,
String xml,
XMLStreamException nestedException)
Constructs an exception that complains about "unparseable data from input
table...".
|
void |
put(String voterEmail,
String xml,
ServiceSession userSession)
Stores a voter's data to the 'xml' column.
|
String |
tableName()
The name of this table (relation).
|
static void |
testAccessAllowed(String voterEmail,
ServiceSession userSession)
Throws a VotorolaSecurityException if voterEmail is unequal to
userSession.userEmail().
|
S |
voterService()
Returns the service whose voter input this table stores.
|
public static final int MAX_INPUT_LENGTH
protected final S extends VoterService voterService
protected final String statementKeyBase
protected VoterInputTable(S _voterService, String _tableName)
tableName()
,
voterService()
,
init()
public void init() throws SQLException
SQLException
@Warning(value="thread restricted object") public final Database database()
VoteServer.Run.database()
public void delete(String voterEmail) throws SQLException
SQLException
public String get(String voterEmail) throws SQLException
SQLException
public static String lengthConstrained(String inputString) throws VoterInputTable.BadInputException
public final VotorolaRuntimeException newUnparseableInputException(String voterEmail, String xml, XMLStreamException nestedException)
public void put(String voterEmail, String xml, ServiceSession userSession) throws VoterInputTable.BadInputException, SQLException
xml
- the data to store.userSession
- the session of the user requesting the change, or null if
the change is not user requested.VotorolaSecurityException
- if userSession is specified, and voterEmail
is unequal to userSession.userEmail(). This is a failsafe bug trap.VoterInputTable.BadInputException
SQLException
public final String tableName()
public static void testAccessAllowed(String voterEmail, ServiceSession userSession) throws VotorolaSecurityException
VotorolaSecurityException
public S voterService()