3.1.2: 2012-07-31

net.sf.basedb.core
Class DynamicReporterQuery

java.lang.Object
  extended by net.sf.basedb.core.AbstractQuery
      extended by net.sf.basedb.core.AbstractSqlQuery
          extended by 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: 2011-12-02 12:09:46 +0100 (Fri, 02 Dec 2011) $

Nested Class Summary
(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
private  boolean hasClonedReporters
           
private  Set<Object> joinedItems
           
private  String rootAlias
           
private  boolean useClonedReporters
           
private  VirtualDb virtualDb
           
 
Constructor Summary
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
(package private)  Select[] getDefaultSelects()
          No default selection.
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 a ReporterList
 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
bindLimits, closeResultSet, closeStatement, count, getQueryType, iterate, parseParameters, releaseSavepoint, rollbackToSavepoint, setParameters
 
Methods inherited from class net.sf.basedb.core.AbstractQuery
addAutoJoiner, getCountQuery, getFirstResult, 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
 

Field Detail

rootAlias

private final String rootAlias

virtualDb

private final VirtualDb virtualDb

hasClonedReporters

private final boolean hasClonedReporters

useClonedReporters

private boolean useClonedReporters

joinedItems

private Set<Object> joinedItems
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 interface Query
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 to Query.reset() would unlock the query and allow it to be modified again.

Specified by:
isReadonly in interface Query
Overrides:
isReadonly in class AbstractQuery
Returns:
TRUE if the query is readonly, FALSE otherwise

getDefaultSelects

Select[] getDefaultSelects()
No default selection.

Specified by:
getDefaultSelects in class AbstractSqlQuery

hasClonedReporters

public boolean hasClonedReporters()
Check if the virtual database that this query is using has cloned reporter annotations or not.

Specified by:
hasClonedReporters in interface ClonableReporterQuery
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 interface ClonableReporterQuery
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 interface ClonableReporterQuery
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 interface ClonableReporterQuery
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 a ReporterList

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 is JoinType.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

3.1.2: 2012-07-31