Skip to content
Permalink
Browse files
refactor add income state build rows, fix nullables
  • Loading branch information
Awasum Yannick committed Sep 3, 2017
1 parent d5d6db5 commit 096a62c1ddfd48ddb462ba19f41c10d4cf12a8b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
@@ -255,16 +255,15 @@ private String buildAccountQuery(final ReportRequest reportRequest, int pageInde
final List<DisplayableField> displayableFields = reportRequest.getDisplayableFields();
final ArrayList<String> columns = new ArrayList<>();
displayableFields.forEach(displayableField -> {
final String column = this.accountColumnMapping.get(displayableField.getName())
+ this.employeeColumnMapping.get(displayableField.getName());
final String column = this.accountColumnMapping.get(displayableField.getName());
if (column != null) {
columns.add(column);
}
});

query.append(columns.stream().collect(Collectors.joining(", ")))
.append(" FROM ")
.append("shed_product_instances pi ");
.append("shed_product_instances pi");
final List<QueryParameter> queryParameters = reportRequest.getQueryParameters();
if (!queryParameters.isEmpty()) {
final ArrayList<String> criteria = new ArrayList<>();
@@ -125,8 +125,35 @@ private Header createHeader(List<DisplayableField> displayableFields) {
return header;
}

private List<Row> buildRows(ReportRequest reportRequest, List<?> customerResultList) {
return null;
private List<Row> buildRows(ReportRequest reportRequest, List<?> accountResultList) {
final ArrayList<Row> rows = new ArrayList<>();
accountResultList.forEach(result -> {
final Row row = new Row();
row.setValues(new ArrayList<>());

if (result instanceof Object[]) {
final Object[] resultValues;
resultValues = (Object[]) result;

for(final Object resultVal : resultValues) {
final Value val;
val = new Value();

if (resultVal != null) {
val.setValues(new String[]{resultVal.toString()});
} else val.setValues(new String[]{});

row.getValues().add(val);
}
} else {
final Value value = new Value();
value.setValues(new String[]{result.toString()});
row.getValues().add(value);
}
rows.add(row);
});

return rows;
}

private String buildAccountQuery(ReportRequest reportRequest, int pageIndex, int size) {

0 comments on commit 096a62c

Please sign in to comment.