org.benow.web.complete
Class JSQLFieldCompleter
java.lang.Object
org.benow.web.complete.Completer
org.benow.web.complete.JDBCCompleter
org.benow.web.complete.JSQLFieldCompleter
- All Implemented Interfaces:
- java.lang.Iterable<CompleteResult>, java.util.Iterator<CompleteResult>
public class JSQLFieldCompleter
- extends JDBCCompleter
|
Constructor Summary |
protected |
JSQLFieldCompleter(java.lang.Class<?> forClass,
java.lang.String forField,
java.lang.String prefix,
java.lang.String params,
org.benow.repository.Transaction tx)
|
|
Method Summary |
protected void |
bind(java.sql.PreparedStatement stmt)
Binds parameters to the statement, if required |
protected java.sql.Connection |
createConnection()
|
protected CompleteResult |
createResult(java.sql.ResultSet rs)
Create the result from the current row in the result set |
java.lang.Class<?> |
getForClass()
The class this completer completes for, as provided in the forClass field of the Completer.Completes annotation
in the implementing completer. |
java.lang.String |
getForField()
The field this completer completes for, as provided in the forField field of the Completer.Completes annotation
in the implementing completer. |
protected java.lang.String |
getSQL()
|
protected void |
init()
Do something before any results are generated |
protected boolean |
isSufficient()
|
void |
setTransaction(org.benow.repository.Transaction tx)
|
| Methods inherited from class org.benow.web.complete.Completer |
cancel, close, getCompletionsFor, getCompletionsFor, getCompletionsFor, hasFailed, hasNext, iterator, next, remove, setHasFailed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSQLFieldCompleter
protected JSQLFieldCompleter(java.lang.Class<?> forClass,
java.lang.String forField,
java.lang.String prefix,
java.lang.String params,
org.benow.repository.Transaction tx)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
getForClass
public java.lang.Class<?> getForClass()
- Description copied from class:
Completer
- The class this completer completes for, as provided in the forClass field of the
Completer.Completes annotation
in the implementing completer.
- Overrides:
getForClass in class Completer
- Returns:
- the class this completer completes for
getForField
public java.lang.String getForField()
- Description copied from class:
Completer
- The field this completer completes for, as provided in the forField field of the
Completer.Completes annotation
in the implementing completer.
- Overrides:
getForField in class Completer
- Returns:
- the field this completer completes for
init
protected void init()
throws java.lang.Exception
- Description copied from class:
Completer
- Do something before any results are generated
- Overrides:
init in class JDBCCompleter
- Throws:
java.lang.Exception
isSufficient
protected boolean isSufficient()
- Overrides:
isSufficient in class Completer
- Returns:
- true if all required data is given (in params, prefix, etc). If not sufficient, the
query will not be done and there will be no results
setTransaction
public void setTransaction(org.benow.repository.Transaction tx)
createConnection
protected java.sql.Connection createConnection()
throws java.lang.Exception
- Overrides:
createConnection in class JDBCCompleter
- Returns:
- a new connection, defaults to JDBCRepository.getConnection()
- Throws:
java.sql.SQLException
java.lang.Exception
getSQL
protected java.lang.String getSQL()
- Specified by:
getSQL in class JDBCCompleter
- Returns:
- sql for query
bind
protected void bind(java.sql.PreparedStatement stmt)
throws java.sql.SQLException
- Description copied from class:
JDBCCompleter
- Binds parameters to the statement, if required
- Overrides:
bind in class JDBCCompleter
- Throws:
java.sql.SQLException
createResult
protected CompleteResult createResult(java.sql.ResultSet rs)
throws java.sql.SQLException
- Description copied from class:
JDBCCompleter
- Create the result from the current row in the result set
- Specified by:
createResult in class JDBCCompleter
- Returns:
- created result
- Throws:
java.sql.SQLException