Package net.sf.basedb.core
Class DynamicReporterQuery
- java.lang.Object
-
- net.sf.basedb.core.AbstractQuery
-
- net.sf.basedb.core.AbstractSqlQuery
-
- net.sf.basedb.core.DynamicReporterQuery
-
- All Implemented Interfaces:
ClonableReporterQuery
,Query
,SqlQuery
public class DynamicReporterQuery extends AbstractSqlQuery implements ClonableReporterQuery
Represents a query for reporter data in a "dynamic" way. The main difference from a client applications point of view, is that it is possible to specify which columns that should be selected. In a techinical point of view the difference is that we are using SQL instead of HQl.- Version:
- 2.4
- Author:
- Nicklas
- See Also:
Reporter.getDynamicQuery()
- Last modified
- $Date: 2017-12-08 14:18:12 +0100 (fr, 08 dec 2017) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
DynamicReporterQuery.MasterReporterJoiner
Auto joiner for master reporter table.(package private) static class
DynamicReporterQuery.ReporterListJoiner
Auto joiner for reporter lists.-
Nested classes/interfaces inherited from class net.sf.basedb.core.AbstractSqlQuery
AbstractSqlQuery.CountWork
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
hasClonedReporters
private Set<Object>
joinedItems
private String
rootAlias
private boolean
useClonedReporters
private VirtualDb
virtualDb
-
Constructor Summary
Constructors Constructor Description DynamicReporterQuery()
Create a new dynamic query for reporter data.DynamicReporterQuery(VirtualDb vdb)
Create a new dynamic query for reporter data using cloned reporter information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) Select[]
getDefaultSelects()
No default selection.JepFunction[]
getJepFunctions(DbControl dc, boolean restrictions)
The following JEP functions can be used: rep(property):ReporterFunction
mrep(property):ReporterFunction
(only for cloned reporters) inList(reporter-list-id):InReporterListFunction
(only if restrictions=true) notInList(reporter-list-id):NotInReporterListFunction
(only if restrictions=true)static DynamicReporterQuery.MasterReporterJoiner
getMasterReporterJoiner(JoinType joinType)
Get a joiner instance for joining the master reporter table when the root query is against the cloned reporters table.static DynamicReporterQuery.ReporterListJoiner
getReporterListJoiner(JoinType joinType)
Get a joiner instance for reporter lists for the specified join type.String
getRootAlias()
The alias of the item that is returned by this query.VirtualDb
getVirtualDb()
Get the virtual database that this query is using.boolean
hasClonedReporters()
Check if the virtual database that this query is using has cloned reporter annotations or not.boolean
isReadonly()
If this query is readonly and cannot be structurally modified.void
joinMasterReporters(JoinType joinType)
Join the master reporter table into this query.void
joinReporterList(ReporterList reporterList, JoinType joinType)
Makes a join with aReporterList
void
setAutoJoinType(JoinType joinType)
Specify the join type of automatic joins.void
setUseClonedReporters(boolean useClonedReporters)
Set if cloned reporters should be used by default or not.boolean
useClonedReporters()
Checks if this query is using cloned reporter or not by default.-
Methods inherited from class net.sf.basedb.core.AbstractSqlQuery
closeResultSet, closeStatement, count, getLimitHandler, getQueryType, getRowSelectionForLimitHandler, iterate, parseParameters, releaseSavepoint, rollbackToSavepoint, setParameters
-
Methods inherited from class net.sf.basedb.core.AbstractQuery
addAutoJoiner, getCountQuery, getFirstResult, getIdQuery, getMainQuery, getMaxResults, getParameterNames, getParameters, getParameterType, getParameterValue, getPermanentSelects, getQueryParameter, getQuerySection, getSelects, group, groupPermanent, hasParameterValue, having, havingPermanent, isCounting, isDistinct, isFailSafe, isReturningTotalCount, join, joinPermanent, order, orderPermanent, postProcessQuery, reset, resetTemporary, restrict, restrictPermanent, select, selectPermanent, setCounting, setDistinct, setFailSafe, setFirstResult, setMaxResults, setParameter, setPermanentParameter, setReturnTotalCount, temporaryJoin, temporarySelect, toQl, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.basedb.core.query.Query
addAutoJoiner, getFirstResult, getMaxResults, getParameterNames, getQueryParameter, getQuerySection, group, groupPermanent, hasParameterValue, having, havingPermanent, isCounting, isDistinct, isFailSafe, isReturningTotalCount, join, joinPermanent, order, orderPermanent, reset, restrict, restrictPermanent, select, selectPermanent, setDistinct, setFailSafe, setFirstResult, setMaxResults, setParameter, setPermanentParameter, setReturnTotalCount, toQl
-
-
-
-
Constructor Detail
-
DynamicReporterQuery
DynamicReporterQuery()
Create a new dynamic query for reporter data.
-
DynamicReporterQuery
DynamicReporterQuery(VirtualDb vdb)
Create a new dynamic query for reporter data using cloned reporter information.- Since:
- 3.1
-
-
Method Detail
-
getRootAlias
public String getRootAlias()
The alias of the item that is returned by this query.- Specified by:
getRootAlias
in interfaceQuery
- See Also:
Item.getAlias()
-
isReadonly
public boolean isReadonly()
Description copied from interface:Query
If this query is readonly and cannot be structurally modified. Ie. no more query elements can be added. It is still possible to set parameter values. A call toQuery.reset()
would unlock the query and allow it to be modified again.- Specified by:
isReadonly
in interfaceQuery
- Overrides:
isReadonly
in classAbstractQuery
- Returns:
- TRUE if the query is readonly, FALSE otherwise
-
getDefaultSelects
Select[] getDefaultSelects()
No default selection.- Specified by:
getDefaultSelects
in classAbstractSqlQuery
-
getJepFunctions
public JepFunction[] getJepFunctions(DbControl dc, boolean restrictions)
The following JEP functions can be used:- rep(property):
ReporterFunction
- mrep(property):
ReporterFunction
(only for cloned reporters) - inList(reporter-list-id):
InReporterListFunction
(only if restrictions=true) - notInList(reporter-list-id):
NotInReporterListFunction
(only if restrictions=true)
- Specified by:
getJepFunctions
in classAbstractSqlQuery
restrictions
- If FALSE the metod should only return functions that can be used asExpression
:s, otherwise it should return both expression and restriction functions- Since:
- 3.12
- rep(property):
-
hasClonedReporters
public boolean hasClonedReporters()
Check if the virtual database that this query is using has cloned reporter annotations or not.- Specified by:
hasClonedReporters
in interfaceClonableReporterQuery
- Since:
- 3.1
-
useClonedReporters
public boolean useClonedReporters()
Checks if this query is using cloned reporter or not by default. The default setting is to use cloned reporters if they are available in the experiment.- Specified by:
useClonedReporters
in interfaceClonableReporterQuery
- Returns:
- TRUE if this query is using cloned reporters, FALSE if not
- Since:
- 3.1
-
setUseClonedReporters
public void setUseClonedReporters(boolean useClonedReporters)
Set if cloned reporters should be used by default or not.- Specified by:
setUseClonedReporters
in interfaceClonableReporterQuery
- Parameters:
useClonedReporters
- TRUE to use cloned reporters by default, FALSE to use the master reporters- Since:
- 3.1
-
getVirtualDb
public VirtualDb getVirtualDb()
Get the virtual database that this query is using.- Specified by:
getVirtualDb
in interfaceClonableReporterQuery
- Returns:
- A virtual database item (can be null if hasClonedReporter is false)
- Since:
- 3.1
-
joinReporterList
public void joinReporterList(ReporterList reporterList, JoinType joinType)
Makes a join with aReporterList
- Parameters:
reporterList
- To do the join on.joinType
- The join type to use.- Since:
- 3.0
- See Also:
JoinType
-
joinMasterReporters
public void joinMasterReporters(JoinType joinType)
Join the master reporter table into this query. This is ignored unless the query rooted at the cloned reporters table.- Parameters:
joinType
- The join type to use- Since:
- 3.1
-
setAutoJoinType
public void setAutoJoinType(JoinType joinType)
Specify the join type of automatic joins. The default join type isJoinType.LEFT
. This setting doesn't affect joins that has been made directly to the query.- Parameters:
joinType
- The type of the automatic joins- Since:
- 3.0
-
getReporterListJoiner
public static DynamicReporterQuery.ReporterListJoiner getReporterListJoiner(JoinType joinType)
Get a joiner instance for reporter lists for the specified join type.- Parameters:
joinType
- The type of join- Since:
- 3.0
-
getMasterReporterJoiner
public static DynamicReporterQuery.MasterReporterJoiner getMasterReporterJoiner(JoinType joinType)
Get a joiner instance for joining the master reporter table when the root query is against the cloned reporters table.- Parameters:
joinType
- The type of join- Since:
- 3.1
-
-