fr.cnes.sitools.dataset.database.mongodb
Class MongoDBRangeDatabaseRequest

java.lang.Object
  extended by fr.cnes.sitools.dataset.database.mongodb.MongoDBDatabaseRequest
      extended by fr.cnes.sitools.dataset.database.mongodb.MongoDBRangeDatabaseRequest
All Implemented Interfaces:
DatabaseRequest

public class MongoDBRangeDatabaseRequest
extends MongoDBDatabaseRequest

Execute a request for some records specified by a List of ranges

Author:
m.gond

Constructor Summary
MongoDBRangeDatabaseRequest(DatabaseRequestParameters params)
          Create a new SQLRangeDatabaseRequest with the given DatabaseRequestParameters
 
Method Summary
 int calculateTotalCountFromBase()
          Compute from the database the number of Records in the current request
 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
 int getTotalCount()
          get the number of records in the current request
 boolean nextResult()
          Move the cursor on the next result.
 
Methods inherited from class fr.cnes.sitools.dataset.database.mongodb.MongoDBDatabaseRequest
buildURI, checkRequest, close, createMongoDBRequestModel, getDistinctRequestAsString, getKeysAsString, getMaxResultsToSend, getPageSize, getPrimaryKeys, getRecord, getRequestAsString, getSelectedPrimaryKey, getStartIndex, isCountDone, isLastResult, setAttributeValues, setMaxResultsToSend
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoDBRangeDatabaseRequest

public MongoDBRangeDatabaseRequest(DatabaseRequestParameters params)
Create a new SQLRangeDatabaseRequest with the given DatabaseRequestParameters

Parameters:
params - the DatabaseRequestParameters
Method Detail

createRequest

public final void createRequest()
                         throws SitoolsException
Description copied from interface: DatabaseRequest
Create a Request

Specified by:
createRequest in interface DatabaseRequest
Overrides:
createRequest in class MongoDBDatabaseRequest
Throws:
SitoolsException - when request fails

createDistinctRequest

public void createDistinctRequest()
                           throws SitoolsException
Description copied from interface: DatabaseRequest
Create a SQL Distinct request

Specified by:
createDistinctRequest in interface DatabaseRequest
Overrides:
createDistinctRequest in class MongoDBDatabaseRequest
Throws:
SitoolsException - when occurs

nextResult

public final boolean nextResult()
                         throws SitoolsException
Description copied from interface: DatabaseRequest
Move the cursor on the next result.

Specified by:
nextResult in interface DatabaseRequest
Overrides:
nextResult in class MongoDBDatabaseRequest
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

getTotalCount

public int getTotalCount()
Description copied from interface: DatabaseRequest
get the number of records in the current request

Specified by:
getTotalCount in interface DatabaseRequest
Overrides:
getTotalCount in class MongoDBDatabaseRequest
Returns:
the number of records in the current request

getCount

public int getCount()
Description copied from interface: DatabaseRequest
Get the number of results in the current request for pagination purpose

Specified by:
getCount in interface DatabaseRequest
Overrides:
getCount in class MongoDBDatabaseRequest
Returns:
the number of results in the current request for pagination purpose

calculateTotalCountFromBase

public int calculateTotalCountFromBase()
                                throws SitoolsException
Description copied from interface: DatabaseRequest
Compute from the database the number of Records in the current request

Specified by:
calculateTotalCountFromBase in interface DatabaseRequest
Overrides:
calculateTotalCountFromBase in class MongoDBDatabaseRequest
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


Copyright © 2010-2013 CNES. All Rights Reserved.