Examples of MemoryReportWriter


Examples of com.google.api.ads.adwords.awreporting.exporter.reportwriter.MemoryReportWriter

    try {
      getParameters();
     
      StringReader stringReader = new StringReader(html);

      MemoryReportWriter memoryReportWriter = MemoryReportWriter.newMemoryReportWriter();     
      Document document = XMLResource.load(stringReader).getDocument();
      HTMLExporter.exportHtmlToPdf(document, memoryReportWriter, null);

      result = createPdfResult(memoryReportWriter.getAsSource());

    } catch (Exception exception) {
      return handleException(exception);
    }
    addHeaders();   
View Full Code Here

Examples of com.google.api.ads.adwords.awreporting.exporter.reportwriter.MemoryReportWriter

        fontPaths = Arrays.asList(propertyReportFonts.split(","));
      }

      LOGGER.debug("Generating in Memory HTML for account: " + accountId);
      // Writing HTML to Memory
      MemoryReportWriter mrwHtml = MemoryReportWriter.newMemoryReportWriter();
      HTMLExporter.exportHtml(reportDataMap, template, mrwHtml);

      if (propertyReportWriterType != null &&
          propertyReportWriterType.equals(ReportWriterType.GoogleDriveWriter.name())) {
       
        // One folder per account
        Boolean perAccountFolder = false;
        if (properties.getProperty("aw.report.exporter.reportwritertype.drive.peraccountfolder") != null) {
          perAccountFolder = Boolean.valueOf(properties.getProperty("aw.report.exporter.writeDriveDoc"));
        }

        // Writing HTML to GoogleDrive
        if (writeHtml) {
          LOGGER.debug("Writing (to GoogleDrive) HTML for account: " + accountId);
          GoogleDriveReportWriter gdrwHtml = new GoogleDriveReportWriter.GoogleDriveReportWriterBuilder(
              accountId, dateStart, dateEnd, mccAccountId, credential, ReportFileType.HTML,
              templateName)
            .withFolderPerAccount(perAccountFolder)
            .build();
          gdrwHtml.write(mrwHtml.getAsSource());
        }

        // Writing PDF to GoogleDrive
        if (writePdf) {
          LOGGER.debug("Writing (to GoogleDrive) PDF for account: " + accountId);
          GoogleDriveReportWriter gdrwPdf = new GoogleDriveReportWriter.GoogleDriveReportWriterBuilder(
              accountId, dateStart, dateEnd, mccAccountId, credential, ReportFileType.PDF,
              templateName)
            .withFolderPerAccount(perAccountFolder)
            .build();
          HTMLExporter.exportHtmlToPdf(mrwHtml.getAsSource(), gdrwPdf, fontPaths);
        }
       
        // Writing Drive Doc to GoogleDrive
        if (writeDriveDoc) {
          LOGGER.debug("Writing GoogleDrive Doc for account: " + accountId);
          GoogleDriveReportWriter gdrwDriveDoc = new GoogleDriveReportWriter.GoogleDriveReportWriterBuilder(
              accountId, dateStart, dateEnd, mccAccountId, credential, ReportFileType.DRIVE_DOC,
              templateName)
            .withFolderPerAccount(perAccountFolder)
            .build();
          gdrwDriveDoc.write(mrwHtml.getAsSource());
        }

      } else {

        // Writing HTML to Disk
        if (writeHtml) {
          LOGGER.debug("Writing (to FileSystem) HTML for account: " + accountId);
          FileSystemReportWriter fsrwHtml = FileSystemReportWriter.newFileSystemReportWriter(
              templateName, dateStart, dateEnd, accountId, outputDirectory, ReportFileType.HTML);
          fsrwHtml.write(mrwHtml.getAsSource());
        }

        // Writing PDF to Disk
        if (writePdf) {
          LOGGER.debug("Writing (to FileSystem) PDF for account: " + accountId);
          FileSystemReportWriter fsrwPdf = FileSystemReportWriter.newFileSystemReportWriter(
              templateName, dateStart, dateEnd, accountId, outputDirectory, ReportFileType.PDF);
          HTMLExporter.exportHtmlToPdf(mrwHtml.getAsSource(), fsrwPdf, fontPaths);
        }
      }
    } else {
      LOGGER.info("No data found for account " + accountId);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.