Package org.opentides.bean

Examples of org.opentides.bean.DynamicReport


   * @param extType
   * @return
   */
  private InputStream getReportStream(String reportFile, String extType) {
    InputStream stream = null;
    DynamicReport report = service.findByReportFile(reportFile);
    if (report!=null) {
      // load report from uploaded path
      String uploadPath = report.getReportPath() + "/" + reportFile + "." + extType;
      try {
        stream = new FileInputStream(uploadPath);
      } catch (FileNotFoundException e) {
        _log.error("Report file not found. ["+uploadPath+"]",e);
      }
View Full Code Here


  private Map<String, DynamicReportParameter> dynamicParameters;
  private String jasperPath;
 
  @Transactional(readOnly=true)
  public DynamicReport findByName(String name) {
    DynamicReport example = new DynamicReport();
    example.setName(name);
    List<DynamicReport> reportList = getDao().findByExample(example, true);
    if (reportList != null && reportList.size() > 0) {
      return reportList.get(0);
    }
    return null;
View Full Code Here

    return null;
  }
 
  @Transactional(readOnly=true)
  public DynamicReport findByReportFile(String reportFile) {
    DynamicReport example = new DynamicReport();
    example.setReportFile(reportFile);
    List<DynamicReport> reportList = getDao().findByExample(example, true);
    if (reportList != null && reportList.size() > 0) {
      return reportList.get(0);
    }
    return null;
View Full Code Here

   *
   * @see org.springframework.validation.Validator#validate(java.lang.Object,
   *      org.springframework.validation.Errors)
   */
  public void validate(Object clazz, Errors e) {
    DynamicReport report = (DynamicReport) clazz;

    if(!StringUtil.isEmpty(report.getName()) && isDuplicateName(report))
      e.reject("error.duplicate-name", new Object[]{"\""+report.getName()+"\"","name"}, "\""+report.getName() +"\" already exists. Please try a different name.");
   
    ValidationUtils.rejectIfEmpty(e, "name", "error.required", new Object[] { "Name" });
    ValidationUtils.rejectIfEmpty(e, "title", "error.required", new Object[] { "Title" });
    ValidationUtils.rejectIfEmpty(e, "reportGroup", "error.required", new Object[] { "Report Group" });
   
    String reportFile = "";
   
    if (report.getJasperFile()==null && report.isNew())
      e.reject("error.required", new Object[] { "Jasper File" }, "Jasper File is required.");
    else {
      String jasperFile = FileUtil.getFilename(report.getJasperFile().getOriginalFilename());
      if (!StringUtil.isEmpty(jasperFile)) {
        if (jasperFile.endsWith(".jasper"))
          reportFile = jasperFile.substring(0, jasperFile.length()-7);
        else
          e.reject("error.jasper-file-must-have-extension-of-jasper", "Jasper File must have extension of .jasper");
      } else if (report.isNew())
        e.reject("error.required", new Object[] { "Jasper File" }, "Jasper File is required.");       
    }
    if (report.getJrxmlFile()==null && report.isNew())
      e.reject("error.required", new Object[] { "Jrxml File" }, "Jrxml File is required.");
    else {
      String jrxmlFile = FileUtil.getFilename(report.getJrxmlFile().getOriginalFilename());
      if (!StringUtil.isEmpty(jrxmlFile)) {
        if (jrxmlFile.endsWith(".jrxml")) {
          if (reportFile.equals(jrxmlFile.substring(0, jrxmlFile.length()-6)))
            report.setReportFile(reportFile);
          else
            e.reject("error.jrxml-file-must-have-same-filename-with-jasper-file","Jrxml File must have same filename with Jasper File.")
        } else
          e.reject("error.jrxml-file-must-have-extension-of-jrxml", "Jrxml File must have extension of .jrxml");
      } else if (report.isNew())
        e.reject("error.required", new Object[] { "Jrxml File" }, "Jrxml File is required.");
    }
  }
View Full Code Here

   * to the current user.
   * @return
   */
  @Transactional(readOnly=true)
  public List<DynamicReport> getCurrentUserReports() {
    DynamicReport example = new DynamicReport();
    List<DynamicReport> reports = new ArrayList<DynamicReport>();
    for (DynamicReport report:findByExample(example, true)) {
      if (StringUtil.isEmpty(report.getAccessCode()))
        reports.add(report);
      else if (SecurityUtil.currentUserHasPermission(report.getAccessCode()))
View Full Code Here

   *
   * @param fieldName name of field
   * @return boolean returns true if duplicate name was found, false otherwise
   */
  public boolean isDuplicateName(DynamicReport report){
    DynamicReport key;
    try {
      key = this.reportService.findByName(report.getName());
      if (key != null){
        if(!key.getId().equals(report.getId()))
          return true;
      }
    } catch (EntityNotFoundException e) {
      return false;
    }
View Full Code Here

TOP

Related Classes of org.opentides.bean.DynamicReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.