2.17.2: 2011-06-17

net.sf.basedb.core
Class Reporter

java.lang.Object
  extended by 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: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
private static org.hibernate.metadata.ClassMetadata metaData
           
 
Constructor Summary
Reporter()
           
 
Method Summary
static ReporterData getByExternalId(DbControl dc, String externalId)
          Get a ReporterData object when you know the external id.
static ReporterData getById(DbControl dc, int id)
          Get a ReporterData object when you know the ID.
static DynamicReporterQuery getDynamicQuery()
          Get a dynamic query object configured to retrieve reporter information.
static ReporterData getNew(String externalId)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metaData

private static org.hibernate.metadata.ClassMetadata metaData
Constructor Detail

Reporter

public Reporter()
Method Detail

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

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

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:

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

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

2.17.2: 2011-06-17