Example #1
0
  /**
   * Generates and displays <b>Lodgement notice</b> report for the new application.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getLodgementNoticeReport(
      ApplicationBean appBean, boolean isProduction) {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("IS_PRODUCTION", isProduction);
    ApplicationBean[] beans = new ApplicationBean[1];
    beans[0] = appBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);
    inputParameters.put(
        "IMAGE_SCRITTA_GREEN",
        ReportManager.class.getResourceAsStream("/images/sola/govSamoa.gif"));
    inputParameters.put("WHICH_CALLER", "N");

    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/ApplicationPrintingForm.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;
    }
  }
Example #2
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;
    }
  }
Example #3
0
 /** Generates and displays <b>BR VAlidaction Report</b>. */
 public static JasperPrint getBrValidaction() {
   HashMap inputParameters = new HashMap();
   inputParameters.put("REPORT_LOCALE", Locale.getDefault());
   inputParameters.put("today", new Date());
   inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getUserName());
   BrListBean brList = new BrListBean();
   brList.FillBrs();
   int sizeBrList = brList.getBrBeanList().size();
   BrReportBean[] beans = new BrReportBean[sizeBrList];
   for (int i = 0; i < sizeBrList; i++) {
     beans[i] = brList.getBrBeanList().get(i);
   }
   JRDataSource jds = new JRBeanArrayDataSource(beans);
   try {
     return JasperFillManager.fillReport(
         ReportManager.class.getResourceAsStream("/reports/BrValidaction.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;
   }
 }
Example #4
0
  /** Generates and displays <b>BR Report</b>. */
  public static JasperPrint getBrReport() {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    BrListBean brList = new BrListBean();
    brList.FillBrs();
    int sizeBrList = brList.getBrBeanList().size();

    BrReportBean[] beans = new BrReportBean[sizeBrList];
    for (int i = 0; i < sizeBrList; i++) {
      beans[i] = brList.getBrBeanList().get(i);
      if (beans[i].getFeedback() != null) {
        String feedback = beans[i].getFeedback();
        feedback = feedback.substring(0, feedback.indexOf("::::"));
        beans[i].setFeedback(feedback);
      }

      if (i > 0) {
        String idPrev = beans[i - 1].getId();
        String technicalTypeCodePrev = beans[i - 1].getTechnicalTypeCode();
        String id = beans[i].getId();
        String technicalTypeCode = beans[i].getTechnicalTypeCode();

        if (id.equals(idPrev) && technicalTypeCode.equals(technicalTypeCodePrev)) {

          beans[i].setId("");
          beans[i].setBody("");
          beans[i].setDescription("");
          beans[i].setFeedback("");
          beans[i].setTechnicalTypeCode("");
        }
      }
    }

    JRDataSource jds = new JRBeanArrayDataSource(beans);
    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/BrReport.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;
    }
  }
Example #5
0
  /**
   * Generates and displays <b>Application status report</b>.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getApplicationStatusReport(ApplicationBean appBean) {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    ApplicationBean[] beans = new ApplicationBean[1];
    beans[0] = appBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);

    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/ApplicationStatusReport.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;
    }
  }
Example #6
0
  /**
   * Generates and displays <b>SolaPrintReport</b> for the map.
   *
   * @param layoutId String This is the id of the report. It is used to identify the report file.
   * @param dataBean Object containing data for the report. it can be replaced with appropriate bean
   *     if needed
   * @param mapImageLocation String this is the location of the map to be passed as MAP_IMAGE
   *     PARAMETER to the report. It is necessary for visualizing the map
   * @param scalebarImageLocation String this is the location of the scalebar to be passed as
   *     SCALE_IMAGE PARAMETER to the report. It is necessary for visualizing the scalebar
   */
  public static JasperPrint getSolaPrintReport(
      String layoutId, Object dataBean, String mapImageLocation, String scalebarImageLocation)
      throws IOException {

    // Image Location of the north-arrow image
    String navigatorImage = "/images/sola/north-arrow.png";
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("MAP_IMAGE", mapImageLocation);
    inputParameters.put("SCALE_IMAGE", scalebarImageLocation);
    inputParameters.put("NAVIGATOR_IMAGE", ReportManager.class.getResourceAsStream(navigatorImage));
    inputParameters.put("LAYOUT", layoutId);
    inputParameters.put(
        "INPUT_DATE", DateFormat.getInstance().format(Calendar.getInstance().getTime()));

    // This will be the bean containing data for the report.
    // it is the data source for the report
    // it must be replaced with appropriate bean if needed
    Object[] beans = new Object[1];
    beans[0] = dataBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);

    // this generates the report.
    // NOTICE THAT THE NAMING CONVENTION IS TO PRECEED "SolaPrintReport.jasper"
    // WITH THE LAYOUT NAME. SO IT MUST BE PRESENT ONE REPORT FOR EACH LAYOUT FORMAT
    try {
      JasperPrint jasperPrint =
          JasperFillManager.fillReport(
              ReportManager.class.getResourceAsStream("/reports/map/" + layoutId + ".jasper"),
              inputParameters,
              jds);
      return jasperPrint;
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Example #7
0
 /**
  * Generates and displays <b>Historical Search</b> report.
  *
  * @param appBean Application bean containing data for the report.
  */
 public static JasperPrint getHistoricalSearchReport(BaUnitBean baUnitBean, boolean isProduction) {
   HashMap inputParameters = new HashMap();
   inputParameters.put("REPORT_LOCALE", Locale.getDefault());
   inputParameters.put("USER", SecurityBean.getCurrentUser().getFullUserName());
   inputParameters.put("IS_PRODUCTION", isProduction);
   BaUnitBean[] beans = new BaUnitBean[1];
   beans[0] = baUnitBean;
   JRDataSource jds = new JRBeanArrayDataSource(beans);
   inputParameters.put(
       "SAMOA_EMBLEM", ReportManager.class.getResourceAsStream("/images/sola/samEmblem.png"));
   try {
     return JasperFillManager.fillReport(
         ReportManager.class.getResourceAsStream("/reports/HistoricalSearch.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;
   }
 }