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.UserIdentityMiner;
08: import com.sun.portal.ubt.report.data.file.derived.UserIdentityDataSource;
09: import com.sun.portal.ubt.report.view.chart.UserIdentityChart;
10: import com.sun.portal.ubt.report.view.toc.PortalUserIdentityToc;
11: import com.sun.portal.ubt.report.view.IllegalMinerException;
12: import com.sun.portal.ubt.report.view.IllegalDataSourceException;
13: import com.sun.portal.ubt.report.util.UBTReportResourceBundle;
14: import net.sf.jasperreports.engine.JasperReport;
15: import net.sf.jasperreports.engine.JRException;
16: import net.sf.jasperreports.engine.JasperFillManager;
17: import net.sf.jasperreports.engine.JasperPrint;
18: import net.sf.jasperreports.engine.JRParameter;
19: import net.sf.jasperreports.engine.data.JRTableModelDataSource;
20: import net.sf.jasperreports.engine.util.JRLoader;
21:
22: import java.util.ResourceBundle;
23:
24: /**
25: *
26: */
27: public class PortalUserIdentityReport extends UBTReportAdapter {
28: public static final String PORTAL_USER_BAR = "PortalUserBar";
29: public static final String PORTAL_USER_IDENTITY_TOC = "PortalUserIdentityToc";
30: UserIdentityDataSource dataSource;
31:
32: public PortalUserIdentityReport() {
33: this .reportName = UBTReportI.PORTAL_USER_IDENTITY;
34: this .miner[0] = new UserIdentityMiner();
35: }
36:
37: private void prepareToFill() throws IllegalMinerException,
38: JRException, IllegalDataSourceException {
39: dataSource = new UserIdentityDataSource(miner[0]);
40: this .reportParameters.put(
41: UBTReportI.REPORT_LOCAL_DATE_PROPERTY, this .getLDate());
42: this .reportParameters.put(UBTReportI.REPORT_PORTAL_ID_PROPERTY,
43: miner[0].getPortalID());
44: this .reportParameters.put(UBTReportI.REPORT_LOGO_PROPERTY,
45: getLogo());
46: this .reportParameters.put(UBTReportI.REPORT_HELP_LINK_PROPERTY,
47: UBTReportI.PORTAL_USER_IDENTITY_HELP);
48: try {
49: this .reportParameters.put(UBTReportI.REPORT_TOC_PROPERTY,
50: (JasperReport) JRLoader
51: .loadObject(getTocJasperFileName()));
52: } catch (JRException e) {
53: throw e;
54: }
55: try {
56: this .reportParameters.put(PORTAL_USER_BAR,
57: new UserIdentityChart(miner[0], this .clientLocale)
58: .getChart());
59: } catch (IllegalMinerException e) {
60: throw e;
61: }
62: try {
63: this .reportParameters.put(PORTAL_USER_IDENTITY_TOC,
64: new PortalUserIdentityToc(dataSource, clientLocale)
65: .getToc());
66: } catch (IllegalDataSourceException e) {
67: throw e;
68: }
69: this .reportParameters.put(JRParameter.REPORT_LOCALE,
70: this .clientLocale);
71: this .reportParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE,
72: ResourceBundle.getBundle(
73: UBTReportResourceBundle.UBT_REPORT_RESOURCE,
74: clientLocale));
75: }
76:
77: public void fill() throws IllegalMinerException, JRException,
78: IllegalDataSourceException {
79: prepareToFill();
80: JasperFillManager.fillReportToFile(this .getJasperFileName(),
81: this .getJrprintFileName(), this .reportParameters,
82: new JRTableModelDataSource(dataSource));
83: }
84:
85: public JasperPrint getReport() throws IllegalMinerException,
86: JRException, IllegalDataSourceException {
87: prepareToFill();
88: return JasperFillManager.fillReport(this .getJasperFileName(),
89: this .reportParameters, new JRTableModelDataSource(
90: dataSource));
91: }
92: }
|