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.PortletActionsMiner;
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.PortletActionsRateChart;
11: import com.sun.portal.ubt.report.view.toc.PortletActionsToc;
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 PortletActionsReport extends UBTReportAdapter {
27: private static final String PORTLET_ACTIONS_CHART = "PortletActionsChart";
28: private static final String PORTLET_ACTIONS_TOC = "PortletActionsToc";
29:
30: public PortletActionsReport() {
31: this .reportName = UBTReportI.PORTLET_ACTIONS;
32: this .miner[0] = new PortletActionsMiner();
33: }
34:
35: private void prepareToFill() throws JRException,
36: IllegalMinerException, IllegalDataSourceException {
37: this .reportParameters.put(
38: UBTReportI.REPORT_LOCAL_DATE_PROPERTY, this .getLDate());
39: this .reportParameters.put(UBTReportI.REPORT_PORTAL_ID_PROPERTY,
40: miner[0].getPortalID());
41: this .reportParameters.put(UBTReportI.REPORT_LOGO_PROPERTY,
42: getLogo());
43: this .reportParameters.put(UBTReportI.REPORT_HELP_LINK_PROPERTY,
44: UBTReportI.PORTLET_ACTIONS_HELP);
45: try {
46: this .reportParameters.put(UBTReportI.REPORT_TOC_PROPERTY,
47: (JasperReport) JRLoader
48: .loadObject(getTocJasperFileName()));
49: } catch (JRException e) {
50: throw e;
51: }
52: try {
53: this .reportParameters.put(PORTLET_ACTIONS_CHART,
54: new PortletActionsRateChart(miner[0],
55: this .clientLocale).getChart());
56: } catch (IllegalMinerException e) {
57: throw e;
58: }
59: try {
60: this .reportParameters.put(PORTLET_ACTIONS_TOC,
61: new PortletActionsToc(null, clientLocale).getToc());
62: } catch (IllegalDataSourceException e) {
63: throw e;
64: }
65: this .reportParameters.put(JRParameter.REPORT_LOCALE,
66: this .clientLocale);
67: this .reportParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE,
68: ResourceBundle.getBundle(
69: UBTReportResourceBundle.UBT_REPORT_RESOURCE,
70: clientLocale));
71: }
72:
73: public void fill() throws IllegalMinerException, JRException,
74: IllegalDataSourceException {
75: prepareToFill();
76: JasperFillManager.fillReportToFile(this .getJasperFileName(),
77: this .getJrprintFileName(), this .reportParameters,
78: new JRTableModelDataSource(null));
79: }
80:
81: public JasperPrint getReport() throws IllegalMinerException,
82: JRException, IllegalDataSourceException {
83: prepareToFill();
84: return JasperFillManager
85: .fillReport(this .getJasperFileName(),
86: this .reportParameters,
87: new JRTableModelDataSource(null));
88: }
89: }
|