public interface Statements
Modifier and Type | Interface and Description |
---|---|
static interface |
Statements.BatchUpdate
A batch of table update operations.
|
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_EXISTS |
static String |
CREATE_TABLE
A set of constants representing keys in the statements properties files, for each of the DB statements
|
static String |
DELETE_TABLE |
static String |
GET_ALL_IDS |
static String |
GET_BY_ID |
static String |
GET_MULTIPLE |
static String |
INSERT_CONTENT |
static String |
REMOVE_ALL_CONTENT |
static String |
REMOVE_CONTENT |
static String |
UPDATE_CONTENT |
Modifier and Type | Method and Description |
---|---|
Statements.BatchUpdate |
batchUpdate(Connection connection)
Starts a batch update operation with the given connection.
|
Void |
createTable(Connection connection)
Create a new table.
|
Void |
dropTable(Connection connection)
Drops a table.
|
boolean |
exists(Connection connection,
String id)
Checks if there is a document with the given id.
|
List<String> |
getAllIds(Connection connection)
Returns all the ids from a table.
|
Document |
getById(Connection connection,
String id)
Searches for a document with a certain id.
|
<R> List<R> |
load(Connection connection,
List<String> ids,
Function<Document,R> parser)
Loads multiple documents based on a set of ids.
|
Void |
removeAll(Connection connection)
Removes all the contents of a table.
|
static final String CREATE_TABLE
static final String DELETE_TABLE
static final String GET_ALL_IDS
static final String GET_BY_ID
static final String CONTENT_EXISTS
static final String INSERT_CONTENT
static final String UPDATE_CONTENT
static final String REMOVE_CONTENT
static final String REMOVE_ALL_CONTENT
static final String GET_MULTIPLE
Void createTable(Connection connection) throws SQLException
connection
- a Connection
instance; may not be nullSQLException
- if the operation fails.Void dropTable(Connection connection) throws SQLException
connection
- a Connection
instance; may not be nullSQLException
- if the operation fails.List<String> getAllIds(Connection connection) throws SQLException
connection
- a Connection
instance; may not be nullList
of ids; never null
SQLException
- if the operation fails.Document getById(Connection connection, String id) throws SQLException
connection
- a Connection
instance; may not be nullDocument
instance or null
if the document is not found.SQLException
- if the operation fails.<R> List<R> load(Connection connection, List<String> ids, Function<Document,R> parser) throws SQLException
Depending on the type of DB, if a very large number of IDs is used this may have side effects:
connection
- a Connection
instance; may not be nullids
- a List
of ids; may not be nullparser
- a Function
which is used to transform or process each of documents corresponding to the given IDS;
may not be nullList
of Object
instances for each of the ids which were found in the DB; never null
SQLException
- if the operation fails.Statements.BatchUpdate batchUpdate(Connection connection)
connection
- a Connection
instance; may not be nullStatements.BatchUpdate
instance, never null
boolean exists(Connection connection, String id) throws SQLException
connection
- a Connection
instance; may not be nullid
- a String
the id of a document; may not be nulltrue
if the document exists, false
otherwise.SQLException
- if the operation fails.Void removeAll(Connection connection) throws SQLException
connection
- a Connection
instance; may not be nullSQLException
- if the operation fails.Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.