org.overlord.sramp.client
Class SrampClientQuery

java.lang.Object
  extended by org.overlord.sramp.client.SrampClientQuery

public class SrampClientQuery
extends Object

An S-RAMP Query, created by the SrampAtomApiClient from an xpath template. The xpath template is of the same form as a typical JDBC statement (using the ? character for replacements). Following are same example usages:

Author:
eric.wittmann@redhat.com

Constructor Summary
protected SrampClientQuery(SrampAtomApiClient client, String queryTemplate)
          Constructor.
 
Method Summary
 SrampClientQuery ascending()
          Sets ascending to true.
 SrampClientQuery count(int count)
           
 SrampClientQuery descending()
          Sets ascending to false.
 SrampClientQuery orderBy(String orderBy)
           
 SrampClientQuery parameter(Calendar param)
          Sets a parameter on the query.
 SrampClientQuery parameter(Date param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(double param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(float param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(int param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(long param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(Number param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery parameter(String param)
          Sets a parameter on the query - this should match up to a ? in the query template provided.
 SrampClientQuery propertyName(String propertyName)
           
 QueryResultSet query()
          Formats the query given the replacement params, then issues the query to the S-RAMP repository and returns the result.
 SrampClientQuery startIndex(int startIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SrampClientQuery

protected SrampClientQuery(SrampAtomApiClient client,
                           String queryTemplate)
Constructor.

Parameters:
client -
queryTemplate -
Method Detail

parameter

public SrampClientQuery parameter(String param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

parameter

public SrampClientQuery parameter(int param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

parameter

public SrampClientQuery parameter(long param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

parameter

public SrampClientQuery parameter(double param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

parameter

public SrampClientQuery parameter(Date param)
Sets a parameter on the query - this should match up to a ? in the query template provided. Note: this will add a date to the query. In order to be more precise and send a full DateTime, use the Calendar form of this method: parameter(Calendar param)

Parameters:
param -

parameter

public SrampClientQuery parameter(Calendar param)
Sets a parameter on the query. This should match up to a ? in the query template provided. note: this will add a DateTime to the query.

Parameters:
param -

parameter

public SrampClientQuery parameter(float param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

parameter

public SrampClientQuery parameter(Number param)
Sets a parameter on the query - this should match up to a ? in the query template provided.

Parameters:
param -

startIndex

public SrampClientQuery startIndex(int startIndex)
Parameters:
startIndex - the startIndex to set

count

public SrampClientQuery count(int count)
Parameters:
count - the count to set

orderBy

public SrampClientQuery orderBy(String orderBy)
Parameters:
orderBy - the orderBy to set

ascending

public SrampClientQuery ascending()
Sets ascending to true.


descending

public SrampClientQuery descending()
Sets ascending to false.


propertyName

public SrampClientQuery propertyName(String propertyName)
Parameters:
propertyName - property name to include in the result

query

public QueryResultSet query()
                     throws SrampClientException,
                            SrampAtomException
Formats the query given the replacement params, then issues the query to the S-RAMP repository and returns the result.

Throws:
SrampAtomException
SrampClientException


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.