Class Reporter

java.lang.Object
net.sf.basedb.core.Reporter

public class Reporter
extends Object
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 Details

  • Constructor Details

    • Reporter

      public Reporter()
  • Method Details

    • getNew

      public static ReporterData getNew​(String externalId) throws InvalidDataException, BaseException
      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 null
      BaseException - If there is some other error.
    • getById

      public static ReporterData getById​(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
      Get a ReporterData object when you know the ID.
      Parameters:
      dc - The DbControl 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 found
      PermissionDeniedException - If the logged in user doesn't have read permission to the item
      BaseException - If there is another error
    • getById

      public static ReporterData getById​(DbControl dc, int id, Experiment experiment)
      Get a ReporterData 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 as getById(DbControl, int). If the experiment has cloned information, all non-cloned properties are set to null.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      id - The ID of the reporter
      experiment - 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 a ReporterData 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 the ReporterBatcher.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 - The DbControl 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 found
      PermissionDeniedException - If the logged in user doesn't have read permission to the item
      BaseException - If there is another error
    • getByExternalId

      public static ReporterData getByExternalId​(DbControl dc, String externalId, Experiment experiment)
      Get a ReporterData 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 as getByExternalId(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 - The DbControl which will be used for permission checking and database access
      externalId - The external id of the reporter
      experiment - The experiment which may have cloned reporter information
      Returns:
      The ReporterData object
      Since:
      3.1
    • getProxy

      public static ReporterData getProxy​(int reporterId)
      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

      public static DataQuery<ReporterData> getQuery()
      Get a query object configured to retrieve reporters.
      Returns:
      A DataQuery object
    • getDynamicQuery

      public static DynamicReporterQuery getDynamicQuery()
      Get a dynamic query object configured to retrieve reporter information. You must add columns/expressions to select with Query.select(net.sf.basedb.core.query.Select)
      Returns:
      A DynamicReporterQuery object
      Since:
      2.4
    • getDynamicQuery

      public 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. You must add columns/expressions to select with Query.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 - The DbControl 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 item
      BaseException - 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 to BasicBatcher.update(net.sf.basedb.core.data.BatchableData) for the changes to be saved in the database.
      Parameters:
      reporter - The reporter data object
      reporterType - The new reporter type or null
      Throws:
      PermissionDeniedException - If the logged in user doesn't have use permission on the reporter type
      BaseException - If there is another error
    • getClonedSelectSql

      private static String getClonedSelectSql​(VirtualDb vdb)
      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.