Package net.sf.basedb.core
Class Reporter
java.lang.Object
net.sf.basedb.core.Reporter
This is an utilitiy class for reporters.
- Version:
- 2.0
- Author:
- Samuel, Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReporterData
getByExternalId
(DbControl dc, String externalId) Get aReporterData
object when you know the external id.static ReporterData
getByExternalId
(DbControl dc, String externalId, Experiment experiment) Get aReporterData
object when you know the external id, possibly using the cloned reporter annotations of the given experiment.static ReporterData
Get aReporterData
object when you know the ID.static ReporterData
getById
(DbControl dc, int id, Experiment experiment) Get aReporterData
object when you know the ID, possibly using the cloned reporter annotations of the given experiment.private static String
Generate an SQL statement for selecting ALL reporter properties from a cloned table.static DynamicReporterQuery
Get a dynamic query object configured to retrieve reporter information.static DynamicReporterQuery
getDynamicQuery
(Experiment experiment) Get a dynamic query object configured to retrieve reporter information from either the master reporter table or a cloned reporter table in the given experiment.static ReporterData
Get a new instance of a reporter, and setting the external ID.static ReporterData
getProxy
(int reporterId) Get a proxy reporter object.static DataQuery<ReporterData>
getQuery()
Get a query object configured to retrieve reporters.static ReporterType
getReporterType
(DbControl dc, ReporterData reporter) Get the reporter type item from a reporter data object.static void
setReporterType
(ReporterData reporter, ReporterType reporterType) Set the reporter type on a reporter data object.
-
Field Details
-
metaData
-
-
Constructor Details
-
Reporter
public Reporter()
-
-
Method Details
-
getNew
Get a new instance of a reporter, and setting the external ID. The external ID has to be unique for the reporters in the system.- Parameters:
externalId
- The external id of the new reporter- Returns:
- A new instance of a
ReporterData
class - Throws:
InvalidDataException
- If the external id is nullBaseException
- If there is some other error.
-
getById
public static ReporterData getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aReporterData
object when you know the ID.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.id
- The ID of the item to load.- Returns:
- The
ReporterData
object. - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
getById
Get aReporterData
object when you know the ID, possibly using the cloned reporter annotations of the given experiment. If the experiment doesn't have cloned reporter information this method is the same asgetById(DbControl, int)
. If the experiment has cloned information, all non-cloned properties are set to null.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessid
- The ID of the reporterexperiment
- The experiment which may have cloned reporter information- Returns:
- The
ReporterData
object - Since:
- 3.1
-
getByExternalId
public static ReporterData getByExternalId(DbControl dc, String externalId) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aReporterData
object when you know the external id. Use this method only when you need to get a few reporters. If you need to get many reporter use theReporterBatcher.getByExternalId(String)
method instead. It has better performance since it resuses a single query instead of creating a new one each time as this method does.- Parameters:
dc
- TheDbControl
which will be used for database access.externalId
- The external id of the reporter to load.- Returns:
- The
ReporterData
object. - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
getByExternalId
Get aReporterData
object when you know the external id, possibly using the cloned reporter annotations of the given experiment. If the experiment doesn't have cloned reporter information this method is the same asgetByExternalId(DbControl, String)
. If the experiment has cloned information, all non-cloned properties are set to null.Use this method only when you need to get a few reporters. If you need to get many reporters use a query from the
getDynamicQuery(Experiment)
method instead. It has better performance since it resuses a single query instead of creating a new one each time as this method does.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessexternalId
- The external id of the reporterexperiment
- The experiment which may have cloned reporter information- Returns:
- The
ReporterData
object - Since:
- 3.1
-
getProxy
Get a proxy reporter object. This method is usefult when linking reporters to other items, and you are sure that a reporter with the given ID exists. Since this method doesn't hit the database, there are some things to be aware of:- There is no check to see if a reporter with the given ID exists or not
- The returned object doesn't contain any reporter information except the ID.
- Parameters:
reporterId
- The ID of the reporter- Returns:
- A reporter object
- Since:
- 2.8
-
getQuery
Get a query object configured to retrieve reporters.- Returns:
- A
DataQuery
object
-
getDynamicQuery
Get a dynamic query object configured to retrieve reporter information. You must add columns/expressions to select withQuery.select(net.sf.basedb.core.query.Select)
- Returns:
- A
DynamicReporterQuery
object - Since:
- 2.4
-
getDynamicQuery
Get a dynamic query object configured to retrieve reporter information from either the master reporter table or a cloned reporter table in the given experiment. You must add columns/expressions to select withQuery.select(net.sf.basedb.core.query.Select)
- Returns:
- A
DynamicReporterQuery
object - Since:
- 3.1
-
getReporterType
public static ReporterType getReporterType(DbControl dc, ReporterData reporter) throws PermissionDeniedException, BaseException Get the reporter type item from a reporter data object.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.reporter
- The reporter to get the reporter type data for.- Returns:
- A
ReporterType
object. - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
setReporterType
public static void setReporterType(ReporterData reporter, ReporterType reporterType) throws PermissionDeniedException, BaseException Set the reporter type on a reporter data object. The reporter must be passed toBasicBatcher.update(net.sf.basedb.core.data.BatchableData)
for the changes to be saved in the database.- Parameters:
reporter
- The reporter data objectreporterType
- The new reporter type or null- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission on the reporter typeBaseException
- If there is another error
-
getClonedSelectSql
Generate an SQL statement for selecting ALL reporter properties from a cloned table. Properties that have not been cloned should be included as 'null' selects.
-