com.taggercat.tags
Class DataSourceTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.AbstractExpEvalTag
          extended by com.taggercat.tags.DataSourceTag
All Implemented Interfaces:
com.taggercat.el.ELPropertyResolver, java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class DataSourceTag
extends AbstractExpEvalTag

This tag creates a data source instance, and adds it to the Model. If an existing data source of the same name exists in the model, then a reference to the existing data source is used. A instance variable is created on the page for the data source. The name of the instance variable is set by the instanceVar parameter. The scope of the instance variable is from the beginning of the tag to the end of the page.

The where clause can be composed of both static and dynamic text.

Dynamic text can be embedded in the whereClause using expressions delimited by @{ and }.

Any number of expressions can be embedded within the where clause. The final where clause is created by evaluating the embedded expressions, and replacing them with their resulting text.

Example:

 whereClause=" ORDER.STATUS = 'PAID' AND ORDER.ORDERED_BY = '@{ upper( userName() )' } "
 

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
DataSourceTag()
           
 
Method Summary
 int doEndTag()
          Resets the tags internal state.
 int doStartTag()
          Creates and executes the data source, if it does not already exist.
 java.lang.String getCacheRegion()
           
 java.lang.Integer getPageSize()
           
 java.lang.String getScope()
           
 long getTimeout()
           
 boolean isCacheable()
           
 boolean isRefreshParent()
           
 boolean isReloadCollection()
           
 void setAppendQbfWhereClause(boolean appendQbfWhereClause)
          Sets the AppendQbfWhereClause attribute.
 void setCacheable(boolean cacheable)
           
 void setCacheRegion(java.lang.String cacheRegion)
           
 void setClassname(java.lang.String classname)
          Sets the fully qualified classname of the data source object to be used for this tag.
 void setEntity(java.lang.String entity)
          Sets the entity attribute.
 void setEventListenerClassname(java.lang.String eventListenerClassname)
          Sets the fully qualified classname of the event listener for this datasource.
 void setInstanceVar(java.lang.String instanceVar)
          Sets the instanceVar attribute.
 void setMaxRows(java.lang.String maxRows)
          Sets maxRows.
 void setMode(java.lang.String mode)
          Sets the mode attribute.
 void setName(java.lang.String name)
          Sets the Name attribute.
 void setOrderBy(java.lang.String orderBy)
          Sets the orderBy attribute.
 void setPageSize(java.lang.Integer pageSize)
           
 void setParentAdderMethod(java.lang.String parentAdderMethod)
           
 void setParentCollection(java.lang.String parentCollection)
          Sets the name of the parent collection if this is a child data source.
 void setParentDS(java.lang.String parentDS)
          Sets the name of the parent data source.
 void setParentPropertyName(java.lang.String parentPropertyName)
           
 void setPrefetchRowCount(java.lang.String prefetchRowCount)
          Sets the prefetchRowCount attribute.
 void setRefreshParent(boolean refreshParent)
           
 void setReloadCollection(boolean reloadCollection)
           
 void setRetainSortOrder(java.lang.String retainSortOrder)
          Sets the retainSortOrder attribute.
 void setScope(java.lang.String scope)
          Sets the scope the attribute will be saved under.
 void setTimeout(long timeout)
           
 void setWhereClause(java.lang.String whereClause)
          Sets the whereClause attribute using SQL ( not HQL ).
 java.lang.String toString()
          Returns a string description of the object.
 
Methods inherited from class com.taggercat.tags.AbstractExpEvalTag
getModel, resolveProperty, setValue, setVar
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceTag

public DataSourceTag()
Method Detail

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Resets the tags internal state.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_PAGE

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Creates and executes the data source, if it does not already exist.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
SKIP_BODY

setEntity

public void setEntity(java.lang.String entity)
Sets the entity attribute. This is the entity name the data source will represent.

Parameters:
entity - The new entity value

setClassname

public void setClassname(java.lang.String classname)
Sets the fully qualified classname of the data source object to be used for this tag. The classname must be a subclass of DataSource. This allows you to provide your own extended data source functionality.

Parameters:
classname - The new class name value

setEventListenerClassname

public void setEventListenerClassname(java.lang.String eventListenerClassname)
Sets the fully qualified classname of the event listener for this datasource.

Parameters:
eventListenerClassname - The eventListenerClassname value

setInstanceVar

public void setInstanceVar(java.lang.String instanceVar)
Sets the instanceVar attribute. This is the name of the instance variable for the data source object.

Parameters:
instanceVar - The new instanceVar value

setMaxRows

public void setMaxRows(java.lang.String maxRows)
Sets maxRows.

Parameters:
maxRows - the maxRows value

setMode

public void setMode(java.lang.String mode)
Sets the mode attribute.

Parameters:
mode - the Query mode value

setName

public void setName(java.lang.String name)
Sets the Name attribute. also sets the rowIDName value = ".rowID"

Parameters:
name - the new name value

setOrderBy

public void setOrderBy(java.lang.String orderBy)
Sets the orderBy attribute.

Parameters:
orderBy - the new orderBy value

setParentDS

public void setParentDS(java.lang.String parentDS)
Sets the name of the parent data source.

Parameters:
parentDS - the new parentDS value

setPrefetchRowCount

public void setPrefetchRowCount(java.lang.String prefetchRowCount)
Sets the prefetchRowCount attribute.
If the prefetchRowCount property is set to true, then a new data source does a prefetchRowCount when its query is executed.

Parameters:
prefetchRowCount - the new prefetchRowCount value

setRetainSortOrder

public void setRetainSortOrder(java.lang.String retainSortOrder)
Sets the retainSortOrder attribute. Set true to have the DS retain sort order.

Since:
Build 20040510 1737
Parameters:
retainSortOrder - should the sort order be retain across queries

setWhereClause

public void setWhereClause(java.lang.String whereClause)
Sets the whereClause attribute using SQL ( not HQL ). The where clause can be composed of both static and dynamic text.

Dynamic text can be embedded using expressions delimited by @{ and }.

Any number of expressions can be embedded within the where clause. The final where clause is created by evaluating the embedded expressions, and replacing them their resulting text.

Example:

 whereClause=" ORDER.STATUS = 'PAID' AND ORDER.ORDERED_BY = '@{ upper( userName() ) }' "
 

Embedded expression should return a string result. on specifying expressions.

Parameters:
whereClause - the new whereClause value

setAppendQbfWhereClause

public void setAppendQbfWhereClause(boolean appendQbfWhereClause)
Sets the AppendQbfWhereClause attribute. If set true ( the default value) then QBF where clauses are appended to the main where clause.

Parameters:
appendQbfWhereClause - the new appendQbfWhereClause value

toString

public java.lang.String toString()
Returns a string description of the object.

Overrides:
toString in class java.lang.Object
Returns:
description of the Returned Value

setParentCollection

public void setParentCollection(java.lang.String parentCollection)
Sets the name of the parent collection if this is a child data source.

Parameters:
parentCollection - The parentCollection to set.

setParentAdderMethod

public void setParentAdderMethod(java.lang.String parentAdderMethod)

setParentPropertyName

public void setParentPropertyName(java.lang.String parentPropertyName)

getScope

public java.lang.String getScope()

setScope

public void setScope(java.lang.String scope)
Description copied from class: AbstractExpEvalTag
Sets the scope the attribute will be saved under.

Overrides:
setScope in class AbstractExpEvalTag
Parameters:
scope - sets the scope attribute of the tag The scope can be one of:

  • page - default if not specified
  • session
  • request
  • application

isRefreshParent

public boolean isRefreshParent()

setRefreshParent

public void setRefreshParent(boolean refreshParent)

isCacheable

public boolean isCacheable()

setCacheable

public void setCacheable(boolean cacheable)

getCacheRegion

public java.lang.String getCacheRegion()

setCacheRegion

public void setCacheRegion(java.lang.String cacheRegion)

getTimeout

public long getTimeout()
Returns:
the timeout

setTimeout

public void setTimeout(long timeout)
Parameters:
timeout - the timeout to set

getPageSize

public java.lang.Integer getPageSize()

setPageSize

public void setPageSize(java.lang.Integer pageSize)

isReloadCollection

public boolean isReloadCollection()

setReloadCollection

public void setReloadCollection(boolean reloadCollection)