Skip to content
Permalink
Browse files
refactor and added mandatory fields to prevent nulls
  • Loading branch information
Awasum Yannick committed Sep 3, 2017
1 parent b4b0629 commit d5d6db5768fa4508b9680546a6d9cbe11ff749d6
Showing 4 changed files with 38 additions and 16 deletions.
@@ -14,3 +14,5 @@ gradle-app.setting
*.log

*.toDelete
*.class
out/
@@ -0,0 +1,20 @@
package io.mifos.reporting.api.v1.domain;

public class Sample {
private Object identifier;
private Object payload;
public Sample(){
super();
}
public static Sample create(String xxxx, String yyy) {
return new Sample();
}

public void setIdentifier(Object identifier) {
this.identifier = identifier;
}

public void setPayload(String payload) {
this.payload = payload;
}
}
@@ -20,7 +20,7 @@
import java.util.stream.Collectors;

@Report(category = "Deposit", identifier = "Listing")
public class SavingListReportSpecification implements ReportSpecification {
public class DepositListReportSpecification implements ReportSpecification {

private static final String CUSTOMER = "Customer";
private static final String FIRST_NAME = "First name";
@@ -46,7 +46,7 @@ public class SavingListReportSpecification implements ReportSpecification {


@Autowired
public SavingListReportSpecification(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger, final EntityManager entityManager) {
public DepositListReportSpecification(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger logger, final EntityManager entityManager) {
this.entityManager = entityManager;
this.logger = logger;
this.initializeMapping();
@@ -91,13 +91,6 @@ public ReportPage generateReport(ReportRequest reportRequest, int pageIndex, int
return reportPage;
}

private List<QueryParameter> buildQueryParameters() {
return Arrays.asList(
QueryParameterBuilder.create(DATE_RANGE, Type.DATE).operator(QueryParameter.Operator.BETWEEN).build(),
QueryParameterBuilder.create(STATE, Type.TEXT).operator(QueryParameter.Operator.IN).build()
);
}

@Override
public void validate(ReportRequest reportRequest) throws IllegalArgumentException {
final ArrayList<String> unknownFields = new ArrayList<>();
@@ -367,12 +360,19 @@ private List<DisplayableField> buildDisplayableFields() {
DisplayableFieldBuilder.create(STATE,Type.TEXT).build(),
DisplayableFieldBuilder.create(LAST_ACCOUNT_ACTIVITY, Type.DATE).build(),

DisplayableFieldBuilder.create(EMPLOYEE, Type.TEXT).mandatory().build(),
DisplayableFieldBuilder.create(OFFICE, Type.TEXT).mandatory().build(),
DisplayableFieldBuilder.create(DATE_RANGE, Type.TEXT).build()
DisplayableFieldBuilder.create(EMPLOYEE, Type.TEXT).build(),
DisplayableFieldBuilder.create(OFFICE, Type.TEXT).build(),
DisplayableFieldBuilder.create(DATE_RANGE, Type.DATE).build()
);

}

private List<QueryParameter> buildQueryParameters() {
return Arrays.asList(
QueryParameterBuilder.create(DATE_RANGE, Type.DATE).operator(QueryParameter.Operator.BETWEEN).build(),
QueryParameterBuilder.create(STATE, Type.TEXT).operator(QueryParameter.Operator.IN).build()
);
}


}
@@ -177,11 +177,11 @@ private String buildAccountQuery(ReportRequest reportRequest, int pageIndex, int
private List<DisplayableField> buildDisplayableFields() {
return Arrays.asList(
DisplayableFieldBuilder.create(TYPE, Type.TEXT).build(),
DisplayableFieldBuilder.create(IDENTIFIER, Type.TEXT).build(),
DisplayableFieldBuilder.create(NAME, Type.TEXT).build(),
DisplayableFieldBuilder.create(IDENTIFIER, Type.TEXT).mandatory().build(),
DisplayableFieldBuilder.create(NAME, Type.TEXT).mandatory().build(),
DisplayableFieldBuilder.create(HOLDER, Type.TEXT).build(),
DisplayableFieldBuilder.create(BALANCE, Type.TEXT).build(),
DisplayableFieldBuilder.create(STATE, Type.TEXT).build()
DisplayableFieldBuilder.create(BALANCE, Type.TEXT).mandatory().build(),
DisplayableFieldBuilder.create(STATE, Type.TEXT).mandatory().build()
);
}

0 comments on commit d5d6db5

Please sign in to comment.