01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.ubt.report.view.report;
06:
07: import com.sun.portal.ubt.report.data.file.raw.ContainerRenderMiner;
08: import com.sun.portal.ubt.report.view.IllegalDataSourceException;
09: import com.sun.portal.ubt.report.view.IllegalMinerException;
10: import com.sun.portal.ubt.report.view.chart.ContainerRenderChart;
11: import com.sun.portal.ubt.report.view.toc.PortalContainerRenderToc;
12: import com.sun.portal.ubt.report.util.UBTReportResourceBundle;
13: import net.sf.jasperreports.engine.JRException;
14: import net.sf.jasperreports.engine.JasperFillManager;
15: import net.sf.jasperreports.engine.JasperReport;
16: import net.sf.jasperreports.engine.JasperPrint;
17: import net.sf.jasperreports.engine.JRParameter;
18: import net.sf.jasperreports.engine.data.JRTableModelDataSource;
19: import net.sf.jasperreports.engine.util.JRLoader;
20:
21: import java.util.ResourceBundle;
22:
23: /**
24: *
25: */
26: public class PortalContainerRenderReport extends UBTReportAdapter {
27: private static final String CONTAINER_CHART = "ContainerChart";
28: private static final String PORTAL_CONTAINER_RENDER_TOC = "PortalContainerRenderToc";
29:
30: public PortalContainerRenderReport() {
31: this .reportName = UBTReportI.PORTAL_CONTAINER_RENDER;
32: this .miner[0] = new ContainerRenderMiner();
33: }
34:
35: public void fill() throws IllegalMinerException, JRException,
36: IllegalDataSourceException {
37: prepareToFill();
38: JasperFillManager.fillReportToFile(this .getJasperFileName(),
39: this .getJrprintFileName(), this .reportParameters,
40: new JRTableModelDataSource(null));
41: }
42:
43: private void prepareToFill() throws JRException,
44: IllegalMinerException, IllegalDataSourceException {
45: this .reportParameters.put(
46: UBTReportI.REPORT_LOCAL_DATE_PROPERTY, this .getLDate());
47: this .reportParameters.put(UBTReportI.REPORT_PORTAL_ID_PROPERTY,
48: miner[0].getPortalID());
49: this .reportParameters.put(UBTReportI.REPORT_LOGO_PROPERTY,
50: getLogo());
51: this .reportParameters.put(UBTReportI.REPORT_HELP_LINK_PROPERTY,
52: UBTReportI.PORTAL_CONTAINER_RENDER_HELP);
53: try {
54: this .reportParameters.put(UBTReportI.REPORT_TOC_PROPERTY,
55: (JasperReport) JRLoader
56: .loadObject(getTocJasperFileName()));
57: } catch (JRException e) {
58: throw e;
59: }
60: try {
61: this .reportParameters.put(CONTAINER_CHART,
62: new ContainerRenderChart(miner[0],
63: this .clientLocale).getChart());
64: } catch (IllegalMinerException e) {
65: throw e;
66: }
67: try {
68: this .reportParameters.put(PORTAL_CONTAINER_RENDER_TOC,
69: new PortalContainerRenderToc(null, clientLocale)
70: .getToc());
71: } catch (IllegalDataSourceException e) {
72: throw e;
73: }
74: this .reportParameters.put(JRParameter.REPORT_LOCALE,
75: this .clientLocale);
76: this .reportParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE,
77: ResourceBundle.getBundle(
78: UBTReportResourceBundle.UBT_REPORT_RESOURCE,
79: clientLocale));
80:
81: }
82:
83: public JasperPrint getReport() throws IllegalMinerException,
84: JRException, IllegalDataSourceException {
85: prepareToFill();
86: return JasperFillManager
87: .fillReport(this .getJasperFileName(),
88: this .reportParameters,
89: new JRTableModelDataSource(null));
90: }
91: }
|