org.squashtest.csp.tm.domain.report
Class Report

java.lang.Object
  extended by org.squashtest.csp.tm.domain.report.Report
Direct Known Subclasses:
ReportExecutionProgressFollowUp, ReportRequirementCoverageByTests

public abstract class Report
extends Object

A Report is functionally the main concept of the Report API. However it's not exactly the most technical hard to implement. A Report belongs to a ReportCategory, to which it must register to (more on that later), and is of a ReportType. Let's repeat it again, a Report should be a bean, a singleton A Report have a name and a description. The name is, like some other entities of this package, a key that will be searched for in a MessageSource. A Report is registered to a ReportCategory, is of a ReportType, and must be provided with a ReportQueryFactory (that will generate a query corresponding to fill that Report).

FIXME In this version the description is not yet localized.

Implementing a Report :


To implement a report you need :

You may also set a particular ReportQueryFactory at constructor time but you also can let it injected via the IoC engine (if you have one).

Likewise, you can set up its view catalog at construction time.

NOTE : the reason why you need to implement the setReportCategory() and setReportType() is that you may then add an @Resource annotation on it. The container will this automagically call the setter at construction time and will feed it with the resource you named (the real instances of ReportType or ReportCategory)

Author:
bsiri

Field Summary
protected  ReportQueryFactory queryFactory
           
protected  ReportCategory reportCategory
           
protected  ReportType reportType
           
protected  String resourceKeyDescription
           
protected  String resourceKeyName
           
protected  ReportViewCatalog viewCatalog
           
 
Constructor Summary
Report()
           
 
Method Summary
 ReportQuery createReportQuery()
          This method is simply a wrapper that will call makeReportQuery() of the ReportQueryFactory
 Integer getId()
           
 ReportQueryFactory getQueryFactory()
           
 ReportCategory getReportCategory()
           
 ReportType getReportType()
           
 String getResourceKeyDescription()
           
 String getResourceKeyName()
           
 ReportViewCatalog getViewCatalog()
           
 void setQueryFactory(ReportQueryFactory queryFactory)
           
protected abstract  void setReportCategory(ReportCategory reportCategory)
          will set the ReportCategory for this report.
protected abstract  void setReportType(ReportType reportType)
          will set the ReportType for this report.
protected  void setResourceKeyDescription(String resourceKeyDescription)
          Best called at construction time (it's protected).
protected  void setResourceKeyName(String resourceKeyName)
          Best called at construction time (it's protected)
protected  void setViewCatalog(ReportViewCatalog viewCatalog)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reportType

protected ReportType reportType

resourceKeyName

protected String resourceKeyName

resourceKeyDescription

protected String resourceKeyDescription

reportCategory

protected ReportCategory reportCategory

queryFactory

protected ReportQueryFactory queryFactory

viewCatalog

protected ReportViewCatalog viewCatalog
Constructor Detail

Report

public Report()
Method Detail

getId

public Integer getId()
Returns:
the id of this Report.

getReportType

public ReportType getReportType()
Returns:
the ReportType instance to which this Report is assigned.

getReportCategory

public ReportCategory getReportCategory()
Returns:
the ReportCategory instance to which this Report is assigned.

getResourceKeyName

public String getResourceKeyName()
Returns:
the name of this Report as a key for a MessageSource.

setResourceKeyName

protected void setResourceKeyName(String resourceKeyName)
Best called at construction time (it's protected)

Parameters:
resourceKeyName - the key corresponding to that Report in the MessageSource.

getResourceKeyDescription

public String getResourceKeyDescription()
Returns:
the description of this Report as a key for a MessageSource.

setResourceKeyDescription

protected void setResourceKeyDescription(String resourceKeyDescription)
Best called at construction time (it's protected).

Parameters:
resourceKeyDescription - the key corresponding to that description in the MessageSource.

getQueryFactory

public ReportQueryFactory getQueryFactory()
Returns:
the ReportQueryFactory instance that had been assigned to that Report.

setQueryFactory

public void setQueryFactory(ReportQueryFactory queryFactory)
Parameters:
queryFactory - the ReportQueryFactory being assigned to that Report.

createReportQuery

public ReportQuery createReportQuery()
This method is simply a wrapper that will call makeReportQuery() of the ReportQueryFactory

Returns:
the ReportQuery corresponding to that Report.

setViewCatalog

protected void setViewCatalog(ReportViewCatalog viewCatalog)

getViewCatalog

public ReportViewCatalog getViewCatalog()

setReportType

protected abstract void setReportType(ReportType reportType)
will set the ReportType for this report.


setReportCategory

protected abstract void setReportCategory(ReportCategory reportCategory)
will set the ReportCategory for this report. It also must call the ReportCategory.addReport() in order to get itself registered.



Copyright © 2010-2012 Squashtest TM, Squashtest.org. All Rights Reserved.