fr.cnes.sitools.dataset.database
Interface DatabaseRequest

All Known Implementing Classes:
DefaultDatabaseRequest, MongoDBDatabaseRequest, MongoDBDistinctDatabaseRequest, MongoDBRangeDatabaseRequest, SQLDatabaseRequest, SQLListIdDatabaseRequest, SQLRangeDatabaseRequest

public interface DatabaseRequest

Interface for database request

Author:
m.gond (AKKA Technologies)

Method Summary
 java.lang.String buildURI()
          Build the URI to the current Record
 int calculateTotalCountFromBase()
          Compute from the database the number of Records in the current request
 void checkRequest()
          Check that the given request is correct and can be executed
 void close()
          Close the connection
 void createDistinctRequest()
          Create a SQL Distinct request
 void createRequest()
          Create a Request
 int getCount()
          Get the number of results in the current request for pagination purpose
 java.lang.String getDistinctRequestAsString()
          Gets the distinct request as a String
 int getMaxResultsToSend()
          Get the maximal number of results in the current request
 java.util.List<java.lang.String> getPrimaryKeys()
          Get the list of primary keys in the DataSet
 Record getRecord()
          Return the current ResultSet in a Record object
 java.lang.String getRequestAsString()
          Gets the request as a String
 java.util.List<java.lang.String> getSelectedPrimaryKey()
          Get the selected primary keys
 int getStartIndex()
          Get the index of the first result in the current request
 int getTotalCount()
          get the number of records in the current request
 boolean isCountDone()
          If the count must be done or not
 boolean isLastResult()
          Deprecated.  
 boolean nextResult()
          Move the cursor on the next result.
 

Method Detail

getPrimaryKeys

java.util.List<java.lang.String> getPrimaryKeys()
Get the list of primary keys in the DataSet

Returns:
The list of primary keys

getSelectedPrimaryKey

java.util.List<java.lang.String> getSelectedPrimaryKey()
Get the selected primary keys

Returns:
a list of strings containing primary keys

createDistinctRequest

void createDistinctRequest()
                           throws SitoolsException
Create a SQL Distinct request

Throws:
SitoolsException - when occurs

createRequest

void createRequest()
                   throws SitoolsException
Create a Request

Throws:
SitoolsException - when request fails

getTotalCount

int getTotalCount()
get the number of records in the current request

Returns:
the number of records in the current request

getCount

int getCount()
Get the number of results in the current request for pagination purpose

Returns:
the number of results in the current request for pagination purpose

getStartIndex

int getStartIndex()
Get the index of the first result in the current request

Returns:
the index of the first result in the current request

nextResult

boolean nextResult()
                   throws SitoolsException
Move the cursor on the next result.

Returns:
true if the new current row is valid; false if there are no more rows
Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

isLastResult

boolean isLastResult()
                     throws SitoolsException
Deprecated. 

Retrieves whether the cursor is on the last row of this ResultSet object or is the last ResultSet to send.

Returns:
true if the cursor is on the last row or is the last row to send.; false otherwise
Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

getRecord

Record getRecord()
                 throws SitoolsException
Return the current ResultSet in a Record object

Returns:
the Record of the current ResultSet
Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

close

void close()
           throws SitoolsException
Close the connection

Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

isCountDone

boolean isCountDone()
If the count must be done or not

Returns:
true if the count must be done, false otherwise

getDistinctRequestAsString

java.lang.String getDistinctRequestAsString()
                                            throws SitoolsException
Gets the distinct request as a String

Returns:
the String of a Distinct request
Throws:
SitoolsException - when occurs

getRequestAsString

java.lang.String getRequestAsString()
                                    throws SitoolsException
Gets the request as a String

Returns:
the String of a Distinct request
Throws:
SitoolsException - when occurs

getMaxResultsToSend

int getMaxResultsToSend()
Get the maximal number of results in the current request

Returns:
the maximal number of results in the current request

buildURI

java.lang.String buildURI()
                          throws SitoolsException
Build the URI to the current Record

Returns:
The URI to the current Record
Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

calculateTotalCountFromBase

int calculateTotalCountFromBase()
                                throws SitoolsException
Compute from the database the number of Records in the current request

Returns:
the number of total results or 0 if it cannot perform the request
Throws:
SitoolsException - if a database access error occurs or this method is called on a closed result set

checkRequest

void checkRequest()
                  throws SitoolsException
Check that the given request is correct and can be executed

Throws:
SitoolsException - if the given request is not correct


Copyright © 2010-2013 CNES. All Rights Reserved.