Author: heiko.braun(a)jboss.com
Date: 2009-10-28 15:49:38 -0400 (Wed, 28 Oct 2009)
New Revision: 861
Added:
report-server/trunk/README_BIRT.txt
report-server/trunk/core/src/main/java/org/jboss/bpm/report/DOMWriter.java
report-server/trunk/core/src/main/java/org/jboss/bpm/report/util/
report-server/trunk/core/src/main/java/org/jboss/bpm/report/util/BirtUtil.java
report-server/trunk/shared/
report-server/trunk/shared/pom.xml
report-server/trunk/shared/src/
report-server/trunk/shared/src/main/
report-server/trunk/shared/src/main/java/
report-server/trunk/shared/src/main/java/org/
report-server/trunk/shared/src/main/java/org/jboss/
report-server/trunk/shared/src/main/java/org/jboss/bpm/
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportParameter.java
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportReference.java
Modified:
report-server/trunk/core/pom.xml
report-server/trunk/core/src/main/java/org/jboss/bpm/report/BirtService.java
report-server/trunk/core/src/main/java/org/jboss/bpm/report/ReportFacade.java
report-server/trunk/pom.xml
report-server/trunk/report-server.iml
Log:
Parse .rptdesign files directly to access report properties, including parameter meta
data
Added: report-server/trunk/README_BIRT.txt
===================================================================
--- report-server/trunk/README_BIRT.txt (rev 0)
+++ report-server/trunk/README_BIRT.txt 2009-10-28 19:49:38 UTC (rev 861)
@@ -0,0 +1,9 @@
+Getting BIRT
+------------
+
+You need to have the proper BIRT version installed.
+It can be downloaded here:
+http://archive.eclipse.org/birt/downloads/build_list.php
+
+
+
Modified: report-server/trunk/core/pom.xml
===================================================================
--- report-server/trunk/core/pom.xml 2009-10-28 08:53:41 UTC (rev 860)
+++ report-server/trunk/core/pom.xml 2009-10-28 19:49:38 UTC (rev 861)
@@ -19,6 +19,12 @@
</properties>
<dependencies>
+
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>report-shared</artifactId>
+ <version>${version}</version>
+ </dependency>
<!-- Other -->
<dependency>
<groupId>commons-logging</groupId>
@@ -181,6 +187,11 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+
</dependencies>
Modified: report-server/trunk/core/src/main/java/org/jboss/bpm/report/BirtService.java
===================================================================
---
report-server/trunk/core/src/main/java/org/jboss/bpm/report/BirtService.java 2009-10-28
08:53:41 UTC (rev 860)
+++
report-server/trunk/core/src/main/java/org/jboss/bpm/report/BirtService.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -25,18 +25,15 @@
import org.apache.commons.logging.LogFactory;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.*;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+import org.jboss.bpm.report.model.ReportReference;
+import org.jboss.bpm.report.model.ReportParameter;
+import org.jboss.bpm.report.util.BirtUtil;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.FilenameFilter;
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Core BIRT service component. Requires to step through the lifecycle
@@ -62,12 +59,10 @@
private enum State {NONE, CREATED, STARTED, STOPPED, DESTROYED};
private State currentState = State.NONE;
- private Map<String, IReportRunnable> cache = new HashMap<String,
IReportRunnable>();
+ private Map<String, IReportRunnable> cache = new ConcurrentHashMap<String,
IReportRunnable>();
- private List<String> templateNames = new ArrayList<String>();
+ private Map<String, ReportReference> reports = new ConcurrentHashMap<String,
ReportReference>();
- private Document reportConfig;
-
public BirtService(IntegrationConfig iConfig)
{
this.iConfig = iConfig;
@@ -82,16 +77,11 @@
File workDir = new File(iConfig.getReportDir());
if(!workDir.exists())
throw new IllegalStateException("Working directory
"+iConfig.getReportDir()+" cannot be found!");
-
- File config = new File(workDir, "reports.xml");
- if(!config.exists())
- throw new IllegalStateException("Template config (reports.xml) not found:
"+iConfig.getReportDir());
-
+
try
{
- DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- reportConfig = docBuilder.parse(config);
- parseReportNames(reportConfig);
+ loadReportNames();
+ extractParameterNames();
}
catch (Exception e)
{
@@ -102,23 +92,104 @@
currentState = State.CREATED;
}
- private void parseReportNames(Document reportConfig)
+ private void loadReportNames()
{
- Element root = reportConfig.getDocumentElement();
-
- NodeList groups = root.getElementsByTagName("group");
- for(int i=0; i<groups.getLength(); i++)
+ File workDir = new File(iConfig.getReportDir());
+ assert workDir.isDirectory();
+
+ File[] reportFiles = workDir.listFiles(
+ new FilenameFilter()
+ {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".rptdesign");
+ }
+ }
+ );
+
+ for(File f : reportFiles)
+ {
+ reports.put(f.getName(), new ReportReference(f.getName()));
+ }
+ }
+
+ private void extractParameterNames() throws EngineException
+ {
+ Iterator<String> templateNames = reports.keySet().iterator();
+ while(templateNames.hasNext())
{
- Element group = (Element)groups.item(i);
- NodeList reports = group.getElementsByTagName("report");
- for(int x=0; x<reports.getLength(); x++)
+ String templateName = templateNames.next();
+ IReportRunnable template = openCached(templateName);
+
+ // Update report reference details
+ String title = prop(template, IReportRunnable.TITLE, "No title");
+ String description = prop(template, IReportRunnable.DESCRIPTION, "No
description");
+ ReportReference reportRef = reports.get(templateName);
+ reportRef.setTitle(title);
+ reportRef.setDescription(description);
+
+ Map<String, Map<String,Serializable>> paramDetails =
+ new HashMap<String, Map<String, Serializable>>();
+
+ //Create Parameter Definition Task and retrieve parameter definitions
+ IGetParameterDefinitionTask task = engine.createGetParameterDefinitionTask(
template );
+ Collection params = task.getParameterDefns( true );
+
+ //Iterate over each parameter
+ Iterator iter = params.iterator( );
+ while ( iter.hasNext( ) )
{
- Element report = (Element)reports.item(x);
- templateNames.add(report.getAttribute("template"));
+ IParameterDefnBase param = (IParameterDefnBase) iter.next( );
+
+ if ( param instanceof IParameterGroupDefn )
+ {
+ IParameterGroupDefn group = (IParameterGroupDefn) param;
+
+ // Do something with the parameter group.
+ // Iterate over group contents.
+ Iterator i2 = group.getContents( ).iterator( );
+ while ( i2.hasNext( ) )
+ {
+ IScalarParameterDefn scalar = (IScalarParameterDefn) i2.next( );
+ //Get details on the parameter
+ paramDetails.put( scalar.getName(), BirtUtil.loadParameterDetails( task,
scalar, template, group));
+ }
+
+ }
+ else
+ {
+ IScalarParameterDefn scalar = (IScalarParameterDefn) param;
+ //System.out.println(param.getName());
+ //get details on the parameter
+ paramDetails.put( scalar.getName(), BirtUtil.loadParameterDetails( task,
scalar, template, null));
+ }
+
+ // update ReportReference.parameters
+ ReportReference ref = reports.get(templateName);
+ Iterator<String> paramNames = paramDetails.keySet().iterator();
+ while(paramNames.hasNext())
+ {
+ Map<String, Serializable> map = paramDetails.get(paramNames.next());
+ ReportParameter paramRef = new ReportParameter(
+ (String)map.get("Name"),
ReportParameter.Type.valueOf((String)map.get("Type"))
+ );
+
paramRef.setDataType(ReportParameter.DataType.valueOf((String)map.get("DataType")));
+ paramRef.setHelptext((String)map.get("Help Text"));
+ paramRef.setDisplayName((String)map.get("Display Name"));
+ ref.getParameterMetaData().add(paramRef);
+ }
}
}
+
+
}
+ private String prop(IReportRunnable report, String name, String value)
+ {
+ return report.getProperty(name) != null ?
+ (String)report.getProperty(name) : value;
+ }
+
/* non blocking init */
public void createAsync()
{
@@ -177,9 +248,9 @@
if( (currentState==State.CREATED || currentState==State.STARTED) == false)
throw new IllegalStateException("Cannot render in state " +
currentState);
- if(!templateNames.contains(metaData.getReportName()))
+ if(!reports.keySet().contains(metaData.getReportName()))
throw new IllegalArgumentException("No such report template:
"+metaData.getReportName());
-
+
String outputFileName = null;
log.debug("Render " + metaData);
@@ -187,14 +258,7 @@
try
{
//Open a (cached) report design
- IReportRunnable design = cache.get(metaData.getReportName());
- if(null==design)
- {
- design = engine.openReportDesign(
- iConfig.getReportDir()+metaData.getReportName()
- );
- cache.put(metaData.getReportName(), design);
- }
+ IReportRunnable design = openCached(metaData.getReportName());
//Create runRenderTask to run and render the report,
IRunAndRenderTask runRenderTask = engine.createRunAndRenderTask(design);
@@ -255,6 +319,20 @@
return outputFileName;
}
+ private IReportRunnable openCached(String reportName)
+ throws EngineException
+ {
+ IReportRunnable design = cache.get(reportName);
+ if(null==design)
+ {
+ design = engine.openReportDesign(
+ iConfig.getReportDir()+reportName
+ );
+ cache.put(reportName, design);
+ }
+ return design;
+ }
+
public IntegrationConfig getIntegrationConfig()
{
return iConfig;
@@ -270,10 +348,14 @@
return currentState;
}
- public String getTemplateConfig()
+ public List<ReportReference> getReportReferences()
{
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- new DOMWriter(bout).print(reportConfig.getDocumentElement());
- return new String(bout.toByteArray());
+ if( (currentState==State.CREATED || currentState==State.STARTED) == false)
+ throw new IllegalStateException("Cannot acccess report references in state
" + currentState);
+
+ ArrayList<ReportReference> list = new ArrayList<ReportReference>();
+ for(String s : reports.keySet())
+ list.add(reports.get(s));
+ return list;
}
}
Added: report-server/trunk/core/src/main/java/org/jboss/bpm/report/DOMWriter.java
===================================================================
--- report-server/trunk/core/src/main/java/org/jboss/bpm/report/DOMWriter.java
(rev 0)
+++ report-server/trunk/core/src/main/java/org/jboss/bpm/report/DOMWriter.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -0,0 +1,634 @@
+package org.jboss.bpm.report;
+
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache
Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ */
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Traverse a DOM tree in order to print a document that is parsed.
+ *
+ * @author Andy Clark, IBM
+ * @author Thomas.Diesler(a)jboss.org
+ */
+@SuppressWarnings("unchecked")
+public class DOMWriter
+{
+ // Print writer
+ private PrintWriter out;
+ // True, if canonical output
+ private boolean canonical;
+ // True, if pretty printing should be used
+ private boolean prettyprint;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // True, if whitespace should be ignored
+ private boolean ignoreWhitespace;
+ // Explicit character set encoding
+ private String charsetName;
+ // indent for the pretty printer
+ private int prettyIndent;
+ // True, if the XML declaration has been written
+ private boolean wroteXMLDeclaration;
+ // The node that started the write
+ private Node rootNode;
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+ // The current default namespace
+ private String currentDefaultNamespace;
+
+ public DOMWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public DOMWriter(Writer w, String charsetName)
+ {
+ this.out = new PrintWriter(w);
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+
+ public DOMWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public DOMWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException("Unsupported encoding: " +
charsetName);
+ }
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ *
+ */
+ public static String printNode(Node node, boolean prettyprint)
+ {
+ StringWriter strw = new StringWriter();
+ new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
+ return strw.toString();
+ }
+
+ public boolean isCanonical()
+ {
+ return canonical;
+ }
+
+ /**
+ * Set wheter entities should appear in their canonical form.
+ * The default is false.
+ */
+ public DOMWriter setCanonical(boolean canonical)
+ {
+ this.canonical = canonical;
+ return this;
+ }
+
+ public boolean isIgnoreWhitespace()
+ {
+ return ignoreWhitespace;
+ }
+
+ /**
+ * Set whether whitespace should be ignored.
+ * The default is false.
+ */
+ public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
+ {
+ this.ignoreWhitespace = ignoreWhitespace;
+ return this;
+ }
+
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
+ public boolean isPrettyprint()
+ {
+ return prettyprint;
+ }
+
+ /**
+ * Set wheter element should be indented.
+ * The default is false.
+ */
+ public DOMWriter setPrettyprint(boolean prettyprint)
+ {
+ this.prettyprint = prettyprint;
+ return this;
+ }
+
+ public boolean isWriteXMLDeclaration()
+ {
+ return writeXMLDeclaration;
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public DOMWriter setWriteXMLDeclaration(boolean flag)
+ {
+ this.writeXMLDeclaration = flag;
+ return this;
+ }
+
+ public void print(Node node)
+ {
+ if (prettyprint && ignoreWhitespace)
+ throw new IllegalStateException("Cannot pretty print and ignore
whitespace");
+
+ rootNode = node;
+ printInternal(node, false);
+ }
+
+ private void printInternal(Node node, boolean indentEndMarker)
+ {
+ // is there anything to do?
+ if (node == null)
+ {
+ return;
+ }
+
+ // JBAS-2117 - Don't skip the DOCUMENT_NODE
+ // if (node instanceof Document) node = ((Document)node).getDocumentElement();
+
+ if (wroteXMLDeclaration == false && writeXMLDeclaration == true &&
canonical == false)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName + "'");
+
+ out.print("?>");
+ if (prettyprint)
+ out.println();
+
+ wroteXMLDeclaration = true;
+ }
+
+ int type = node.getNodeType();
+ boolean hasChildNodes = node.getChildNodes().getLength() > 0;
+
+ String nodeName = node.getNodeName();
+ switch (type)
+ {
+ // print document
+ case Node.DOCUMENT_NODE:
+ {
+ NodeList children = node.getChildNodes();
+ for (int iChild = 0; iChild < children.getLength(); iChild++)
+ {
+ printInternal(children.item(iChild), false);
+ }
+ out.flush();
+ break;
+ }
+
+ // print element with attributes
+ case Node.ELEMENT_NODE:
+ {
+ Element element = (Element)node;
+ if (prettyprint)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ prettyIndent++;
+ }
+
+ out.print('<');
+ out.print(nodeName);
+
+ Map nsMap = new HashMap();
+ String elPrefix = node.getPrefix();
+ String elNamespaceURI = node.getNamespaceURI();
+ if (elPrefix != null)
+ {
+ String nsURI = getNamespaceURI(elPrefix, element, rootNode);
+ nsMap.put(elPrefix, nsURI);
+ }
+
+ Attr attrs[] = sortAttributes(node.getAttributes());
+ for (int i = 0; i < attrs.length; i++)
+ {
+ Attr attr = attrs[i];
+ String atPrefix = attr.getPrefix();
+ String atName = attr.getNodeName();
+ String atValue = normalize(attr.getNodeValue(), canonical);
+
+ if (atName.equals("xmlns"))
+ currentDefaultNamespace = atValue;
+
+ if (atPrefix != null && !atPrefix.equals("xmlns") &&
!atPrefix.equals("xml"))
+ {
+ String nsURI = getNamespaceURI(atPrefix, element, rootNode);
+ nsMap.put(atPrefix, nsURI);
+ // xsi:type='ns1:SubType', xsi:type='xsd:string'
+ if (atName.equals(atPrefix + ":type") &&
atValue.indexOf(":") > 0)
+ {
+ // xsi defined on the envelope
+ if (nsURI == null)
+ nsURI = getNamespaceURI(atPrefix, element, null);
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
+ {
+ String typePrefix = atValue.substring(0,
atValue.indexOf(":"));
+ String typeURI = getNamespaceURI(typePrefix, element, rootNode);
+ nsMap.put(typePrefix, typeURI);
+ }
+ }
+ }
+
+ out.print(" " + atName + "='" + atValue +
"'");
+ }
+
+ // Add namespace declaration for prefixes
+ // that are defined further up the tree
+ if (completeNamespaces)
+ {
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
+ {
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI +
"'");
+ }
+ }
+ }
+
+ // The SAX ContentHandler will by default not add the namespace declaration
+ // <Hello xmlns='http://somens'>World</Hello>
+ if (elPrefix == null && elNamespaceURI != null)
+ {
+ String defaultNamespace = element.getAttribute("xmlns");
+ if (defaultNamespace.length() == 0 &&
!elNamespaceURI.equals(currentDefaultNamespace))
+ {
+ out.print(" xmlns='" + elNamespaceURI + "'");
+ currentDefaultNamespace = elNamespaceURI;
+ }
+ }
+
+ if (hasChildNodes)
+ {
+ out.print('>');
+ }
+
+ // Find out if the end marker is indented
+ indentEndMarker = isEndMarkerIndented(node);
+
+ if (indentEndMarker)
+ {
+ out.print('\n');
+ }
+
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node childNode = childNodes.item(i);
+ printInternal(childNode, false);
+ }
+ break;
+ }
+
+ // handle entity reference nodes
+ case Node.ENTITY_REFERENCE_NODE:
+ {
+ if (canonical)
+ {
+ NodeList children = node.getChildNodes();
+ if (children != null)
+ {
+ int len = children.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ printInternal(children.item(i), false);
+ }
+ }
+ }
+ else
+ {
+ out.print('&');
+ out.print(nodeName);
+ out.print(';');
+ }
+ break;
+ }
+
+ // print cdata sections
+ case Node.CDATA_SECTION_NODE:
+ {
+ if (canonical)
+ {
+ out.print(normalize(node.getNodeValue(), canonical));
+ }
+ else
+ {
+ out.print("<![CDATA[");
+ out.print(node.getNodeValue());
+ out.print("]]>");
+ }
+ break;
+ }
+
+ // print text
+ case Node.TEXT_NODE:
+ {
+ String text = normalize(node.getNodeValue(), canonical);
+ if (text.trim().length() > 0)
+ {
+ out.print(text);
+ }
+ else if (prettyprint == false && ignoreWhitespace == false)
+ {
+ out.print(text);
+ }
+ break;
+ }
+
+ // print processing instruction
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ {
+ out.print("<?");
+ out.print(nodeName);
+ String data = node.getNodeValue();
+ if (data != null && data.length() > 0)
+ {
+ out.print(' ');
+ out.print(data);
+ }
+ out.print("?>");
+ break;
+ }
+
+ // print comment
+ case Node.COMMENT_NODE:
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+
+ out.print("<!--");
+ String data = node.getNodeValue();
+ if (data != null)
+ {
+ out.print(data);
+ }
+ out.print("-->");
+
+ if (prettyprint)
+ {
+ out.print('\n');
+ }
+
+ break;
+ }
+ }
+
+ if (type == Node.ELEMENT_NODE)
+ {
+ if (prettyprint)
+ prettyIndent--;
+
+ if (hasChildNodes == false)
+ {
+ out.print("/>");
+ }
+ else
+ {
+ if (indentEndMarker)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ }
+
+ out.print("</");
+ out.print(nodeName);
+ out.print('>');
+ }
+
+ if (prettyIndent > 0)
+ {
+ out.print('\n');
+ }
+ }
+ out.flush();
+ }
+
+ private String getNamespaceURI(String prefix, Element element, Node stopNode)
+ {
+ Node parent = element.getParentNode();
+ String nsURI = element.getAttribute("xmlns:" + prefix);
+ if (nsURI.length() == 0 && element != stopNode && parent instanceof
Element)
+ return getNamespaceURI(prefix, (Element)parent, stopNode);
+
+ return (nsURI.length() > 0 ? nsURI : null);
+ }
+
+ private boolean isEndMarkerIndented(Node node)
+ {
+ if (prettyprint)
+ {
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node children = childNodes.item(i);
+ if (children.getNodeType() == Node.ELEMENT_NODE)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /** Returns a sorted list of attributes. */
+ private Attr[] sortAttributes(NamedNodeMap attrs)
+ {
+
+ int len = (attrs != null) ? attrs.getLength() : 0;
+ Attr array[] = new Attr[len];
+ for (int i = 0; i < len; i++)
+ {
+ array[i] = (Attr)attrs.item(i);
+ }
+ for (int i = 0; i < len - 1; i++)
+ {
+ String name = array[i].getNodeName();
+ int index = i;
+ for (int j = i + 1; j < len; j++)
+ {
+ String curName = array[j].getNodeName();
+ if (curName.compareTo(name) < 0)
+ {
+ name = curName;
+ index = j;
+ }
+ }
+ if (index != i)
+ {
+ Attr temp = array[i];
+ array[i] = array[index];
+ array[index] = temp;
+ }
+ }
+ return (array);
+ }
+
+ /** Normalizes the given string. */
+ public static String normalize(String s, boolean canonical)
+ {
+ StringBuffer str = new StringBuffer();
+
+ int len = (s != null) ? s.length() : 0;
+ for (int i = 0; i < len; i++)
+ {
+ char ch = s.charAt(i);
+ switch (ch)
+ {
+ case '<':
+ {
+ str.append("<");
+ break;
+ }
+ case '>':
+ {
+ str.append(">");
+ break;
+ }
+ case '&':
+ {
+ str.append("&");
+ break;
+ }
+ case '"':
+ {
+ str.append(""");
+ break;
+ }
+ case '\'':
+ {
+ str.append("'");
+ break;
+ }
+ case '\r':
+ case '\n':
+ {
+ if (canonical)
+ {
+ str.append("&#");
+ str.append(Integer.toString(ch));
+ str.append(';');
+ break;
+ }
+ // else, default append char
+ }
+ default:
+ {
+ str.append(ch);
+ }
+ }
+ }
+ return (str.toString());
+ }
+}
\ No newline at end of file
Modified: report-server/trunk/core/src/main/java/org/jboss/bpm/report/ReportFacade.java
===================================================================
---
report-server/trunk/core/src/main/java/org/jboss/bpm/report/ReportFacade.java 2009-10-28
08:53:41 UTC (rev 860)
+++
report-server/trunk/core/src/main/java/org/jboss/bpm/report/ReportFacade.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.report.model.ReportReference;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
@@ -35,7 +36,10 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import java.util.List;
+import com.google.gson.GsonBuilder;
+
/**
* BIRT integration facade.<p>
*
@@ -188,8 +192,10 @@
log.error(e);
StringBuffer sb = new StringBuffer();
- sb.append("Unable to process report:").append("<br/>");
+ sb.append("<div style='font-family:sans-serif;
padding:10px;'>");
+ sb.append("<h3>Unable to process
report").append("</h3>");
sb.append(e.getMessage());
+ sb.append("</div>");
return Response.ok(sb.toString()).build();
}
@@ -207,10 +213,12 @@
@GET
@Path("config")
- @Produces("text/xml")
+ @Produces("application/json")
public Response getReportConfig()
{
- return Response.ok(birtService.getTemplateConfig()).build();
+ List<ReportReference> refs = birtService.getReportReferences();
+ String json = new GsonBuilder().create().toJson(refs);
+ return Response.ok(json).build();
}
public class BirtInitException extends Exception
Added: report-server/trunk/core/src/main/java/org/jboss/bpm/report/util/BirtUtil.java
===================================================================
--- report-server/trunk/core/src/main/java/org/jboss/bpm/report/util/BirtUtil.java
(rev 0)
+++
report-server/trunk/core/src/main/java/org/jboss/bpm/report/util/BirtUtil.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -0,0 +1,193 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.report.util;
+
+import org.eclipse.birt.report.engine.api.*;
+import org.eclipse.birt.report.model.api.ReportDesignHandle;
+import org.eclipse.birt.report.model.api.ScalarParameterHandle;
+import org.eclipse.birt.report.model.api.CascadingParameterGroupHandle;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BirtUtil
+{
+ //Function to load parameter details in a map.
+ public static HashMap<String, Serializable> loadParameterDetails(
+ IGetParameterDefinitionTask task,
+ IScalarParameterDefn scalar,
+ IReportRunnable report,
+ IParameterGroupDefn group
+ )
+ {
+ HashMap<String, Serializable> parameter = new HashMap<String,
Serializable>();
+
+ if( group == null){
+ parameter.put("Parameter Group", "Default");
+ }else{
+ parameter.put("Parameter Group", group.getName());
+ }
+ parameter.put("Name", scalar.getName());
+ parameter.put("Help Text", scalar.getHelpText());
+ parameter.put("Display Name", scalar.getDisplayName());
+ //this is a format code such as > for UPPERCASE
+ parameter.put("Display Format", scalar.getDisplayFormat());
+
+ if( scalar.isHidden() ){
+ parameter.put("Hidden", "Yes");
+ }else{
+ parameter.put("Hidden", "No");
+ }
+ if( scalar.allowBlank() ){
+ parameter.put("Allow Blank", "Yes");
+ }else{
+ parameter.put("Allow Blank", "No");
+ }
+ if( scalar.allowNull() ){
+ parameter.put("Allow Null", "Yes");
+ }else{
+ parameter.put("Allow Null", "No");
+ }
+ if( scalar.isValueConcealed() ){
+ parameter.put("Conceal Entry", "Yes"); //ie passwords etc
+ }else{
+ parameter.put("Conceal Entry", "No");
+ }
+
+
+ switch (scalar.getControlType()) {
+ case IScalarParameterDefn.TEXT_BOX: parameter.put("Type",
"TEXTBOX"); break;
+ case IScalarParameterDefn.LIST_BOX: parameter.put("Type",
"LISTBOX"); break;
+ case IScalarParameterDefn.RADIO_BUTTON: parameter.put("Type",
"RADIO_BUTTON"); break;
+ case IScalarParameterDefn.CHECK_BOX: parameter.put("Type",
"CHECKBOX"); break;
+ default: parameter.put("Type", "TEXTBOX");break;
+ }
+
+
+ switch (scalar.getDataType()) {
+ case IScalarParameterDefn.TYPE_STRING: parameter.put("DataType",
"STRING"); break;
+ case IScalarParameterDefn.TYPE_FLOAT: parameter.put("DataType",
"NUMBER"); break;
+ case IScalarParameterDefn.TYPE_DECIMAL: parameter.put("DataType",
"NUMBER"); break;
+ case IScalarParameterDefn.TYPE_DATE_TIME: parameter.put("DataType",
"DATETIME"); break;
+ case IScalarParameterDefn.TYPE_BOOLEAN: parameter.put("DataType",
"BOOLEAN"); break;
+ case IScalarParameterDefn.TYPE_DATE: parameter.put("DataType",
"DATETIME"); break;
+ default: parameter.put("DataType", "ANY"); break;
+ }
+
+
+ //Get report design and find default value, prompt text and data set expression using
the DE API
+ ReportDesignHandle reportHandle = ( ReportDesignHandle ) report.getDesignHandle( );
+ ScalarParameterHandle parameterHandle = (ScalarParameterHandle)
reportHandle.findParameter( scalar.getName() );
+ parameter.put("Default Value", parameterHandle.getDefaultValue());
+ parameter.put("Prompt Text", parameterHandle.getPromptText());
+ parameter.put("Data Set Expression", parameterHandle.getValueExpr());
+
+ if(scalar.getControlType() != IScalarParameterDefn.TEXT_BOX)
+ {
+ //retrieve selection list for cascaded parameter
+ if ( parameterHandle.getContainer( ) instanceof CascadingParameterGroupHandle){
+ Collection sList = Collections.EMPTY_LIST;
+ if ( parameterHandle.getContainer( ) instanceof CascadingParameterGroupHandle )
+ {
+ int index = parameterHandle.getContainerSlotHandle( )
+ .findPosn( parameterHandle );
+ Object[] keyValue = new Object[index];
+ for ( int i = 0; i < index; i++ )
+ {
+ ScalarParameterHandle handle = (ScalarParameterHandle) (
(CascadingParameterGroupHandle) parameterHandle.getContainer( ) ).getParameters( )
+ .get( i );
+ //Use parameter default values
+ keyValue[i] = handle.getDefaultValue();
+ }
+ String groupName = parameterHandle.getContainer( ).getName( );
+ task.evaluateQuery( groupName );
+
+ sList = task.getSelectionListForCascadingGroup( groupName, keyValue );
+ HashMap<Object, String> dynamicList = new HashMap<Object,
String>();
+
+
+ for ( Iterator sl = sList.iterator( ); sl.hasNext( ); )
+ {
+ IParameterSelectionChoice sI = (IParameterSelectionChoice) sl.next( );
+
+
+ Object value = sI.getValue( );
+ Object label = sI.getLabel( );
+ System.out.println( label + "--" + value);
+ dynamicList.put(value,(String) label);
+
+ }
+ parameter.put("Selection List", dynamicList);
+
+
+ }
+ }else{
+ //retrieve selection list
+ Collection selectionList = task.getSelectionList( scalar.getName() );
+
+ if ( selectionList != null )
+ {
+ HashMap<Object, String> dynamicList = new HashMap<Object,
String>();
+
+ for ( Iterator sliter = selectionList.iterator( ); sliter.hasNext( ); )
+ {
+ IParameterSelectionChoice selectionItem = (IParameterSelectionChoice)
sliter.next( );
+
+ Object value = selectionItem.getValue( );
+ String label = selectionItem.getLabel( );
+ //System.out.println( label + "--" + value);
+ dynamicList.put(value,label);
+
+ }
+ parameter.put("Selection List", dynamicList);
+ }
+ }
+
+ }
+
+
+ //Print out results
+ Iterator iter = parameter.keySet().iterator();
+ System.out.println("======================Parameter =" +
scalar.getName());
+ while (iter.hasNext()) {
+ String name = (String) iter.next();
+ if( name.equals("Selection List")){
+ HashMap selList = (HashMap)parameter.get(name);
+ Iterator selIter = selList.keySet().iterator();
+ while (selIter.hasNext()) {
+ Object lbl = selIter.next();
+ System.out.println( "Selection List Entry ===== Key = " + lbl +
" Value = " + selList.get(lbl));
+ }
+
+ }else{
+ System.out.println( name + " = " + parameter.get(name));
+ }
+ }
+ return parameter;
+ }
+}
Modified: report-server/trunk/pom.xml
===================================================================
--- report-server/trunk/pom.xml 2009-10-28 08:53:41 UTC (rev 860)
+++ report-server/trunk/pom.xml 2009-10-28 19:49:38 UTC (rev 861)
@@ -19,9 +19,11 @@
<junit.version>3.8.1</junit.version>
<resteasy.version>1.0.2.GA</resteasy.version>
<servlet.version>2.4</servlet.version>
+ <gson.version>1.2.2</gson.version>
</properties>
<modules>
+ <module>shared</module>
<module>core</module>
<module>server</module>
</modules>
@@ -87,12 +89,36 @@
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
- </exclusions>
+ </exclusions>
</dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson.version}</version>
+ </dependency>
+
+
</dependencies>
</dependencyManagement>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
<!-- Repositories -->
<repositories>
<repository>
Modified: report-server/trunk/report-server.iml
===================================================================
--- report-server/trunk/report-server.iml 2009-10-28 08:53:41 UTC (rev 860)
+++ report-server/trunk/report-server.iml 2009-10-28 19:49:38 UTC (rev 861)
@@ -8,19 +8,11 @@
<sourceFolder url="file://$MODULE_DIR$/core/src/main/resources"
isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/server/src/main/java"
isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/server/src/main/resources"
isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/shared/src/main/java"
isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
- <library name="M2 Dep: junit:junit:jar:3.8.1:test">
- <CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar!/"
/>
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library" exported="">
<library name="M2 Dep:
commons-logging:commons-logging:jar:1.1.1:compile">
<CLASSES>
<root
url="jar://$MODULE_DIR$/../../../../../.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/"
/>
@@ -203,10 +195,10 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library>
+ <orderEntry type="module-library" exported="">
+ <library name="M2 Dep:
com.google.code.gson:gson:jar:1.2.2:compile">
<CLASSES>
- <root
url="jar://$MODULE_DIR$/../../../../../../.m2/repository/com/google/code/gson/gson/1.2.2/gson-1.2.2.jar!/"
/>
+ <root
url="jar://$MODULE_DIR$/../../../../../.m2/repository/com/google/code/gson/gson/1.2.2/gson-1.2.2.jar!/"
/>
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -222,6 +214,15 @@
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
+ <library name="M2 Dep: junit:junit:jar:3.8.1:test">
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library" exported="">
<library name="M2 Dep:
org.jboss.resteasy:resteasy-jaxrs:jar:1.0.2.GA:provided">
<CLASSES>
<root
url="jar://$MODULE_DIR$/../../../../../.m2/repository/org/jboss/resteasy/resteasy-jaxrs/1.0.2.GA/resteasy-jaxrs-1.0.2.GA.jar!/"
/>
Added: report-server/trunk/shared/pom.xml
===================================================================
--- report-server/trunk/shared/pom.xml (rev 0)
+++ report-server/trunk/shared/pom.xml 2009-10-28 19:49:38 UTC (rev 861)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <name>JBoss BPM - Report Shared</name>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>report-shared</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>report-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <finalName>report-shared</finalName>
+ </build>
+</project>
Added:
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportParameter.java
===================================================================
---
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportParameter.java
(rev 0)
+++
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportParameter.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.report.model;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ReportParameter
+{
+ public enum Type {LISTBOX, TEXTBOX, CHECKBOX, RADIO_BUTTON}
+ public enum DataType {STRING, NUMBER, DATETIME, BOOLEAN, ANY}
+
+ private String name;
+ private String helptext;
+ private String displayName;
+
+ private Type type;
+ private DataType dataType = DataType.STRING;
+
+ public ReportParameter(String name, Type type)
+ {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public String getHelptext()
+ {
+ return helptext;
+ }
+
+ public void setHelptext(String helptext)
+ {
+ this.helptext = helptext;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public DataType getDataType()
+ {
+ return dataType;
+ }
+
+ public void setDataType(DataType dataType)
+ {
+ this.dataType = dataType;
+ }
+}
Added:
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportReference.java
===================================================================
---
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportReference.java
(rev 0)
+++
report-server/trunk/shared/src/main/java/org/jboss/bpm/report/model/ReportReference.java 2009-10-28
19:49:38 UTC (rev 861)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.report.model;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ReportReference
+{
+ private String title;
+ private String description;
+ private String reportFileName;
+ private Set<ReportParameter> parameterMetaData = new
HashSet<ReportParameter>();
+
+
+ public ReportReference(String reportFileName)
+ {
+ this.reportFileName = reportFileName;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getReportFileName()
+ {
+ return reportFileName;
+ }
+
+ public Set<ReportParameter> getParameterMetaData()
+ {
+ return parameterMetaData;
+ }
+}