|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.squashtest.csp.tm.domain.report.ReportFactory
public final class ReportFactory
This class is the front-end to which a service needs to talk to register or find a report category. You can basically think of it like for a repository, except that it doesn't read the ReportCategories and Reports directly, something else must load them then register them against the ReportFactory. Each ReportCategory and Report, once registered, are assigned an id. The user can query for a specific ReportCategory or Report based on its id, or get the whole list on demand. More about the id later. This singleton factory manages ReportCategories just like the ReportCategories manage the Reports : like beans. Like the bean they are, each ReportCategory and Report should be instanciated and registered only once. By default this is ensured by Spring IoC using @Component and @Resource annotations. A third party program can use the method addCategory() to register a new ReportCategory instance, however it falls under its responsibilities to ensure that each ReportCategory and Report are instanciated only once. When a ReportCategory is registered against the ReportFactory, the ReportFactory assigns it an id. As expected this id is meant to uniquely identify the said ReportCategory or Report, within the same application run. However the implementation doesn't garantee that the ReportCategories or Reports will have exactly the same id between different application run. When a ReportCategory is unregistered the id doesn't become available again.
| Method Summary | |
|---|---|
static void |
addCategory(ReportCategory category)
register a new ReportCategory |
ReportCategory |
findCategoryById(Integer id)
Will return the bean instance of the ReportCategory referred to with this id. |
Report |
findReportById(Integer reportId)
Will return the bean instance of the Report referred to with this id. |
List<ReportCategory> |
getAllReportCategories()
|
static ReportFactory |
getInstance()
|
static void |
removeCategory(Integer categoryId)
remove a ReportCategory from the list of registered ReportCategory |
static void |
removeCategory(ReportCategory category)
remove a ReportCategory from the list of registered ReportCategory |
static void |
removeReport(Integer reportId)
Will unregister a Report from its ReportCategory |
static void |
removeReport(Report report)
Will unregister a Report from its ReportCategory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ReportFactory getInstance()
public List<ReportCategory> getAllReportCategories()
public static void addCategory(ReportCategory category)
category - : a newly created instance of ReportCategorypublic static void removeCategory(ReportCategory category)
category - : a previously registered ReportCategory to unregister.public static void removeCategory(Integer categoryId)
categoryId - : the id of the said category.public static void removeReport(Report report)
report - : a previously registered Report to unregisterpublic static void removeReport(Integer reportId)
reportId - : the id of the said Reportpublic ReportCategory findCategoryById(Integer id)
id - the numeric id of the bean
public Report findReportById(Integer reportId)
reportId - the numeric id of the bean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||