@Override public ReportRequirements requirements(CashFlowReportTemplate reportTemplate) { return ReportRequirements.of(Column.of(Measures.EXPLAIN_PRESENT_VALUE)); }
static ReportCalculationResults sut2() { Results results = Results.of(ImmutableList.of(COLUMN.toHeader()), ImmutableList.of(Result.success(Double.valueOf(25)))); return ReportCalculationResults.of(VAL_DATE2, ImmutableList.of(TRADE2), ImmutableList.of(COLUMN2), results); }
static ReportCalculationResults sut() { Results results = Results.of(ImmutableList.of(COLUMN.toHeader()), ImmutableList.of(Result.success(PV))); return ReportCalculationResults.of(VAL_DATE, ImmutableList.of(TRADE), ImmutableList.of(COLUMN), results); }
@Override public Report runReport(ReportCalculationResults calculationResults, CashFlowReportTemplate reportTemplate) { int tradeCount = calculationResults.getCalculationResults().getRowCount(); if (tradeCount == 0) { throw new IllegalArgumentException("Calculation results is empty"); } if (tradeCount > 1) { throw new IllegalArgumentException( Messages.format("Unable to show cashflow report for {} trades at once. " + "Please filter the portfolio to a single trade.", tradeCount)); } int columnIdx = calculationResults.getColumns().indexOf(Column.of(Measures.EXPLAIN_PRESENT_VALUE)); if (columnIdx == -1) { throw new IllegalArgumentException( Messages.format("Unable to find column for required measure '{}' in calculation results", Measures.EXPLAIN_PRESENT_VALUE)); } Result<?> result = calculationResults.getCalculationResults().get(0, columnIdx); if (result.isFailure()) { throw new IllegalArgumentException( Messages.format("Failure result found for required measure '{}': {}", Measures.EXPLAIN_PRESENT_VALUE, result.getFailure().getMessage())); } ExplainMap explainMap = (ExplainMap) result.getValue(); return runReport(explainMap, calculationResults.getValuationDate()); }
Column column = Column.of(Measure.of(measureName)); int columnIndex = results.getColumns().indexOf(column); if (columnIndex == -1) {