org.gcube.data.spd.obisplugin
Class PluginSession

java.lang.Object
  extended by org.gcube.data.spd.obisplugin.PluginSession

public class PluginSession
extends Object

Author:
"Federico De Faveri defaveri@isti.cnr.it"

Field Summary
protected  PreparedStatement childrenTaxonPreparedStatement
           
protected  PreparedStatement commonNameFromScientificNamePreparedStatement
           
protected  PreparedStatement commonNamePreparedStatement
           
protected  Connection connection
           
protected  DatabaseCredential databaseCredential
           
protected  PreparedStatement datasetPreparedStatement
           
protected  PreparedStatement occurrenceByIdPreparedStatement
           
protected static String SCHEMA
           
protected  PreparedStatement scientificNameFromCommonNamePreparedStatement
           
protected  PreparedStatement scientificNamePreparedStatement
           
protected  PreparedStatement searchCommonNamePreparedStatement
           
protected  PreparedStatement searchScientificNamePreparedStatement
           
protected  PreparedStatement taxonCommonNamePreparedStatement
           
protected  PreparedStatement taxonPreparedStatement
           
 
Constructor Summary
PluginSession(Connection connection)
           
PluginSession(DatabaseCredential databaseCredential, Connection connection)
           
 
Method Summary
protected  void addParameters(PreparedStatement preparedStatement, int parameterCounter, List<org.gcube.data.spd.model.Condition> conditions)
           
protected  void buildCondition(StringBuilder query, String prefix, org.gcube.data.spd.model.Condition condition)
           
protected  void buildConditions(StringBuilder query, String prefix, List<org.gcube.data.spd.model.Condition> conditions)
           
protected  void createChildrenTaxonPreparedStatement()
           
protected  void createCommonNameFromScientificNamePreparedStatement()
           
protected  void createCommonNamePreparedStatement()
           
protected  void createDatasetPreparedStatement()
           
protected  void createOccurrenceByIdPreparedStatement()
           
protected  void createScientificNameFromCommonNamePreparedStatement()
           
protected  void createScientificNamePreparedStatement()
           
protected  void createSearchCommonNamePreparedStatement()
           
protected  void createSearchScientificNamePreparedStatement()
           
protected  void createTaxonCommonNamePreparedStatemen()
           
protected  void createTaxonPreparedStatement()
           
 void expire()
           
 PreparedStatement getChildrenTaxonPreparedStatement(int id)
           
 PreparedStatement getCommonNameFromScientificNamePreparedStatement(String scientificaName)
           
 PreparedStatement getCommonNamePreparedStatement(String commonName)
           
 Connection getConnection()
           
 PreparedStatement getDatasetPreparedStatement(int id)
           
protected  PreparedStatement getOccurrenceByIdPreparedStatement(int occurrenceId)
           
 PreparedStatement getOccurrencesCountPreparedStatement(int taxonId, int datasetId, SearchFilters filters)
           
protected  PreparedStatement getOccurrencesPreparedStatement(int taxonId, int datasetId, SearchFilters filters)
           
 PreparedStatement getScientificNameFromCommonNamePreparedStatement(String commonName)
           
 PreparedStatement getScientificNamePreparedStatement(String scientificName)
           
 PreparedStatement getSearchCommonNamePreparedStatement(String searchTerm)
           
 PreparedStatement getSearchScientificNamePreparedStatement(String searchTerm)
           
 PreparedStatement getTaxonCommonNamePreparedStatement(int taxonNameId)
           
 PreparedStatement getTaxonPreparedStatement(int id)
           
protected  boolean isValid()
           
 boolean isValid(DatabaseCredential databaseCredential)
          The session is valid if the connection is OK and if the connection has been created using the same credentials.
 void preCacheStatements()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA

protected static final String SCHEMA
See Also:
Constant Field Values

databaseCredential

protected DatabaseCredential databaseCredential

connection

protected Connection connection

taxonPreparedStatement

protected PreparedStatement taxonPreparedStatement

taxonCommonNamePreparedStatement

protected PreparedStatement taxonCommonNamePreparedStatement

datasetPreparedStatement

protected PreparedStatement datasetPreparedStatement

commonNameFromScientificNamePreparedStatement

protected PreparedStatement commonNameFromScientificNamePreparedStatement

scientificNameFromCommonNamePreparedStatement

protected PreparedStatement scientificNameFromCommonNamePreparedStatement

searchCommonNamePreparedStatement

protected PreparedStatement searchCommonNamePreparedStatement

searchScientificNamePreparedStatement

protected PreparedStatement searchScientificNamePreparedStatement

scientificNamePreparedStatement

protected PreparedStatement scientificNamePreparedStatement

commonNamePreparedStatement

protected PreparedStatement commonNamePreparedStatement

childrenTaxonPreparedStatement

protected PreparedStatement childrenTaxonPreparedStatement

occurrenceByIdPreparedStatement

protected PreparedStatement occurrenceByIdPreparedStatement
Constructor Detail

PluginSession

public PluginSession(Connection connection)
Parameters:
connection -

PluginSession

public PluginSession(DatabaseCredential databaseCredential,
                     Connection connection)
Parameters:
credentialToken -
connection -
Method Detail

getConnection

public Connection getConnection()
Returns:
the connection

isValid

public boolean isValid(DatabaseCredential databaseCredential)
                throws SQLException
The session is valid if the connection is OK and if the connection has been created using the same credentials.

Parameters:
credentialToken -
Returns:
Throws:
SQLException

isValid

protected boolean isValid()

expire

public void expire()
            throws SQLException
Throws:
SQLException

preCacheStatements

public void preCacheStatements()
                        throws SQLException
Throws:
SQLException

getTaxonPreparedStatement

public PreparedStatement getTaxonPreparedStatement(int id)
                                            throws SQLException
Throws:
SQLException

createTaxonPreparedStatement

protected void createTaxonPreparedStatement()
                                     throws SQLException
Throws:
SQLException

getTaxonCommonNamePreparedStatement

public PreparedStatement getTaxonCommonNamePreparedStatement(int taxonNameId)
                                                      throws SQLException
Throws:
SQLException

createTaxonCommonNamePreparedStatemen

protected void createTaxonCommonNamePreparedStatemen()
                                              throws SQLException
Throws:
SQLException

getDatasetPreparedStatement

public PreparedStatement getDatasetPreparedStatement(int id)
                                              throws SQLException
Throws:
SQLException

createDatasetPreparedStatement

protected void createDatasetPreparedStatement()
                                       throws SQLException
Throws:
SQLException

getCommonNameFromScientificNamePreparedStatement

public PreparedStatement getCommonNameFromScientificNamePreparedStatement(String scientificaName)
                                                                   throws SQLException
Throws:
SQLException

createCommonNameFromScientificNamePreparedStatement

protected void createCommonNameFromScientificNamePreparedStatement()
                                                            throws SQLException
Throws:
SQLException

getScientificNameFromCommonNamePreparedStatement

public PreparedStatement getScientificNameFromCommonNamePreparedStatement(String commonName)
                                                                   throws SQLException
Throws:
SQLException

createScientificNameFromCommonNamePreparedStatement

protected void createScientificNameFromCommonNamePreparedStatement()
                                                            throws SQLException
Throws:
SQLException

getSearchCommonNamePreparedStatement

public PreparedStatement getSearchCommonNamePreparedStatement(String searchTerm)
                                                       throws SQLException
Throws:
SQLException

createSearchCommonNamePreparedStatement

protected void createSearchCommonNamePreparedStatement()
                                                throws SQLException
Throws:
SQLException

getSearchScientificNamePreparedStatement

public PreparedStatement getSearchScientificNamePreparedStatement(String searchTerm)
                                                           throws SQLException
Throws:
SQLException

createSearchScientificNamePreparedStatement

protected void createSearchScientificNamePreparedStatement()
                                                    throws SQLException
Throws:
SQLException

getOccurrencesCountPreparedStatement

public PreparedStatement getOccurrencesCountPreparedStatement(int taxonId,
                                                              int datasetId,
                                                              SearchFilters filters)
                                                       throws SQLException
Throws:
SQLException

buildConditions

protected void buildConditions(StringBuilder query,
                               String prefix,
                               List<org.gcube.data.spd.model.Condition> conditions)

buildCondition

protected void buildCondition(StringBuilder query,
                              String prefix,
                              org.gcube.data.spd.model.Condition condition)

addParameters

protected void addParameters(PreparedStatement preparedStatement,
                             int parameterCounter,
                             List<org.gcube.data.spd.model.Condition> conditions)
                      throws SQLException
Throws:
SQLException

getOccurrencesPreparedStatement

protected PreparedStatement getOccurrencesPreparedStatement(int taxonId,
                                                            int datasetId,
                                                            SearchFilters filters)
                                                     throws SQLException
Throws:
SQLException

getScientificNamePreparedStatement

public PreparedStatement getScientificNamePreparedStatement(String scientificName)
                                                     throws SQLException
Throws:
SQLException

createScientificNamePreparedStatement

protected void createScientificNamePreparedStatement()
                                              throws SQLException
Throws:
SQLException

getCommonNamePreparedStatement

public PreparedStatement getCommonNamePreparedStatement(String commonName)
                                                 throws SQLException
Throws:
SQLException

createCommonNamePreparedStatement

protected void createCommonNamePreparedStatement()
                                          throws SQLException
Throws:
SQLException

getChildrenTaxonPreparedStatement

public PreparedStatement getChildrenTaxonPreparedStatement(int id)
                                                    throws SQLException
Throws:
SQLException

createChildrenTaxonPreparedStatement

protected void createChildrenTaxonPreparedStatement()
                                             throws SQLException
Throws:
SQLException

getOccurrenceByIdPreparedStatement

protected PreparedStatement getOccurrenceByIdPreparedStatement(int occurrenceId)
                                                        throws SQLException
Throws:
SQLException

createOccurrenceByIdPreparedStatement

protected void createOccurrenceByIdPreparedStatement()
                                              throws SQLException
Throws:
SQLException


Copyright © 2013. All Rights Reserved.