public class Query extends Object
Modifier and Type | Field and Description |
---|---|
static List<Pair<String,String>> |
ARETH_OPERATORS |
static List<Pair<String,String>> |
DATE_OPERATORS |
static Pair<String,String> |
EMPTY_OPERATOR |
static List<Pair<String,String>> |
NULL_OPERATORS |
static List<Pair<String,String>> |
SET_OPERATORS |
static List<Pair<String,String>> |
STRING_OPERATORS |
Constructor and Description |
---|
Query(Report q,
Map<String,String[]> paramMap)
Constructs q query for internal use
|
Query(String id,
String title,
Document xml,
Date execution,
HttpServletRequest req) |
Query(String id,
String title,
Document xml,
Date execution,
HttpServletRequest req,
Report sq) |
Query(String id,
String title,
Document xml,
Date execution,
Map<String,String[]> paramMap,
Report q)
Constructs a Query, builds the SQL Statement
|
Query(String id,
String title,
Document xml,
Date execution,
Map<String,String[]> paramMap,
Report q,
boolean doSQLInit) |
Modifier and Type | Method and Description |
---|---|
void |
addCondition(String tablename,
String alias,
String condition,
String selection,
List<?> condValues)
Add a condition to the query
|
void |
addCondition(String condId,
String tablename,
String alias,
String condition,
String selection,
List<?> condValues)
Add a condition to the query
|
void |
addCondition(String condId,
String tablename,
String alias,
String attrib,
String condition,
String selection,
List<?> condValues)
Add a condition to the query
|
void |
addConditionForAttrib(String tablename,
String alias,
String attrib,
String condition,
String selection,
List<?> condValues)
Add a condition to the query
|
protected void |
addConditions(Element cond) |
void |
addOrderByForAggregateValueData(Integer att)
use this method to order resultset to calculate AggregateValue Types correctly
|
void |
addOrderByForAggregateValueData(String att)
Deprecated.
since 9.0.18429 use
addOrderByForAggregateValueData(Integer) instead |
void |
addPermissionRelevantAttribute(Element e) |
boolean |
addRowNumber() |
int |
addSelect(String tablename,
String selectAttribute,
String alias,
String selection,
boolean addToGroupBy,
boolean addAliasAsPrefix)
Adds a select Attribute to the query.
|
void |
addSelectIndexOfAttrib(Element attribute,
int name)
stores the attributenames gained from
addSelect(String, String, String, String, boolean, boolean) |
void |
addSelectNameOfAttrib(Element attribute,
String name)
Deprecated.
since 9.0.18429 use
addSelectIndexOfAttrib(Element, int) instead |
void |
addTempJoin(String key1,
String key2,
Element rel) |
protected void |
buildSQLStatement() |
boolean |
containsTable(String table,
String alias) |
boolean |
finishedParamMask() |
boolean |
getAddArchive() |
List<Element> |
getAttributes()
returns a list of all attributes of this query
|
String |
getAttributeValue(Element e,
String attribute)
get the attribute-value from a query.xml element
|
int |
getCondCountWithParams() |
int |
getConditionCount()
get 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 |
List<Pair<String,List<?>>> |
getConditions(String attribute)
get a list of values that will be bound to the specified attribute (tablename.alias.attribute)
|
StringBuilder |
getConditionString() |
Map<Integer,Element> |
getCondNeedsParam() |
String |
getDisplayStringForAttribute(Element attr,
boolean addSortPattern)
returns a displayname for the attribute
|
String |
getDispStringForAttriubtes(Element attr,
boolean addSortPattern)
Deprecated.
due to a typo in the method-name
|
String |
getDispStringForConditions(Element c)
returns a displayname for the condtion c
|
Date |
getExecutionTime()
the execution timestamp of the query
|
ReportingExporter |
getExporter() |
static Pair<ReportingExporter,Map<String,String>> |
getExporterInfos(Document xml)
get Exportinginformation from xml-document
|
String |
getExportingParam(String key) |
String |
getId()
returns the id of this query
|
String |
getLocale() |
protected int |
getMaxTableResult() |
String |
getMaxUnit()
get the max unit of timeintervals used in this query
|
String |
getMinUnit()
get the min unit of timeintervals used in this query
|
String |
getParam(String key)
Returns the parameter from Map... if param has several values, they are returned seperated by a semicolon
|
Map<String,? extends Object> |
getParamMap()
get the Parameter Map of this query
|
String |
getParamMask() |
List<Element> |
getPermissionRelevantAttributes() |
Map<String,String> |
getQueryInformations() |
String |
getQueryPlan() |
ReportingData |
getReportingDataInstance(Element attr) |
protected static Map<String,String[]> |
getReqParamMap(HttpServletRequest req) |
Resource |
getResource() |
ResultModifier |
getResultModifier() |
Report |
getRootStoredQuery() |
List<Integer> |
getSelectIndexOfAttribs(Element attribute) |
List<String> |
getSelectNamesOfAttribs(Element attribute)
Deprecated.
since 9.0.18429 use
getSelectIndexOfAttribs(Element) instead |
String |
getSqlQueryString()
get the sql query string
|
MultiMap<String,String> |
getTableAndAliases() |
TimeModel |
getTimemodel()
get the timemodel used by this query
|
String |
getTimezone() |
String |
getTitle() |
List<Object> |
getValues()
get a List of values of the prepared statement
|
List<Object> |
getValues(String attribute)
get a list of values that will be bound to the specified attribute (tablename.alias.attribute)
|
Document |
getXMLDoc()
returns the xml document describing this query
|
static boolean |
isAttributeTypeClob(Entity e,
Attribute a) |
protected boolean |
isDistinct() |
protected boolean |
isExecutable() |
String |
lockOperatorInParamMaskMode() |
boolean |
queryHasClobSelects() |
void |
setExportingParam(String key,
String value) |
protected void |
setQueryPlan(String queryPlan) |
void |
setTitle(String title)
Set the displayed title of the query
|
boolean |
shallLockOperatorInParamMask() |
String[] |
splitIntoTableAndAlias(String key) |
public Query(String id, String title, Document xml, Date execution, HttpServletRequest req)
id
- the id of the querytitle
- the title to show in resultxml
- the xml document defining the reportexecution
- timestamp which is taken as execution time to calculate time intevalsreq
- - the HttpServletRequest parameter Map is used for Query(String, String, Document, Date, Map, Report)
Query(String, String, Document, Date, Map, Report)
public Query(String id, String title, Document xml, Date execution, HttpServletRequest req, Report sq)
id
- the id of the querytitle
- the title to show in resultxml
- the xml document defining the reportexecution
- timestamp which is taken as execution time to calculate time intevalsreq
- the HttpServletRequest parameter Map is used for Query(String, String, Document, Date, Map, Report)
sq
- the storedquery object defining this reportQuery(String, String, Document, Date, Map, Report)
public Query(Report q, Map<String,String[]> paramMap)
q
- the StoredQueryparamMap
- a map of parameters to execute the querypublic Query(String id, String title, Document xml, Date execution, Map<String,String[]> paramMap, Report q)
id
- the id of querytitle
- the query titlexml
- the xml documents descibing the queryexecution
- the timestamp of executionparamMap
- a map with parameters (e.g. params at execution), usually all request params are stored in this mappublic Document getXMLDoc()
public String getId()
public TimeModel getTimemodel()
public String getMaxUnit()
public String getMinUnit()
public int getConditionCount()
ReportingData.addConditionToQuery(Query, Element)
to gain the maybe already filled parameter at execution values from parametermappublic String getParam(String key)
key
- - the param nameprotected void addConditions(Element cond)
public int addSelect(String tablename, String selectAttribute, String alias, String selection, boolean addToGroupBy, boolean addAliasAsPrefix)
tablename
- - the tablename in databaseselectAttribute
- - the sql select statementalias
- - the used tablealiasselection
- - an additional (additional to the selection defined in schema) selection to the table if neededaddToGroupBy
- - false
if sqlaggr is the selected aggregation. false
otherwiseaddAliasAsPrefix
- - true
if tablealias shoulb be added in front of selectAttribute. false
otherwisepublic void addCondition(String tablename, String alias, String condition, String selection, List<?> condValues)
tablename
- - the tablename in databasealias
- - the used tablealiascondition
- - the condition stringselection
- - an additional (additional to the selection defined in schema) selection to the table if neededcondValues
- - a vector with values for the prepared statement. There has to be an element in the vector for each ?
in conditionpublic void addConditionForAttrib(String tablename, String alias, String attrib, String condition, String selection, List<?> condValues)
tablename
- - the tablename in databasealias
- - the used tablealiascondition
- - the condition stringselection
- - an additional (additional to the selection defined in schema) selection to the table if neededcondValues
- - a vector with values for the prepared statement. There has to be an element in the vector for each ?
in conditionpublic void addCondition(String condId, String tablename, String alias, String condition, String selection, List<?> condValues)
condId
- - conditionIdtablename
- - the tablename in databasealias
- - the used tablealiascondition
- - the condition stringselection
- - an additional (additional to the selection defined in schema) selection to the table if neededcondValues
- - a vector with values for the prepared statement. There has to be an element in the vector for each ?
in conditionpublic void addCondition(String condId, String tablename, String alias, String attrib, String condition, String selection, List<?> condValues)
condId
- - conditionIdtablename
- - the tablename in databasealias
- - the used tablealiascondition
- - the condition stringselection
- - an additional (additional to the selection defined in schema) selection to the table if neededcondValues
- - a vector with values for the prepared statement. There has to be an element in the vector for each ?
in condition@Deprecated public void addOrderByForAggregateValueData(String att)
addOrderByForAggregateValueData(Integer)
insteadpublic void addOrderByForAggregateValueData(Integer att)
public boolean containsTable(String table, String alias)
table
- - the tablename in databasealias
- - the used tablealiastrue
if table is already added with thos aliaspublic String getSqlQueryString()
public String getQueryPlan()
protected void setQueryPlan(String queryPlan)
public List<Object> getValues(String attribute)
attribute
- public List<Pair<String,List<?>>> getConditions(String attribute)
attribute
- public List<Element> getAttributes()
public List<Integer> getSelectIndexOfAttribs(Element attribute)
attribute
- - the attribute@Deprecated public List<String> getSelectNamesOfAttribs(Element attribute)
getSelectIndexOfAttribs(Element)
insteadattribute
- - the attribute@Deprecated public void addSelectNameOfAttrib(Element attribute, String name)
addSelectIndexOfAttrib(Element, int)
insteadaddSelect(String, String, String, String, boolean, boolean)
attribute
- - the attribute, which caused this select statementname
- - the attribute name in the sql querypublic void addSelectIndexOfAttrib(Element attribute, int name)
addSelect(String, String, String, String, boolean, boolean)
attribute
- - the attribute, which caused this select statementname
- - the attribute index in the sql queryprotected void buildSQLStatement()
public Date getExecutionTime()
public boolean getAddArchive()
true
if query includes data from archive schemapublic Map<Integer,Element> getCondNeedsParam()
public StringBuilder getConditionString()
@Deprecated public final String getDispStringForAttriubtes(Element attr, boolean addSortPattern)
attr
- addSortPattern
- getDisplayStringForAttribute(Element, boolean)
public String getDisplayStringForAttribute(Element attr, boolean addSortPattern)
attr
- - attributeaddSortPattern
- - if true
the sortpaterns %ASC%, %DESC% and %NONE%
are added to the displaynamepublic String getDispStringForConditions(Element c)
c
- - conditionpublic ReportingExporter getExporter()
public String getExportingParam(String key)
key
- - the name of the exporting parameterpublic static Pair<ReportingExporter,Map<String,String>> getExporterInfos(Document xml)
xml
- public String getAttributeValue(Element e, String attribute)
e
- the element (attribute, condition,...)attribute
- the attribute-idpublic String getTitle()
protected boolean isExecutable()
true
if query is already executeable...protected boolean isDistinct()
true
if query does not display equal rows twice...protected static Map<String,String[]> getReqParamMap(HttpServletRequest req)
public boolean addRowNumber()
true
if report should include row numberspublic String getParamMask()
public int getCondCountWithParams()
public String lockOperatorInParamMaskMode()
TRUE
if operator shall be readonly in parammask
HIDE
if operator shall be hidden in parammask
FALSE
otherwisepublic boolean shallLockOperatorInParamMask()
true
if operator shall be readonly in parammaskpublic String getTimezone()
public String getLocale()
public Resource getResource()
public void setTitle(String title)
title
- - the title string. this String is given to Resource.localize of the Query, so you may use I18N Keys.public boolean queryHasClobSelects()
protected int getMaxTableResult()
public Map<String,String> getQueryInformations()
public ResultModifier getResultModifier()
public Report getRootStoredQuery()
public boolean finishedParamMask()
public ReportingData getReportingDataInstance(Element attr)
attr
- public void addPermissionRelevantAttribute(Element e)
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.