Debian Codegraph @

source/org/jfree/report/flow/DefaultReportJob.java

raw
1 /**
2 * ========================================
3 * JFreeReport : a free Java report library
4 * ========================================
5 *
6 * Project Info: http://reporting.pentaho.org/
7 *
8 * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
9 *
10 * This library is free software; you can redistribute it and/or modify it under the terms
11 * of the GNU Lesser General Public License as published by the Free Software Foundation;
12 * either version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License along with this
19 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 * Boston, MA 02111-1307, USA.
21 *
22 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23 * in the United States and other countries.]
24 *
25 * ------------
26 * $Id: DefaultReportJob.java 10756 2009-12-02 15:58:24Z tmorgner $
27 * ------------
28 * (C) Copyright 2000-2005, by Object Refinery Limited.
29 * (C) Copyright 2005-2007, by Pentaho Corporation.
30 */
31 package org.jfree.report.flow;
32
33
34 import org.jfree.report.ReportDataFactory;
35 import org.jfree.report.i18n.DefaultResourceBundleFactory;
36 import org.jfree.report.i18n.ResourceBundleFactory;
37 import org.jfree.report.util.ReportParameters;
38 import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
39 import org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration;
40
41 /**
42 * Creation-Date: 22.02.2006, 12:47:53
43 *
44 * @author Thomas Morgner
45 */
46 public class DefaultReportJob
47 implements ReportJob
48 {
49 private ReportStructureRoot report;
50 private ReportDataFactory dataFactory;
51 private ReportParameters parameters;
52 private ModifiableConfiguration configuration;
53 private ResourceBundleFactory resourceBundleFactory;
54 private String name;
55 //private PageFormat pageFormat;
56
57 public DefaultReportJob(final ReportStructureRoot report)
58 {
59 this.resourceBundleFactory = new DefaultResourceBundleFactory();
60 this.report = report;
61 final ReportDataFactory dataFactory = report.getDataFactory();
62 if (dataFactory != null)
63 {
64 this.dataFactory = dataFactory.derive();
65 }
66 this.parameters = new ReportParameters(report.getInputParameters());
67 this.configuration = new HierarchicalConfiguration(report.getConfiguration());
68 }
69
70 public ModifiableConfiguration getConfiguration()
71 {
72 return configuration;
73 }
74
75 public ReportParameters getParameters()
76 {
77 return parameters;
78 }
79
80 public ReportStructureRoot getReportStructureRoot()
81 {
82 return report;
83 }
84
85 public ReportDataFactory getDataFactory()
86 {
87 return dataFactory;
88 }
89
90 public void setDataFactory(final ReportDataFactory dataFactory)
91 {
92 this.dataFactory = dataFactory;
93 }
94
95 public Object clone() throws CloneNotSupportedException
96 {
97 DefaultReportJob job = (DefaultReportJob) super.clone();
98 if (dataFactory != null)
99 {
100 job.dataFactory = dataFactory.derive();
101 }
102 job.parameters = (ReportParameters) parameters.clone();
103 job.configuration = (ModifiableConfiguration) configuration.clone();
104 return job;
105 }
106
107 public ReportJob derive()
108 {
109 try
110 {
111 return (ReportJob) clone();
112 }
113 catch (CloneNotSupportedException e)
114 {
115 throw new IllegalStateException
116 ("A report job should always be cloneable.");
117 }
118 }
119
120 public synchronized void close()
121 {
122 if (dataFactory != null)
123 {
124 dataFactory.close();
125 }
126 }
127
128 public ResourceBundleFactory getResourceBundleFactory()
129 {
130 return resourceBundleFactory;
131 }
132
133 public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
134 {
135 this.resourceBundleFactory = resourceBundleFactory;
136 }
137
138 public String getName()
139 {
140 return name;
141 }
142
143 public void setName(String name)
144 {
145 this.name = name;
146 }
147 //
148 // public PageFormat getPageFormat()
149 // {
150 // return pageFormat;
151 // }
152 //
153 // public void setPageFormat(PageFormat pageFormat)
154 // {
155 // this.pageFormat = pageFormat;
156 // }
157 }