mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-21 06:28:44 +00:00
CE-881 - Increasing test coverage
This commit is contained in:
@ -130,7 +130,15 @@ public class GenerateReportAction
|
||||
{
|
||||
throw new QException("Report format was not specified.");
|
||||
}
|
||||
reportStreamer = reportFormat.newReportStreamer();
|
||||
|
||||
if(reportInput.getOverrideExportStreamerSupplier() != null)
|
||||
{
|
||||
reportStreamer = reportInput.getOverrideExportStreamerSupplier().get();
|
||||
}
|
||||
else
|
||||
{
|
||||
reportStreamer = reportFormat.newReportStreamer();
|
||||
}
|
||||
|
||||
reportStreamer.preRun(reportInput.getReportDestination(), views);
|
||||
|
||||
|
@ -22,10 +22,22 @@
|
||||
package com.kingsrook.qqq.backend.core.actions.reporting.excel.fastexcel;
|
||||
|
||||
|
||||
import org.dhatim.fastexcel.StyleSetter;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Excel styler that does nothing - just takes defaults (which are all no-op) from the interface.
|
||||
*******************************************************************************/
|
||||
public class PlainFastExcelStyler implements FastExcelStylerInterface
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
** ... sorry, but adding this gives us test coverage on this class, even though
|
||||
** we're just deferring to super...
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public void styleHeaderRow(StyleSetter headerRowStyle)
|
||||
{
|
||||
FastExcelStylerInterface.super.styleHeaderRow(headerRowStyle);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class ExcelPoiBasedStreamingExportStreamer implements ExportStreamerInter
|
||||
private OutputStream outputStream;
|
||||
private ZipOutputStream zipOutputStream;
|
||||
|
||||
private PoiExcelStylerInterface poiExcelStylerInterface = new PlainPoiExcelStyler();
|
||||
private PoiExcelStylerInterface poiExcelStylerInterface = getStylerInterface();
|
||||
private Map<String, String> excelCellFormats;
|
||||
|
||||
private int rowNo = 0;
|
||||
@ -335,7 +335,7 @@ public class ExcelPoiBasedStreamingExportStreamer implements ExportStreamerInter
|
||||
{
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
|
||||
XSSFCellStyle dateStyle = workbook.createCellStyle();
|
||||
XSSFCellStyle dateStyle = workbook.createCellStyle();
|
||||
dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("yyyy-MM-dd"));
|
||||
styles.put("date", dateStyle);
|
||||
|
||||
@ -508,8 +508,8 @@ public class ExcelPoiBasedStreamingExportStreamer implements ExportStreamerInter
|
||||
{
|
||||
sheetWriter.insertRow(rowNo++);
|
||||
|
||||
int styleIndex = -1;
|
||||
int dateStyleIndex = styles.get("date").getIndex();
|
||||
int styleIndex = -1;
|
||||
int dateStyleIndex = styles.get("date").getIndex();
|
||||
int dateTimeStyleIndex = styles.get("datetime").getIndex();
|
||||
if(isFooter)
|
||||
{
|
||||
@ -748,4 +748,15 @@ public class ExcelPoiBasedStreamingExportStreamer implements ExportStreamerInter
|
||||
throw (new QReportingException("Error writing pivot table", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
protected PoiExcelStylerInterface getStylerInterface()
|
||||
{
|
||||
return (new PlainPoiExcelStyler());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ package com.kingsrook.qqq.backend.core.model.actions.reporting;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import com.kingsrook.qqq.backend.core.actions.reporting.ExportStreamerInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractTableActionInput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.reporting.QReportMetaData;
|
||||
|
||||
@ -41,6 +43,8 @@ public class ReportInput extends AbstractTableActionInput
|
||||
|
||||
private ReportDestination reportDestination;
|
||||
|
||||
private Supplier<? extends ExportStreamerInterface> overrideExportStreamerSupplier;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -140,6 +144,7 @@ public class ReportInput extends AbstractTableActionInput
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for reportMetaData
|
||||
*******************************************************************************/
|
||||
@ -170,4 +175,37 @@ public class ReportInput extends AbstractTableActionInput
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for overrideExportStreamerSupplier
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Supplier<? extends ExportStreamerInterface> getOverrideExportStreamerSupplier()
|
||||
{
|
||||
return overrideExportStreamerSupplier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for overrideExportStreamerSupplier
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setOverrideExportStreamerSupplier(Supplier<? extends ExportStreamerInterface> overrideExportStreamerSupplier)
|
||||
{
|
||||
this.overrideExportStreamerSupplier = overrideExportStreamerSupplier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for overrideExportStreamerSupplier
|
||||
**
|
||||
*******************************************************************************/
|
||||
public ReportInput withOverrideExportStreamerSupplier(Supplier<? extends ExportStreamerInterface> overrideExportStreamerSupplier)
|
||||
{
|
||||
this.overrideExportStreamerSupplier = overrideExportStreamerSupplier;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user