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.UserLoginMiner;
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.UserLoginChart;
11: import com.sun.portal.ubt.report.view.toc.PortalUserLoginToc;
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 PortalUserLoginReport extends UBTReportAdapter {
27: private static final String USER_LOGIN_CHART = "UserLoginChart";
28: private static final String PORTAL_USER_LOGIN_TOC = "PortalUserLoginToc";
29:
30: public PortalUserLoginReport() {
31: this .reportName = UBTReportI.PORTAL_USER_LOGIN;
32: this .miner[0] = new UserLoginMiner();
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.PORTAL_USER_LOGIN_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(USER_LOGIN_CHART,
54: new UserLoginChart(miner[0], this .clientLocale)
55: .getChart());
56: } catch (IllegalMinerException e) {
57: throw e;
58: }
59: try {
60: this .reportParameters
61: .put(PORTAL_USER_LOGIN_TOC, new PortalUserLoginToc(
62: null, clientLocale).getToc());
63: } catch (IllegalDataSourceException e) {
64: throw e;
65: }
66: this .reportParameters.put(JRParameter.REPORT_LOCALE,
67: this .clientLocale);
68: this .reportParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE,
69: ResourceBundle.getBundle(
70: UBTReportResourceBundle.UBT_REPORT_RESOURCE,
71: clientLocale));
72: }
73:
74: public void fill() throws IllegalMinerException, JRException,
75: IllegalDataSourceException {
76: prepareToFill();
77: JasperFillManager.fillReportToFile(this .getJasperFileName(),
78: this .getJrprintFileName(), this .reportParameters,
79: new JRTableModelDataSource(null));
80: }
81:
82: public JasperPrint getReport() throws IllegalMinerException,
83: JRException, IllegalDataSourceException {
84: prepareToFill();
85: return JasperFillManager
86: .fillReport(this .getJasperFileName(),
87: this .reportParameters,
88: new JRTableModelDataSource(null));
89: }
90: }
|