com.uwyn.rife.database.queries
Class ReadQueryTemplate

java.lang.Object
  extended by com.uwyn.rife.database.queries.ReadQueryTemplate
All Implemented Interfaces:
Query, ReadQuery

public class ReadQueryTemplate
extends Object
implements ReadQuery

An instance of ReadQueryTemplate will obtain a SQL from a Template block. If the template is provided but no block name, the entire content of the template will be used as the SQL query.

This allows you to write your custom SQL queries in dedicated templates, to name them, and to use them together with the functionalities that are provided by DbQueryManager

Since:
1.6
Version:
$Revision: 3654 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Constructor Summary
ReadQueryTemplate()
          Creates a new empty instance of ReadQueryTemplate.
ReadQueryTemplate(Template template)
          Creates a new instance of ReadQueryTemplate with the template instance whose content provides the SQL query that will be executed.
ReadQueryTemplate(Template template, String block)
          Creates a new instance of ReadQueryTemplate with the template instance and block name that provide the SQL that will be executed.
 
Method Summary
 ReadQueryTemplate block(String block)
          Sets the name of the template block.
 void clear()
           
 String getBlock()
          Retrieves the name of the template block.
 com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
           
 QueryParameters getParameters()
           
 String getSql()
           
 Template getTemplate()
          Retrieves the template instance.
 void setBlock(String block)
          Sets the name of the template block.
 void setExcludeUnsupportedCapabilities(boolean flag)
           
 void setTemplate(Template template)
          Sets the template instance.
 ReadQueryTemplate template(Template template)
          Sets the template instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadQueryTemplate

public ReadQueryTemplate()
Creates a new empty instance of ReadQueryTemplate.

Since:
1.6

ReadQueryTemplate

public ReadQueryTemplate(Template template)
Creates a new instance of ReadQueryTemplate with the template instance whose content provides the SQL query that will be executed.

Parameters:
template - the template instance
Since:
1.6

ReadQueryTemplate

public ReadQueryTemplate(Template template,
                         String block)
Creates a new instance of ReadQueryTemplate with the template instance and block name that provide the SQL that will be executed.

Parameters:
template - the template instance
block - the name of the template block
Since:
1.6
Method Detail

template

public ReadQueryTemplate template(Template template)
Sets the template instance.

Parameters:
template - the template instance
Returns:
this ReadQueryTemplate instance.
Since:
1.6
See Also:
setTemplate(com.uwyn.rife.template.Template), getTemplate()

setTemplate

public void setTemplate(Template template)
Sets the template instance.

Parameters:
template - the template instance
Since:
1.6
See Also:
template(com.uwyn.rife.template.Template), getTemplate()

getTemplate

public Template getTemplate()
Retrieves the template instance.

Returns:
the template instance; or

null if no template instance was provided

Since:
1.6
See Also:
template(com.uwyn.rife.template.Template), setTemplate(com.uwyn.rife.template.Template)

block

public ReadQueryTemplate block(String block)
Sets the name of the template block.

Parameters:
block - the name of the template block
Returns:
this ReadQueryTemplate instance.
Since:
1.6
See Also:
setBlock(java.lang.String), getBlock()

setBlock

public void setBlock(String block)
Sets the name of the template block.

Parameters:
block - the name of the template block
Since:
1.6
See Also:
block(java.lang.String), getBlock()

getBlock

public String getBlock()
Retrieves the name of the template block.

Returns:
the name of the template block; or

null if no block name was provided

Since:
1.6
See Also:
block(java.lang.String), setBlock(java.lang.String)

clear

public void clear()
Specified by:
clear in interface Query

getSql

public String getSql()
Specified by:
getSql in interface Query

getParameters

public QueryParameters getParameters()
Specified by:
getParameters in interface Query

getCapabilities

public com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
Specified by:
getCapabilities in interface Query

setExcludeUnsupportedCapabilities

public void setExcludeUnsupportedCapabilities(boolean flag)
Specified by:
setExcludeUnsupportedCapabilities in interface Query


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.