wt.query.template
Class ReportTemplateQueryHelper

java.lang.Object
  extended bywt.query.template.ReportTemplateQueryHelper
All Implemented Interfaces:
RemoteAccess

public class ReportTemplateQueryHelper
extends Object
implements RemoteAccess

This class provides static helper methods for building and executing queries for ReportTemplates.

Supported API: true

Extendable: false


Field Summary
private static String CLASSNAME
           
static int CONTAINER_INDEX
          From index of the Container class in the QuerySpecs that are built.
private static String CONTAINER_REFERENCE_ID
           
private static String CONTAINER_REFERENCE_KEY
           
private static WTContainerRef exchangeReference
           
private static String FC_RESOURCE
           
private static int[] REPORT_CONTAINER_FROM_INDICIES
           
private static int[] REPORT_FROM_INDEX
           
static int REPORT_TEMPLATE_INDEX
          From index of the ReportTemplate class in the QuerySpecs that are built.
private static String RESOURCE
           
(package private) static boolean SERVER
           
 
Fields inherited from interface wt.method.RemoteAccess
versionID
 
Constructor Summary
ReportTemplateQueryHelper()
           
 
Method Summary
protected static ReportTemplate _find(String a_nameValue, WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup)
          This method executes a query to find the specfied ReportTemplate.
protected static QueryResult _find(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes, String[] a_containerAttributes, WhereExpression a_whereExpression, OrderBy[] a_orderBy)
          This method builds and executes a QuerySpec.
protected static QueryResult _find(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes, WhereExpression a_whereExpression, OrderBy[] a_orderBy)
          This method builds and executes a QuerySpec.
static void appendNameCondition(String a_nameValue, boolean a_wildcard, LogicalOperator a_logicalOperator, int a_fromIndex, QuerySpec a_querySpec)
          This method appends a "name" attribute condition to the specified criteria.
static ReportTemplate find(String a_nameValue, WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup)
          This method executes a query to find the specfied ReportTemplate.
static QueryResult find(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes, String[] a_containerAttributes, WhereExpression a_whereExpression, OrderBy[] a_orderBy)
          This method builds and executes a QuerySpec.
static QueryResult find(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes, WhereExpression a_whereExpression, OrderBy[] a_orderBy)
          This method builds and executes a QuerySpec.
private static Object findObject(String a_nameValue, WTContainerRef a_containerReference, boolean a_fullPersistable, boolean a_hierarchicalContainerLookup)
           
static WTReference findReference(String a_nameValue, WTContainerRef a_containerReference)
          This method executes a query to find the specfied ReportTemplate reference.
private static WTContainerRef getExchangeRef()
           
private static int[] getFromIndicies(WhereExpression a_whereExpression)
           
static QuerySpec newQuerySpec(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup)
          This method builds a partial QuerySpec.
static QuerySpec newQuerySpec(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes)
          This method builds a QuerySpec.
static QuerySpec newQuerySpec(WTContainerRef a_containerReference, boolean a_hierarchicalContainerLookup, String[] a_reportTemplateAttributes, String[] a_containerAttributes)
          This method builds a QuerySpec.
private static void processSelectAttributes(String[] a_attributes, Class a_targetClass, int a_fromIndex, QuerySpec a_querySpec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

REPORT_TEMPLATE_INDEX

public static final int REPORT_TEMPLATE_INDEX
From index of the ReportTemplate class in the QuerySpecs that are built.

Supported API: true

See Also:
Constant Field Values

CONTAINER_INDEX

public static final int CONTAINER_INDEX
From index of the Container class in the QuerySpecs that are built.

Supported API: true

See Also:
Constant Field Values

SERVER

static final boolean SERVER

FC_RESOURCE

private static final String FC_RESOURCE
See Also:
Constant Field Values

CONTAINER_REFERENCE_KEY

private static final String CONTAINER_REFERENCE_KEY
See Also:
Constant Field Values

CONTAINER_REFERENCE_ID

private static final String CONTAINER_REFERENCE_ID
See Also:
Constant Field Values

REPORT_FROM_INDEX

private static final int[] REPORT_FROM_INDEX

REPORT_CONTAINER_FROM_INDICIES

private static final int[] REPORT_CONTAINER_FROM_INDICIES

exchangeReference

private static WTContainerRef exchangeReference
Constructor Detail

ReportTemplateQueryHelper

public ReportTemplateQueryHelper()
Method Detail

newQuerySpec

public static QuerySpec newQuerySpec(WTContainerRef a_containerReference,
                                     boolean a_hierarchicalContainerLookup)
                              throws WTException
This method builds a partial QuerySpec. The ReportTemplate class is added at REPORT_TEMPLATE_INDEX with no select, criteria, or sorting specified. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
Returns:
QuerySpec
Throws:
WTException

appendNameCondition

public static void appendNameCondition(String a_nameValue,
                                       boolean a_wildcard,
                                       LogicalOperator a_logicalOperator,
                                       int a_fromIndex,
                                       QuerySpec a_querySpec)
                                throws WTException
This method appends a "name" attribute condition to the specified criteria. If the name value is null, then nothing is appended. If the name value contains a database wildcard, then a LIKE condition is created. Otherwise, an EQUAL condition is created.

Supported API: true

Parameters:
a_nameValue - Specifies the "name" value to use for the condition. If the name value is null, then nothing is appended. If the name value contains a database wildcard, then a LIKE condition is created. Otherwise, an EQUAL condition is created.
a_wildcard - Indicates if wildcard condition should be used. If true, then a LIKE condition is created. Otherwise, an EQUAL condition is created.
a_logicalOperator - Specifies the LogicalOperator to use when appending the condition to a QuerySpec with existing criteria. If null, then AND is used.
a_fromIndex - The From clause index of the ReportTemplate class in the specified QuerySpec.
a_querySpec - The QuerySpec to append the condition to.
Throws:
WTException

find

public static ReportTemplate find(String a_nameValue,
                                  WTContainerRef a_containerReference,
                                  boolean a_hierarchicalContainerLookup)
                           throws WTException
This method executes a query to find the specfied ReportTemplate.

Supported API: true

Parameters:
a_nameValue - Specifies the "name" value to use for the condition. If the name value contains a database wildcard, then a LIKE condition is created. Otherwise, an EQUAL condition is created. If the name value is null, then no query is executed and null is returned.
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or the first matching parent container, recursively. If false, then only the specified container will be searched.
Returns:
ReportTemplate
Throws:
WTException

_find

protected static ReportTemplate _find(String a_nameValue,
                                      WTContainerRef a_containerReference,
                                      boolean a_hierarchicalContainerLookup)
                               throws WTException
This method executes a query to find the specfied ReportTemplate.

Supported API: true

Parameters:
a_nameValue - Specifies the "name" value to use for the condition. If the name value contains a database wildcard, then a LIKE condition is created. Otherwise, an EQUAL condition is created. If the name value is null, then no query is executed and null is returned.
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or the first matching parent container, recursively. If false, then only the specified container will be searched.
Returns:
ReportTemplate
Throws:
WTException

findReference

public static WTReference findReference(String a_nameValue,
                                        WTContainerRef a_containerReference)
                                 throws WTException
This method executes a query to find the specfied ReportTemplate reference.

Supported API: true

Parameters:
a_nameValue - Specifies the "name" value to use for the condition. If the name value contains a database wildcard, then a LIKE condition is created. Otherwise, an EQUAL condition is created. If the name value is null, then no query is executed and null is returned.
a_containerReference - Specifies the container reference to use for criteria.
Returns:
WTReference
Throws:
WTException

newQuerySpec

public static QuerySpec newQuerySpec(WTContainerRef a_containerReference,
                                     boolean a_hierarchicalContainerLookup,
                                     String[] a_reportTemplateAttributes,
                                     String[] a_containerAttributes)
                              throws WTException
This method builds a QuerySpec. The ReportTemplate class is added at REPORT_TEMPLATE_INDEX and the WTContainer class is added at CONTAINER_INDEX. No criteria or sorting is specified. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
a_containerAttributes - Array of WTContainer attribute names to select in the query. If null, then the entire Persistable is selected.
Returns:
QuerySpec
Throws:
WTException

newQuerySpec

public static QuerySpec newQuerySpec(WTContainerRef a_containerReference,
                                     boolean a_hierarchicalContainerLookup,
                                     String[] a_reportTemplateAttributes)
                              throws WTException
This method builds a QuerySpec. The ReportTemplate class is added at REPORT_TEMPLATE_INDEX and no criteria or sorting is specified. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
Returns:
QuerySpec
Throws:
WTException

find

public static QueryResult find(WTContainerRef a_containerReference,
                               boolean a_hierarchicalContainerLookup,
                               String[] a_reportTemplateAttributes,
                               String[] a_containerAttributes,
                               WhereExpression a_whereExpression,
                               OrderBy[] a_orderBy)
                        throws WTException
This method builds and executes a QuerySpec. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
a_containerAttributes - Array of WTContainer attribute names to select in the query. If null, then the entire Persistable is selected.
a_whereExpression - WhereExpression to use for the query.
a_orderBy - Array of OrderBy instance to use for the query.
Returns:
QueryResult
Throws:
WTException

_find

protected static QueryResult _find(WTContainerRef a_containerReference,
                                   boolean a_hierarchicalContainerLookup,
                                   String[] a_reportTemplateAttributes,
                                   String[] a_containerAttributes,
                                   WhereExpression a_whereExpression,
                                   OrderBy[] a_orderBy)
                            throws WTException
This method builds and executes a QuerySpec. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
a_containerAttributes - Array of WTContainer attribute names to select in the query. If null, then the entire Persistable is selected.
a_whereExpression - WhereExpression to use for the query.
a_orderBy - Array of OrderBy instance to use for the query.
Returns:
QueryResult
Throws:
WTException

find

public static QueryResult find(WTContainerRef a_containerReference,
                               boolean a_hierarchicalContainerLookup,
                               String[] a_reportTemplateAttributes,
                               WhereExpression a_whereExpression,
                               OrderBy[] a_orderBy)
                        throws WTException
This method builds and executes a QuerySpec. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
a_whereExpression - WhereExpression to use for the query.
a_orderBy - Array of OrderBy instance to use for the query.
Returns:
QueryResult
Throws:
WTException

_find

protected static QueryResult _find(WTContainerRef a_containerReference,
                                   boolean a_hierarchicalContainerLookup,
                                   String[] a_reportTemplateAttributes,
                                   WhereExpression a_whereExpression,
                                   OrderBy[] a_orderBy)
                            throws WTException
This method builds and executes a QuerySpec. Container criteria are applied, if the container reference is non-null.

Supported API: true

Parameters:
a_containerReference - Specifies the container reference to use for criteria.
a_hierarchicalContainerLookup - Specifies whether the container criteria should be hierarchical. If true, then the criteria will match the specified container or any of its parent containers. If false, then only the specified container wil be matched.
a_reportTemplateAttributes - Array of ReportTemplate attribute names to select in the query. If null, then the entire Persistable is selected.
a_whereExpression - WhereExpression to use for the query.
a_orderBy - Array of OrderBy instance to use for the query.
Returns:
QueryResult
Throws:
WTException

getExchangeRef

private static final WTContainerRef getExchangeRef()
                                            throws WTException
Throws:
WTException

processSelectAttributes

private static void processSelectAttributes(String[] a_attributes,
                                            Class a_targetClass,
                                            int a_fromIndex,
                                            QuerySpec a_querySpec)
                                     throws WTException
Throws:
WTException

findObject

private static Object findObject(String a_nameValue,
                                 WTContainerRef a_containerReference,
                                 boolean a_fullPersistable,
                                 boolean a_hierarchicalContainerLookup)
                          throws WTException
Throws:
WTException

getFromIndicies

private static int[] getFromIndicies(WhereExpression a_whereExpression)
                              throws WTException
Throws:
WTException