Package org.efs.openreports.objects

Examples of org.efs.openreports.objects.ReportDataSource


    try
    {
      Report report = input.getReport();
      Map<String,Object> parameters = input.getParameters();
     
      ReportDataSource dataSource = report.getDataSource();
      conn = dataSourceProvider.getConnection(dataSource.getId());

      if (parameters == null || parameters.isEmpty())
      {
        pStmt = conn.prepareStatement(report.getQuery());
      }
View Full Code Here


   
    try
    {
      reportLogProvider.insertReportLog(alertLog);
     
      ReportDataSource dataSource = userAlert.getAlert().getDataSource();
      conn = dataSourceProvider.getConnection(dataSource.getId());
     
      pStmt = conn.prepareStatement(userAlert.getAlert().getQuery());

      rs = pStmt.executeQuery();
View Full Code Here

    try
    {
      Report report = input.getReport();
      Map parameters = input.getParameters();
     
      ReportDataSource dataSource = report.getDataSource();
      conn = dataSourceProvider.getConnection(dataSource.getId());

      if (parameters == null || parameters.isEmpty())
      {
        pStmt = conn.prepareStatement(report.getQuery());
      }
View Full Code Here

           
            log.info("Importing: " + report.getName());
           
            if (report.getDataSource() != null)
            {
              ReportDataSource dataSource = dataSourceProvider.getDataSource(report.getDataSource().getName());
              if (dataSource == null)
              {           
                dataSource = dataSourceProvider.insertDataSource(report.getDataSource());
                log.info("Adding DataSource: " + dataSource.getName());
              }
              report.setDataSource(dataSource);
            }
           
            if (report.getReportChart() != null)
            {
              ReportChart chart = chartProvider.getReportChart(report.getReportChart().getName());
              if (chart == null)
              {
                if (report.getReportChart().getDataSource() != null)
                {
                  ReportDataSource dataSource = dataSourceProvider.getDataSource(report.getReportChart().getDataSource().getName());
                  if (dataSource == null)
                  {           
                    dataSource = dataSourceProvider.insertDataSource(report.getReportChart().getDataSource());
                    log.info("Adding DataSource: " + dataSource.getName());
                  }
                  report.getReportChart().setDataSource(dataSource);
                }
               
                if (report.getReportChart().getDrillDownReport() != null)
                {
                  Report drillDownReport = reportProvider.getReport(report.getReportChart().getDrillDownReport().getName());
                  if (drillDownReport == null)
                  {           
                    drillDownReport = reportProvider.insertReport(report.getReportChart().getDrillDownReport());
                    log.info("Adding Report: " + drillDownReport.getName());
                  }
                  report.getReportChart().setDrillDownReport(drillDownReport);
                }
               
                if (report.getReportChart().getOverlayChart() != null)
                {
                  ReportChart overlayChart = chartProvider.getReportChart(report.getReportChart().getOverlayChart().getName());
                  if (overlayChart == null)
                  {           
                    overlayChart = chartProvider.insertReportChart(report.getReportChart().getOverlayChart());
                    log.info("Adding Chart: " + overlayChart.getName());
                  }
                  report.getReportChart().setOverlayChart(overlayChart);
                }
               
                chart = chartProvider.insertReportChart(report.getReportChart());
                log.info("Adding Chart: " + chart.getName());
              }
              report.setReportChart(chart);
            }
           
            if (report.getParameters() != null)
            {
              List<ReportParameterMap> parameters = report.getParameters();
              List<ReportParameterMap> duplicateParameters = new ArrayList<ReportParameterMap>();
             
              for (ReportParameterMap map: parameters)
              {               
                ReportParameter parameter = parameterProvider.getReportParameter(map.getReportParameter().getName());
                if (parameter == null)
                {
                  if (map.getReportParameter().getDataSource() != null)
                  {
                    ReportDataSource dataSource = dataSourceProvider.getDataSource(map.getReportParameter().getDataSource().getName());
                    if (dataSource == null)
                    {           
                      dataSource = dataSourceProvider.insertDataSource(map.getReportParameter().getDataSource());
                      log.info("Adding DataSource: " + dataSource.getName());
                    }
                    map.getReportParameter().setDataSource(dataSource);
                  }
                 
                  parameter = parameterProvider.insertReportParameter(map.getReportParameter());
View Full Code Here

    Connection conn = null;

    Report report = input.getReport();
    Map<String,Object> parameters = input.getParameters();
   
    ReportDataSource dataSource = report.getDataSource();

    try
    {
      JasperReport jr = null;

      if (report.isQueryReport()) return fillQueryReport(report, parameters, input.getExportType());

      jr = (JasperReport) JRLoader
          .loadObject(directoryProvider.getReportDirectory() + report.getFile());

      List<ReportParameterMap> subReports = report.getSubReportParameters();
      if (subReports != null && subReports.size() > 0)
      {
        Iterator<ReportParameterMap> iterator = report.getSubReportParameters().iterator();
        while (iterator.hasNext())
        {
          ReportParameterMap rpMap = iterator.next();

          JasperReport subReport = (JasperReport) JRLoader.loadObject(directoryProvider
              .getReportDirectory()
              + rpMap.getReportParameter().getData());

          parameters.put(rpMap.getReportParameter().getName(), subReport);
        }
      }

      JasperPrint jp = null;

      // create new HashMap to send to JasperReports in order to
      // fix serialization problems
      Map<String,Object> jasperReportMap = new HashMap<String,Object>(parameters);
           
            if (input.getXmlInput() != null)
            {
                ByteArrayInputStream stream = new ByteArrayInputStream(input.getXmlInput().getBytes());
                Document document = JRXmlUtils.parse(stream);
               
                jasperReportMap.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
                              
                jp = JasperFillManager.fillReport(jr, jasperReportMap);              
            }
            else if (dataSource == null)
      {       
        jp = JasperFillManager.fillReport(jr, jasperReportMap, new JREmptyDataSource());
      }
      else
      {
        conn = dataSourceProvider.getConnection(dataSource.getId());
        jp = JasperFillManager.fillReport(jr, jasperReportMap, conn);
      }

      if (jp == null || jp.getPages().size() < 1) throw new ProviderException(LocalStrings.ERROR_REPORT_EMPTY);
View Full Code Here

    List<?> results = null;
    DynaProperty[] properties = null;

    try
    {
      ReportDataSource dataSource = report.getDataSource();
      conn = dataSourceProvider.getConnection(dataSource.getId());

      if (parameters == null || parameters.isEmpty())
      {
        pStmt = conn.prepareStatement(report.getQuery());
      }
View Full Code Here

      {
        OdaDataSourceHandle dataSH = (OdaDataSourceHandle) dataSource;
     
        try
        {       
          ReportDataSource reportDataSource = dataSourceProvider
              .getDataSource(dataSH.getName());
         
          if (reportDataSource != null)
          {   
            log.info("Overriding BIRT DataSource: " + dataSH.getName());
           
            log.debug("Original connection properties for: " + dataSH.getName());
            log.debug("URL:    " + dataSH.getStringProperty("odaURL"));
            log.debug("DRIVER:    " + dataSH.getStringProperty("odaDriverClass"));
            log.debug("USER:   " + dataSH.getStringProperty("odaUser"));             
 
            try
            {
              dataSH.setStringProperty("odaURL", reportDataSource.getUrl());
              dataSH.setStringProperty("odaDriverClass", reportDataSource.getDriverClassName());
              dataSH.setStringProperty("odaUser", reportDataSource.getUsername());
              dataSH.setStringProperty("odaPassword", reportDataSource.getPassword());           
            }
            catch (SemanticException e)
            {
              log.error("SemanticException", e);
            }
View Full Code Here

  @Override
  public String execute()
  {
    try
    {
      ReportDataSource reportDataSource = null;

      if (command.equals("edit"))
      {
        reportDataSource =
          dataSourceProvider.getDataSource(new Integer(id));
      }
      else
      {
        reportDataSource = new ReportDataSource();
      }

      if (command.equals("edit") && !submitOk && !submitDuplicate)
      {
        id = reportDataSource.getId().intValue();
        name = reportDataSource.getName();
        driver = reportDataSource.getDriverClassName();
        url = reportDataSource.getUrl();
        userName = reportDataSource.getUsername();
        password = reportDataSource.getPassword();
        maxIdle = reportDataSource.getMaxIdle();
        maxActive = reportDataSource.getMaxActive();
        validationQuery = reportDataSource.getValidationQuery();
        jndi = reportDataSource.isJndi();
        maxWait = reportDataSource.getMaxWait();
      }

      if (!submitOk && !submitDuplicate) return INPUT;
     
         if (submitDuplicate)
              {
                command = "add";
                reportDataSource.setId(null);
               
                if (reportDataSource.getName().equals(name))
                {
                  name = "Copy of ".concat(name);
                }
              }

      reportDataSource.setName(name);
      reportDataSource.setDriverClassName(driver);
      reportDataSource.setUrl(url);
      reportDataSource.setUsername(userName);
      reportDataSource.setPassword(password);
      reportDataSource.setMaxIdle(maxIdle);
      reportDataSource.setMaxActive(maxActive);
      reportDataSource.setJndi(jndi);
      reportDataSource.setMaxWait(maxWait);     
     
      if (validationQuery == null || validationQuery.length() < 1)
      {
        reportDataSource.setValidationQuery(null);
      }
      else
      {
        reportDataSource.setValidationQuery(validationQuery);
      }

      if (command.equals("edit"))
      {
        dataSourceProvider.updateDataSource(reportDataSource);
      }

      if (command.equals("add"))
      {
        reportDataSource =
          dataSourceProvider.insertDataSource(reportDataSource);
               
                id = reportDataSource.getId().intValue();
      }

      return SUCCESS;
    }
    catch (Exception e)
View Full Code Here

  {
    Iterator<ReportDataSource> iterator =  getDataSources().iterator();

    while (iterator.hasNext())
    {
      ReportDataSource dataSource = iterator.next();
      dataSources.put(dataSource.getId(), dataSource);
    }
  }
View Full Code Here

    }
  }

  public Connection getConnection(Integer id) throws ProviderException
  {
    ReportDataSource dataSource = dataSources.get(id);

    try
    {
      if (dataSource.isJndi())
      {
        Context initCtx = new InitialContext();

        DataSource jndiDataSource =
          (DataSource) initCtx.lookup(dataSource.getUrl());

        return jndiDataSource.getConnection();
      }
      else
      {
        return dataSource.getConnection();
      }
    }
    catch (Exception e)
    {
      log.error(e.toString());
View Full Code Here

TOP

Related Classes of org.efs.openreports.objects.ReportDataSource

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.