org.outerj.xreporter.report
Class Catalog

java.lang.Object
  extended byorg.outerj.xreporter.report.Catalog

public class Catalog
extends java.lang.Object

A catalog groups a number of report definitions and child catalogs. The goal is to be able to show a hierarchical list of report definitions to the user.


Field Summary
protected static java.lang.String CATALOG_EL
           
protected  java.util.List childCatalogs
           
protected  java.util.Map childCatalogsByName
           
protected  java.util.List childReportDefinitions
           
protected static java.lang.String DESCRIPTION_ATTR
           
protected static java.lang.String ID_ATTR
           
protected  java.lang.String name
           
protected static java.lang.String NAME_ATTR
           
protected static java.lang.String REPORT_DEF_EL
           
 
Constructor Summary
protected Catalog(java.lang.String name)
           
 
Method Summary
protected  void addCatalog(Catalog catalog)
           
 void addReportDefinition(ReportDefinition reportDefinition)
           
 void generateSaxFragment(org.xml.sax.ContentHandler contentHandler, java.util.Set allowedReportDefinitionIds, DataSource dataSource, ResourceHandle resourceHandle)
          Generates an XML representation of this catalog and its subcatalogs.
 void generateSaxFragmentsForChildCatalogs(org.xml.sax.ContentHandler contentHandler, java.util.Set allowedReportDefinitionIds, DataSource dataSource, ResourceHandle resourceHandle)
          Special variant of generateSaxFragment(org.xml.sax.ContentHandler, java.util.Set, org.outerj.xreporter.datasource.DataSource, org.outerj.xreporter.resource.ResourceHandle) that only generates SAX events for the child catalogs of this catalog, and not for this catalog itself.
protected  Catalog getCatalog(java.util.List catalogPathList)
          Finds and returns a catalog, creating it if it does not exist.
 java.lang.String getName()
          Returns the name of this catalog, which is actually a resource bundle key.
 java.lang.String getName(ResourceHandle resourceHandle)
           
static java.util.List parseCatalogPath(java.lang.String catalogPath)
          Parses a path-string in a form like "abc/def/ghi" to a list of catalog names (i.e.
protected  boolean somethingAllowedPresent(java.util.Set allowedReportDefinitions, DataSource dataSource)
          Checks if there is any report in this catalog that is allowed, or if not found, if there is any in any of the subcatalogs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

childCatalogs

protected java.util.List childCatalogs

childCatalogsByName

protected java.util.Map childCatalogsByName

childReportDefinitions

protected java.util.List childReportDefinitions

CATALOG_EL

protected static final java.lang.String CATALOG_EL
See Also:
Constant Field Values

NAME_ATTR

protected static final java.lang.String NAME_ATTR
See Also:
Constant Field Values

REPORT_DEF_EL

protected static final java.lang.String REPORT_DEF_EL
See Also:
Constant Field Values

ID_ATTR

protected static final java.lang.String ID_ATTR
See Also:
Constant Field Values

DESCRIPTION_ATTR

protected static final java.lang.String DESCRIPTION_ATTR
See Also:
Constant Field Values
Constructor Detail

Catalog

protected Catalog(java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Returns the name of this catalog, which is actually a resource bundle key. See also getName().


getName

public java.lang.String getName(ResourceHandle resourceHandle)

addReportDefinition

public void addReportDefinition(ReportDefinition reportDefinition)

parseCatalogPath

public static java.util.List parseCatalogPath(java.lang.String catalogPath)
Parses a path-string in a form like "abc/def/ghi" to a list of catalog names (i.e. a list containing the entries abc, def and ghi). Catalog names should not contain spaces. Their names should be resource bundle keys.


getCatalog

protected Catalog getCatalog(java.util.List catalogPathList)
Finds and returns a catalog, creating it if it does not exist.

Parameters:
catalogPathList - a list in which each item is a string representing a portion of the path to the catalog. E.g. if the catalog-path would be 'abc/def/ghi', then the items in this list are 'abc', 'def', 'ghi'.

addCatalog

protected void addCatalog(Catalog catalog)

generateSaxFragment

public void generateSaxFragment(org.xml.sax.ContentHandler contentHandler,
                                java.util.Set allowedReportDefinitionIds,
                                DataSource dataSource,
                                ResourceHandle resourceHandle)
                         throws org.xml.sax.SAXException
Generates an XML representation of this catalog and its subcatalogs. This will not generate startDocument and endDocument events. If the catalog and/or subcatalogs do not contain anything (that the user is allowed to see), then no SAX-events will be generated for them. Thus there will never be an entry generated for an empty catalog.

Parameters:
contentHandler -
allowedReportDefinitionIds - a set containing the report definition id's that a certain user can view
dataSource - the selected dataSource, only reports compatible with this datasource will be added to the catalog
Throws:
org.xml.sax.SAXException

generateSaxFragmentsForChildCatalogs

public void generateSaxFragmentsForChildCatalogs(org.xml.sax.ContentHandler contentHandler,
                                                 java.util.Set allowedReportDefinitionIds,
                                                 DataSource dataSource,
                                                 ResourceHandle resourceHandle)
                                          throws org.xml.sax.SAXException
Special variant of generateSaxFragment(org.xml.sax.ContentHandler, java.util.Set, org.outerj.xreporter.datasource.DataSource, org.outerj.xreporter.resource.ResourceHandle) that only generates SAX events for the child catalogs of this catalog, and not for this catalog itself. Usefull if you have a "root" catalog for which you do not want to generate SAX events.

Throws:
org.xml.sax.SAXException

somethingAllowedPresent

protected boolean somethingAllowedPresent(java.util.Set allowedReportDefinitions,
                                          DataSource dataSource)
Checks if there is any report in this catalog that is allowed, or if not found, if there is any in any of the subcatalogs.