Exemple #1
0
  /**
   * Generates and displays <b>BA Unit</b> report.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getLodgementReport(
      LodgementBean lodgementBean, Date dateFrom, Date dateTo) {
    HashMap inputParameters = new HashMap();
    Date currentdate = new Date(System.currentTimeMillis());
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());

    inputParameters.put("CURRENT_DATE", currentdate);

    inputParameters.put("USER", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("FROMDATE", dateFrom);
    inputParameters.put("TODATE", dateTo);
    LodgementBean[] beans = new LodgementBean[1];
    beans[0] = lodgementBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);
    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/LodgementReportSamoa.jasper"),
          inputParameters,
          jds);
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }