1:
31: package ;
32:
33: import ;
34:
35: import ;
36: import ;
37: import ;
38: import ;
39: import ;
40: import ;
41:
42:
47: public class DefaultReportJob
48: implements ReportJob
49: {
50: private ReportStructureRoot report;
51: private ReportDataFactory dataFactory;
52: private ReportParameters parameters;
53: private ModifiableConfiguration configuration;
54: private ResourceBundleFactory resourceBundleFactory;
55: private String name;
56:
57:
58: public DefaultReportJob(final ReportStructureRoot report)
59: {
60: this.resourceBundleFactory = new DefaultResourceBundleFactory();
61: this.report = report;
62: final ReportDataFactory dataFactory = report.getDataFactory();
63: if (dataFactory != null)
64: {
65: this.dataFactory = dataFactory.derive();
66: }
67: this.parameters = new ReportParameters(report.getInputParameters());
68: this.configuration = new HierarchicalConfiguration(report.getConfiguration());
69: }
70:
71: public ModifiableConfiguration getConfiguration()
72: {
73: return configuration;
74: }
75:
76: public ReportParameters getParameters()
77: {
78: return parameters;
79: }
80:
81: public ReportStructureRoot getReportStructureRoot()
82: {
83: return report;
84: }
85:
86: public ReportDataFactory getDataFactory()
87: {
88: return dataFactory;
89: }
90:
91: public void setDataFactory(final ReportDataFactory dataFactory)
92: {
93: this.dataFactory = dataFactory;
94: }
95:
96: public Object clone() throws CloneNotSupportedException
97: {
98: final DefaultReportJob job = (DefaultReportJob) super.clone();
99: if (dataFactory != null)
100: {
101: job.dataFactory = dataFactory.derive();
102: }
103: job.parameters = (ReportParameters) parameters.clone();
104: job.configuration = (ModifiableConfiguration) configuration.clone();
105: return job;
106: }
107:
108: public ReportJob derive()
109: {
110: try
111: {
112: return (ReportJob) clone();
113: }
114: catch (CloneNotSupportedException e)
115: {
116: throw new IllegalStateException
117: ("A report job should always be cloneable.");
118: }
119: }
120:
121: public synchronized void close()
122: {
123: if (dataFactory != null)
124: {
125: dataFactory.close();
126: }
127: }
128:
129: public ResourceBundleFactory getResourceBundleFactory()
130: {
131: return resourceBundleFactory;
132: }
133:
134: public void setResourceBundleFactory(final ResourceBundleFactory resourceBundleFactory)
135: {
136: this.resourceBundleFactory = resourceBundleFactory;
137: }
138:
139: public String getName()
140: {
141: return name;
142: }
143:
144: public void setName(final String name)
145: {
146: this.name = name;
147: }
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158: }