ontopoly.model
Class QueryMapper<T>

java.lang.Object
  extended by ontopoly.model.QueryMapper<T>

public class QueryMapper<T>
extends java.lang.Object


Constructor Summary
QueryMapper(QueryProcessorIF processor)
           
QueryMapper(QueryProcessorIF processor, DeclarationContextIF context)
           
 
Method Summary
protected  QueryResultIF execute(java.lang.String query, java.util.Map<java.lang.String,?> params)
           
 boolean isTrue(java.lang.String query)
          EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.
 boolean isTrue(java.lang.String query, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.
 java.util.List<T> queryForList(java.lang.String query)
          EXPERIMENTAL: Runs the query, and returns a the single value in each row.
 java.util.List<T> queryForList(java.lang.String query, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Runs the query, and returns a the single value in each row.
 java.util.List<T> queryForList(java.lang.String query, RowMapperIF<T> mapper)
          EXPERIMENTAL: Runs the query, and calls the mapper for each row in the query result.
 java.util.List<T> queryForList(java.lang.String query, RowMapperIF<T> mapper, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Runs the query with the given parameters, and calls the mapper for each row in the query result.
 java.util.Map<java.lang.String,T> queryForMap(java.lang.String query)
          EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key.
 java.util.Map<java.lang.String,T> queryForMap(java.lang.String query, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key.
 T queryForObject(java.lang.String query)
          EXPERIMENTAL: Returns the value in the first column in the first row of the query result.
 T queryForObject(java.lang.String query, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Returns the value in the first column in the first row of the query result.
 T queryForObject(java.lang.String query, RowMapperIF<T> mapper)
          EXPERIMENTAL: Returns the value in the first column in the first row of the query result.
 T queryForObject(java.lang.String query, RowMapperIF<T> mapper, java.util.Map<java.lang.String,?> params)
          EXPERIMENTAL: Returns the mapping of the value in the first column in the first row of the query result.
protected  T wrapValue(java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryMapper

public QueryMapper(QueryProcessorIF processor)

QueryMapper

public QueryMapper(QueryProcessorIF processor,
                   DeclarationContextIF context)
Method Detail

isTrue

public boolean isTrue(java.lang.String query)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.


isTrue

public boolean isTrue(java.lang.String query,
                      java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Returns true if the query produces a row and false if the query produces no rows.


queryForObject

public T queryForObject(java.lang.String query)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.


queryForObject

public T queryForObject(java.lang.String query,
                        java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.


queryForObject

public T queryForObject(java.lang.String query,
                        RowMapperIF<T> mapper)
EXPERIMENTAL: Returns the value in the first column in the first row of the query result. If the query produces no results null is returned.


queryForObject

public T queryForObject(java.lang.String query,
                        RowMapperIF<T> mapper,
                        java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Returns the mapping of the value in the first column in the first row of the query result. If the query produces no results null is returned.


queryForList

public java.util.List<T> queryForList(java.lang.String query)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.


queryForList

public java.util.List<T> queryForList(java.lang.String query,
                                      RowMapperIF<T> mapper)
EXPERIMENTAL: Runs the query, and calls the mapper for each row in the query result. Returns a list of all the objects produced by the mapper in query result order.


queryForList

public java.util.List<T> queryForList(java.lang.String query,
                                      java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Runs the query, and returns a the single value in each row.


queryForList

public java.util.List<T> queryForList(java.lang.String query,
                                      RowMapperIF<T> mapper,
                                      java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Runs the query with the given parameters, and calls the mapper for each row in the query result. Returns a list of all the objects produced by the mapper in query result order.


queryForMap

public java.util.Map<java.lang.String,T> queryForMap(java.lang.String query)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key. If the query produces no rows the method returns null; if it produces more than one an exception is thrown.


queryForMap

public java.util.Map<java.lang.String,T> queryForMap(java.lang.String query,
                                                     java.util.Map<java.lang.String,?> params)
EXPERIMENTAL: Returns a map of the first row of the query results, with each variable name (without $) as a key and each variable value as the value of the key. If the query produces no rows the method returns null.


wrapValue

protected T wrapValue(java.lang.Object value)

execute

protected QueryResultIF execute(java.lang.String query,
                                java.util.Map<java.lang.String,?> params)
                         throws InvalidQueryException
Throws:
InvalidQueryException


Copyright © 2000-2012 Ontopia.