This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-reporting.git

commit d5d6db5768fa4508b9680546a6d9cbe11ff749d6
Author: Awasum Yannick <[email protected]>
AuthorDate: Sun Sep 3 12:50:14 2017 +0100

    refactor and added mandatory fields to prevent nulls
---
 .gitignore                                         |  2 ++
 .../io/mifos/reporting/api/v1/domain/Sample.java   | 20 ++++++++++++++++++
 ...on.java => DepositListReportSpecification.java} | 24 +++++++++++-----------
 .../IncomeStatementReportSpecification.java        |  8 ++++----
 4 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index f9d7cba..1ef178c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,5 @@ gradle-app.setting
 *.log
 
 *.toDelete
+*.class
+out/
\ No newline at end of file
diff --git a/api/src/test/java/io/mifos/reporting/api/v1/domain/Sample.java 
b/api/src/test/java/io/mifos/reporting/api/v1/domain/Sample.java
new file mode 100644
index 0000000..ba800f4
--- /dev/null
+++ b/api/src/test/java/io/mifos/reporting/api/v1/domain/Sample.java
@@ -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;
+    }
+}
diff --git 
a/service/src/main/java/io/mifos/reporting/service/internal/specification/SavingListReportSpecification.java
 
b/service/src/main/java/io/mifos/reporting/service/internal/specification/DepositListReportSpecification.java
similarity index 98%
rename from 
service/src/main/java/io/mifos/reporting/service/internal/specification/SavingListReportSpecification.java
rename to 
service/src/main/java/io/mifos/reporting/service/internal/specification/DepositListReportSpecification.java
index 1820df5..b25aa88 100644
--- 
a/service/src/main/java/io/mifos/reporting/service/internal/specification/SavingListReportSpecification.java
+++ 
b/service/src/main/java/io/mifos/reporting/service/internal/specification/DepositListReportSpecification.java
@@ -20,7 +20,7 @@ import java.util.List;
 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 class SavingListReportSpecification implements 
ReportSpecification {
         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 @@ public class SavingListReportSpecification implements 
ReportSpecification {
                 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()
+        );
+    }
+
 
 }
diff --git 
a/service/src/main/java/io/mifos/reporting/service/internal/specification/IncomeStatementReportSpecification.java
 
b/service/src/main/java/io/mifos/reporting/service/internal/specification/IncomeStatementReportSpecification.java
index da4c9df..3992d16 100644
--- 
a/service/src/main/java/io/mifos/reporting/service/internal/specification/IncomeStatementReportSpecification.java
+++ 
b/service/src/main/java/io/mifos/reporting/service/internal/specification/IncomeStatementReportSpecification.java
@@ -177,11 +177,11 @@ public class IncomeStatementReportSpecification 
implements ReportSpecification {
     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()
         );
     }
 

Reply via email to