001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005: package com.sun.portal.ubt.report.view.report;
006:
007: import com.sun.portal.ubt.report.data.file.raw.ContainerWiseActionsMiner;
008: import com.sun.portal.ubt.report.data.file.raw.ContainerWiseUserActionsMiner;
009: import com.sun.portal.ubt.report.data.DataMiner;
010: import com.sun.portal.ubt.report.view.chart.ContainerActionsChart;
011: import com.sun.portal.ubt.report.view.chart.ContainerActionsRateChart;
012: import com.sun.portal.ubt.report.view.toc.PortalContainerCustomizationToc;
013: import com.sun.portal.ubt.report.view.IllegalMinerException;
014: import com.sun.portal.ubt.report.view.IllegalDataSourceException;
015: import com.sun.portal.ubt.report.util.UBTReportResourceBundle;
016: import net.sf.jasperreports.engine.JasperReport;
017: import net.sf.jasperreports.engine.JRException;
018: import net.sf.jasperreports.engine.JasperFillManager;
019: import net.sf.jasperreports.engine.JasperPrint;
020: import net.sf.jasperreports.engine.JRParameter;
021: import net.sf.jasperreports.engine.data.JRTableModelDataSource;
022: import net.sf.jasperreports.engine.util.JRLoader;
023:
024: import java.util.ResourceBundle;
025:
026: /**
027: *
028: */
029: public class PortalContainerCustomizationReport extends
030: UBTReportAdapter {
031: private static String CUSTOMIZATION_CHART = "CustomizationChart";
032: private static String CUSTOMIZATION_RATE_CHART = "CustomizationRateChart";
033:
034: private static final String PORTAL_CONTAINER_CUSTOMIZATION_TOC = "PortalContainerCustomizationToc";
035:
036: public PortalContainerCustomizationReport() {
037: this .reportName = UBTReportI.PORTAL_CONTAINER_CUSTOMIZATION;
038: this .miner = new DataMiner[2];
039: this .miner[0] = new ContainerWiseActionsMiner();
040: this .miner[1] = new ContainerWiseUserActionsMiner();
041: }
042:
043: private void prepareToFill() throws IllegalMinerException,
044: JRException, IllegalDataSourceException {
045: this .reportParameters.put(
046: UBTReportI.REPORT_LOCAL_DATE_PROPERTY, this .getLDate());
047: this .reportParameters.put(UBTReportI.REPORT_PORTAL_ID_PROPERTY,
048: miner[0].getPortalID());
049: this .reportParameters.put(UBTReportI.REPORT_LOGO_PROPERTY,
050: getLogo());
051: this .reportParameters.put(UBTReportI.REPORT_HELP_LINK_PROPERTY,
052: UBTReportI.PORTAL_CONTAINER_CUSTOMIZATION_HELP);
053: try {
054: this .reportParameters.put(UBTReportI.REPORT_TOC_PROPERTY,
055: (JasperReport) JRLoader
056: .loadObject(getTocJasperFileName()));
057: } catch (JRException e) {
058: throw e;
059: }
060: try {
061: this .reportParameters.put(CUSTOMIZATION_CHART,
062: new ContainerActionsChart(miner[0],
063: this .clientLocale).getChart());
064: this .reportParameters.put(CUSTOMIZATION_RATE_CHART,
065: new ContainerActionsRateChart(miner[1],
066: this .clientLocale).getChart());
067: } catch (IllegalMinerException e) {
068: throw e;
069: }
070: try {
071: this .reportParameters.put(
072: PORTAL_CONTAINER_CUSTOMIZATION_TOC,
073: new PortalContainerCustomizationToc(null,
074: clientLocale).getToc());
075: } catch (IllegalDataSourceException e) {
076: throw e;
077: }
078: this .reportParameters.put(JRParameter.REPORT_LOCALE,
079: this .clientLocale);
080: this .reportParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE,
081: ResourceBundle.getBundle(
082: UBTReportResourceBundle.UBT_REPORT_RESOURCE,
083: clientLocale));
084: }
085:
086: public void fill() throws IllegalMinerException, JRException,
087: IllegalDataSourceException {
088: prepareToFill();
089: JasperFillManager.fillReportToFile(this .getJasperFileName(),
090: this .getJrprintFileName(), this .reportParameters,
091: new JRTableModelDataSource(null));
092: }
093:
094: public JasperPrint getReport() throws IllegalMinerException,
095: JRException, IllegalDataSourceException {
096: prepareToFill();
097: return JasperFillManager
098: .fillReport(this .getJasperFileName(),
099: this .reportParameters,
100: new JRTableModelDataSource(null));
101: }
102: }
|