com.groiss.reporting.engine
Class Query

java.lang.Object
  extended by com.groiss.reporting.engine.Query

public class Query
extends java.lang.Object


Constructor Summary
Query(java.lang.String id, java.lang.String title, org.jdom.Document xml, java.util.Date execution, javax.servlet.http.HttpServletRequest req)
           
Query(java.lang.String id, java.lang.String title, org.jdom.Document xml, java.util.Date execution, javax.servlet.http.HttpServletRequest req, com.groiss.reporting.StoredQuery q)
           
Query(java.lang.String id, java.lang.String title, org.jdom.Document xml, java.util.Date execution, java.util.Map paramMap)
          Constructs a Query, builds the SQL Statement
Query(java.lang.String id, java.lang.String title, org.jdom.Document xml, java.util.Date execution, java.util.Map paramMap, com.groiss.reporting.StoredQuery q)
           
 
Method Summary
 void addCondition(java.lang.String tablename, java.lang.String alias, java.lang.String condition, java.lang.String selection, java.util.Vector condValues)
           
 void addCondString(java.lang.String condition)
          adds a sql syntax fitting string to conditon (Warning: no join for this statement is done!)
 void addConnector(java.lang.String connector)
           
 void addOrderByForAggregateValueData(java.lang.String att)
           
 boolean addRowNumber()
           
 java.lang.String addSelect(java.lang.String tablename, java.lang.String selectAttribute, java.lang.String alias, java.lang.String selection, boolean addToGroupBy, boolean addAliasAsPrefix)
          Adds a select Attribute to the query.
 void addSelectNameOfAttrib(org.jdom.Element attribute, java.lang.String name)
          stores the attributenames gained from @link #addSelect(String, String, String, String, boolean, boolean)
 void addTempJoin(java.lang.String key1, java.lang.String key2, org.jdom.Element rel)
           
 boolean containsTable(java.lang.String table, java.lang.String alias)
           
 boolean getAddArchive()
           
 java.util.List getAttributes()
          returns a list of all attributes of this query
 int getConditionCount()
           
 java.lang.StringBuffer getConditionString()
           
protected  java.util.Map getCondNeedsParam()
           
 java.lang.String getDispStringForAttriubtes(org.jdom.Element attr, boolean addSortPattern)
          returns a displayname for the attribute
 java.lang.String getDispStringForConditions(org.jdom.Element c)
          returns a displayname for the condtion c
 java.util.Date getExecutionTime()
           
 ReportingExporter getExporter()
           
 java.lang.String getExportingParam(java.lang.String key)
           
 java.util.Map getExportingParams()
           
 java.lang.String getId()
           
 java.lang.String getMaxUnit()
           
 java.lang.String getMinUnit()
           
 java.lang.String getParam(java.lang.String key)
          Returns the parameter from Map... if param has several values, they are returned seperated by a semicolon
 java.util.Map getParamMap()
           
 java.lang.String getParamMask()
           
 java.util.Vector getSelectNamesOfAttribs(org.jdom.Element attribute)
           
 java.lang.String getSqlQueryString()
           
 com.groiss.reporting.StoredQuery getStoredQuery()
           
 TimeModel getTimemodel()
           
 java.lang.String getTitle()
           
 java.util.List getValues()
           
 org.jdom.Document getXMLDoc()
           
 boolean shallLockOperatorInParamMask()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Query

public Query(java.lang.String id,
             java.lang.String title,
             org.jdom.Document xml,
             java.util.Date execution,
             javax.servlet.http.HttpServletRequest req)
      throws java.lang.Exception
Parameters:
id -
title -
xml -
execution -
req - - the HttpServletRequest parameter Map is used for Query(String, String, Document, Date, Map)
Throws:
java.lang.Exception
See Also:
Query(String, String, Document, Date, Map)

Query

public Query(java.lang.String id,
             java.lang.String title,
             org.jdom.Document xml,
             java.util.Date execution,
             javax.servlet.http.HttpServletRequest req,
             com.groiss.reporting.StoredQuery q)
      throws java.lang.Exception
Throws:
java.lang.Exception

Query

public Query(java.lang.String id,
             java.lang.String title,
             org.jdom.Document xml,
             java.util.Date execution,
             java.util.Map paramMap)
      throws java.lang.Exception
Constructs a Query, builds the SQL Statement

Parameters:
id - - the id of query
title - - the query title
xml - - the xml documents descibing the query
execution - - the timestamp of execution
paramMap - - a map with parameters (e.g. params at execution), usually all request params are stored in this map
Throws:
java.lang.Exception

Query

public Query(java.lang.String id,
             java.lang.String title,
             org.jdom.Document xml,
             java.util.Date execution,
             java.util.Map paramMap,
             com.groiss.reporting.StoredQuery q)
      throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getXMLDoc

public org.jdom.Document getXMLDoc()
Returns:
the xml document describing this query

getId

public java.lang.String getId()
Returns:
the id of this query

getTimemodel

public TimeModel getTimemodel()
Returns:
the timemodel used by this query

getMaxUnit

public java.lang.String getMaxUnit()
Returns:
the max unit of timeintervals used in this query

getMinUnit

public java.lang.String getMinUnit()
Returns:
the min unit of timeintervals used in this query

getConditionCount

public int getConditionCount()
Returns:
the number of the current condition. is needed in ReportingData.addConditionToQuery(Query, Element) to gain the maybe already filled parameter at execution values from parametermap

getParamMap

public java.util.Map getParamMap()
Returns:
the Parameter Map of this query

getParam

public java.lang.String getParam(java.lang.String key)
Returns the parameter from Map... if param has several values, they are returned seperated by a semicolon

Parameters:
key - - the param name
Returns:
the Parameter

addSelect

public java.lang.String addSelect(java.lang.String tablename,
                                  java.lang.String selectAttribute,
                                  java.lang.String alias,
                                  java.lang.String selection,
                                  boolean addToGroupBy,
                                  boolean addAliasAsPrefix)
Adds a select Attribute to the query. Returns the attribut name for every select, bechaus if the similar select is required twice in query, it is selected only once.

Parameters:
tablename - - the tablename in database
selectAttribute - - the sql select statement
alias - - the used tablealias
selection - - an additional (additional to the selection defined in schema) selection to the table if needed
addToGroupBy - - false if sqlaggr is the selected aggregation. false otherwise
addAliasAsPrefix - - true if tablealias shoulb be added in front of selectAttribute. false otherwise
Returns:

addCondition

public void addCondition(java.lang.String tablename,
                         java.lang.String alias,
                         java.lang.String condition,
                         java.lang.String selection,
                         java.util.Vector condValues)
Parameters:
tablename - - the tablename in database
alias - - the used tablealias
condition - - the condition string
selection - - an additional (additional to the selection defined in schema) selection to the table if needed
condValues - - a vector with values for the prepared statement. There has to be an element in the vector for each ? in condition

addCondString

public void addCondString(java.lang.String condition)
adds a sql syntax fitting string to conditon (Warning: no join for this statement is done!)

Parameters:
condition - - the condition string

containsTable

public boolean containsTable(java.lang.String table,
                             java.lang.String alias)
Parameters:
table - - the tablename in database
alias - - the used tablealias
Returns:
true if table is already added with thos alias

addTempJoin

public void addTempJoin(java.lang.String key1,
                        java.lang.String key2,
                        org.jdom.Element rel)

getSqlQueryString

public java.lang.String getSqlQueryString()
Returns:
the sql query string

getValues

public java.util.List getValues()

getAttributes

public java.util.List getAttributes()
returns a list of all attributes of this query

Returns:
a list of DOM elements

getSelectNamesOfAttribs

public java.util.Vector getSelectNamesOfAttribs(org.jdom.Element attribute)
Parameters:
attribute - - the attribute
Returns:
a Vector of attribute names to read them from the ResultSet

addSelectNameOfAttrib

public void addSelectNameOfAttrib(org.jdom.Element attribute,
                                  java.lang.String name)
stores the attributenames gained from @link #addSelect(String, String, String, String, boolean, boolean)

Parameters:
attribute - - the attribute, which caused this select statement
name - - the attribute name in the sql query

getExecutionTime

public java.util.Date getExecutionTime()
Returns:
the timestamp of executing the query

getAddArchive

public boolean getAddArchive()
Returns:
true if query includes data from archive schema

getCondNeedsParam

protected java.util.Map getCondNeedsParam()
Returns:
a map with all conditions needing parameter at execution input

getConditionString

public java.lang.StringBuffer getConditionString()
Returns:
a string represanting the query's condtions.

getDispStringForAttriubtes

public java.lang.String getDispStringForAttriubtes(org.jdom.Element attr,
                                                   boolean addSortPattern)
returns a displayname for the attribute

Parameters:
attr - - attribute
addSortPattern - - if true the sortpaterns %ASC%, %DESC% and %NONE% are added to the displayname
Returns:
an I18N string for the attribute

getDispStringForConditions

public java.lang.String getDispStringForConditions(org.jdom.Element c)
returns a displayname for the condtion c

Parameters:
c - - condition
Returns:
an I18N string for the condition

getExporter

public ReportingExporter getExporter()
Returns:
the exporter object of this query

getExportingParams

public java.util.Map getExportingParams()
Returns:
a map with key value pairs as defined in query xml

getExportingParam

public java.lang.String getExportingParam(java.lang.String key)
Parameters:
key - - the name of the exorting parameter
Returns:
the valuo of this parameter

getTitle

public java.lang.String getTitle()
Returns:
the I18N keys of the title of this query

addRowNumber

public boolean addRowNumber()
Returns:
true if report should include row number

getParamMask

public java.lang.String getParamMask()

getStoredQuery

public com.groiss.reporting.StoredQuery getStoredQuery()

addConnector

public void addConnector(java.lang.String connector)

shallLockOperatorInParamMask

public boolean shallLockOperatorInParamMask()

addOrderByForAggregateValueData

public void addOrderByForAggregateValueData(java.lang.String att)


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.