diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index be06e7613..684d181d5 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -2149,6 +2149,30 @@
|
|
+
+ | Survey |
+ survey/ |
+ |
+ List surveys |
+ |
+ |
+
+
+ |
+ survey/{surveyName} |
+ |
+ Retrieve Survey details |
+ |
+ |
+
+
+ |
+ survey/{surveyName}/{clientId} |
+ Create Entry in the survey table |
+ |
+ |
+ |
+
@@ -11905,6 +11929,39 @@ GET https://DomainName/api/v1/configurations/1
+
+
+
+
Retrieve Global Configuration for surveys
+
Returns the list global enable/disable survey configurations.
+
Example Requests:
+
configurations/survey
+
+
+
+ GET https://DomainName/api/v1/configurations/survey
+
+
+ {
+ "ppi_kenya_2005": [
+ {
+ "name": "maker-checker",
+ "enabled": true,
+ "value": 0,
+ "id": 1
+ },
+ {
+ "name": "ppi_tanzania_20012",
+ "enabled": false,
+ "value": 0,
+ "id": 2
+ },
+ ]
+ }
+
+
+
+
@@ -24619,7 +24676,10 @@ No Request Body
Register Data Table
Registers a data table with the Mifos X Core application
table. This allows the data table to be maintained through the
- API.
+ API.
+ In case the datatable is a PPI (survey table), a parameter category should be pass along with the request.
+ The API currently support one category (200)
+
@@ -24984,6 +25044,261 @@ Request Body:
+
+
+
+
+
+
+
Retreive surveys
+
Retrieve surveys. This allows to retrieve the list of survey tables registered .
+
+
+
+
+ GET https://DomainName/api/v1/survey/
+
+
+ GET survey/
+
+ Content-Type: application/json
+ Request Body:
+ {}
+
+
+ [
+ {
+ "datatableData": {
+ "applicationTableName": "m_client",
+ "registeredTableName": "ppi_kenya_2005",
+ "columnHeaderData": [
+ {
+ "columnName": "id",
+ "columnType": "bigint",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": true,
+ "columnValues": []
+ },
+ {
+ "columnName": "client_id",
+ "columnType": "int",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "ppi_household_members_cd_q1_householdmembers",
+ "columnType": "int",
+ "columnLength": 0,
+ "columnDisplayType": "CODELOOKUP",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": [
+ {
+ "id": 167,
+ "value": "Nine or More",
+ "score": 0
+ },
+ {
+ "id": 168,
+ "value": "Seven or eight",
+ "score": 5
+ },
+ {
+ "id": 169,
+ "value": "Six",
+ "score": 8
+ },
+
+ ],
+ "columnCode": "ppi_household_members"
+ },
+ {
+ "columnName": "date",
+ "columnType": "datetime",
+ "columnLength": 0,
+ "columnDisplayType": "DATETIME",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ }
+ ]
+ },
+ "enabled": false
+ },
+ {
+ "datatableData": {
+ "applicationTableName": "m_client",
+ "registeredTableName": "ppi_tanzania_20012",
+ "columnHeaderData": [
+ {
+ "columnName": "id",
+ "columnType": "bigint",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": true,
+ "columnValues": []
+ },
+ {
+ "columnName": "client_id",
+ "columnType": "int",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "ppi_youngerthan17_cd_q1_youngerthan17",
+ "columnType": "int",
+ "columnLength": 0,
+ "columnDisplayType": "CODELOOKUP",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": [
+ {
+ "id": 204,
+ "value": "four or More",
+ "score": 0
+ },
+
+ ],
+ "columnCode": "ppi_youngerthan17"
+ },
+ ],
+ "columnCode": "ppi_how_many_tables"
+ },
+ ]
+ },
+ "enabled": true
+ }
+ ]
+
+
+
+
+
+
+
+
+
Retreive survey
+
Lists a registered survey table details and the Mifos X Core application table they are registered to.
+
+
+
+
+ GET https://DomainName/api/v1/survey/ppi_kenya_2005
+
+
+ GET survey/{surveyName}
+
+ Content-Type: application/json
+ Request Body:
+ {}
+
+
+ {
+ "applicationTableName": "m_client",
+ "registeredTableName": "extra_client_details",
+ "columnHeaderData": [
+ {
+ "columnName": "client_id",
+ "columnType": "bigint",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": true,
+ "columnValues": []
+ },
+ {
+ "columnName": "Gender_cd_Question",
+ "columnType": "int",
+ "columnLength": 0,
+ "columnDisplayType": "INTEGER",
+ "isColumnNullable": true,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "Some Decimal",
+ "columnType": "decimal",
+ "columnLength": 0,
+ "columnDisplayType": "DECIMAL",
+ "isColumnNullable": true,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "Birth Date",
+ "columnType": "date",
+ "columnLength": 0,
+ "columnDisplayType": "DATE",
+ "isColumnNullable": true,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ }
+ enabled:false
+ ]
+ }
+
+
+
+
+
+
+
+
Create an entry in the survey table
+
Insert and entry in a survey table (full fill the survey).
+
+
+
+
+
+ POST https://DomainName/api/v1/survey/ppi_kenya_2005/87
+
+
+ POST survey/{surveyName}/{clientId}
+
+ Content-Type: application/json
+ Request Body:
+ {
+
+ ppi_household_members_cd_q1_householdmembers : 167,
+ ppi_highestschool_cd_q2_highestschool : 174 ,
+ ppi_businessoccupation_cd_q3_businessoccupation : 180,
+ ppi_habitablerooms_cd_q4_habitablerooms :184,
+ ppi_floortype_cd_q5_floortype : 188,
+ ppi_lightingsource_cd_q6_lightingsource :190,
+ ppi_irons_cd_q7_irons:193,
+ ppi_mosquitonets_cd_q8_mosquitonets:195,
+ ppi_towels_cd_q9_towels:198,
+ ppi_fryingpans_cd_q10_fryingpans:201,
+ date:"2014-12-02 20:30:00",
+ dateFormat:"Y-m-d H:i:s",
+ locale:"en_GB"
+
+ }
+
+
+ {
+ "officeId": 2,
+ "clientId": 87,
+ "resourceId": 87
+ }
+
+
+
+
+
+
@@ -30739,6 +31054,14 @@ No Request Body:
Update Global Configuration |
|
+
+ |
+ |
+ |
+ Retrieve Surveys Global Configuration |
+ |
+ |
+
| Codes |
codes |
diff --git a/mifosng-db/migrations/core_db/V173__ppi.sql b/mifosng-db/migrations/core_db/V173__ppi.sql
new file mode 100644
index 000000000..0ed8c9bae
--- /dev/null
+++ b/mifosng-db/migrations/core_db/V173__ppi.sql
@@ -0,0 +1,103 @@
+ALTER TABLE `m_code_value`
+ADD COLUMN `code_score` INT(11) NULL AFTER `order_position`;
+
+
+CREATE TABLE IF NOT EXISTS `ppi_scores` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `score_from` int(11) NOT NULL,
+ `score_to` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) COLLATE='utf8_general_ci'
+ENGINE=InnoDB;
+
+
+INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (0, 4);
+
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (5, 9);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (10, 14);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (15, 19);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (20, 24);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (25,29 );
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (30, 34);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (35, 39);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (40, 44);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (45, 49);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (50, 54);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (55, 59);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (60,64);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (65, 69);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (70, 74);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (75, 79);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (80,84);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (85, 89);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (90, 94);
+ INSERT INTO `ppi_scores` ( `score_from`, `score_to`)
+VALUES
+ (95, 100);
+
+
+
+CREATE TABLE IF NOT EXISTS `ppi_likelihoods` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `code` varchar(100) NOT NULL,
+ `name` varchar(250) NOT NULL,
+ PRIMARY KEY (`id`)
+) COLLATE='utf8_general_ci'
+ENGINE=InnoDB ;
+
+
+
+ CREATE TABLE IF NOT EXISTS `ppi_likelihoods_ppi` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `likelihood_id` bigint(20) NOT NULL,
+ `ppi_name` varchar(250) NOT NULL,
+ `enabled` int(11) NOT NULL DEFAULT '100',
+ PRIMARY KEY (`id`)
+) COLLATE='utf8_general_ci'
+ENGINE=InnoDB;
+
+/**PPI permission**/
+INSERT INTO `m_permission` (`id`, `grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES (NULL, 'datatable', 'UPDATE_LIKELIHOOD', 'likelihood', 'UPDATE', '0');
+
+INSERT INTO `m_permission` (`id`, `grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES (NULL, 'survey', 'REGISTER_SURVEY', 'survey', 'CREATE', '0');
+
+/**Registered table category**/
+ALTER TABLE `x_registered_table` ADD `category` INT NOT NULL DEFAULT 100;
\ No newline at end of file
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SurveyIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SurveyIntegrationTest.java
new file mode 100644
index 000000000..f813b2dd4
--- /dev/null
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/SurveyIntegrationTest.java
@@ -0,0 +1,112 @@
+package org.mifosplatform.integrationtests;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+import org.junit.Before;
+import org.junit.Test;
+import org.mifosplatform.integrationtests.common.ClientHelper;
+import org.mifosplatform.integrationtests.common.Utils;
+import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
+import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
+import org.mifosplatform.integrationtests.common.loans.LoanTransactionHelper;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Client Loan Integration Test for checking Loan Application Repayment
+ * Schedule.
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class SurveyIntegrationTest {
+
+ private ResponseSpecification responseSpec;
+ private RequestSpecification requestSpec;
+ private LoanTransactionHelper loanTransactionHelper;
+
+ @Before
+ public void setup() {
+ Utils.initializeRESTAssured();
+ this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+ this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+ this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+ }
+
+ @Test
+ public void checkClientLoanCreateAndDisburseFlow() {
+ this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
+ ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
+ final Integer loanProductID = createLoanProduct();
+ final Integer loanID = applyForLoanApplication(clientID, loanProductID);
+ final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
+ loanID);
+ verifyLoanRepaymentSchedule(loanSchedule);
+
+ }
+
+ private Integer createLoanProduct() {
+ System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ final String loanProductJSON = new LoanProductTestBuilder() //
+ .withPrincipal("12,000.00") //
+ .withNumberOfRepayments("4") //
+ .withRepaymentAfterEvery("1") //
+ .withRepaymentTypeAsMonth() //
+ .withinterestRatePerPeriod("1") //
+ .withInterestRateFrequencyTypeAsMonths() //
+ .withAmortizationTypeAsEqualInstallments() //
+ .withInterestTypeAsDecliningBalance() //
+ .build();
+ return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
+ }
+
+ private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
+ System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ final String loanApplicationJSON = new LoanApplicationTestBuilder() //
+ .withPrincipal("12,000.00") //
+ .withLoanTermFrequency("4") //
+ .withLoanTermFrequencyAsMonths() //
+ .withNumberOfRepayments("4") //
+ .withRepaymentEveryAfter("1") //
+ .withRepaymentFrequencyTypeAsMonths() //
+ .withInterestRatePerPeriod("2") //
+ .withAmortizationTypeAsEqualInstallments() //
+ .withInterestTypeAsDecliningBalance() //
+ .withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
+ .withExpectedDisbursementDate("20 September 2011") //
+ .withSubmittedOnDate("20 September 2011") //
+ .build(clientID.toString(), loanProductID.toString());
+ return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
+ }
+
+ private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) {
+ System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
+
+ assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2011, 10, 20)),
+ loanSchedule.get(1).get("dueDate"));
+ assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue"));
+ assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue"));
+
+ assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2011, 11, 20)),
+ loanSchedule.get(2).get("dueDate"));
+ assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.71"), loanSchedule.get(2).get("principalDue"));
+ assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue"));
+
+ assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2011, 12, 20)),
+ loanSchedule.get(3).get("dueDate"));
+ assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.1"), loanSchedule.get(3).get("principalDue"));
+ assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue"));
+
+ assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2012, 1, 20)),
+ loanSchedule.get(4).get("dueDate"));
+ assertEquals("Checking for Principal Due for 4th Month", new Float("3089.7"), loanSchedule.get(4).get("principalDue"));
+ assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
+ }
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/surveyHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/surveyHelper.java
new file mode 100644
index 000000000..1d7b69a35
--- /dev/null
+++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/surveyHelper.java
@@ -0,0 +1,56 @@
+package org.mifosplatform.integrationtests.common;
+
+import com.google.gson.Gson;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+import java.util.HashMap;
+
+import static org.junit.Assert.assertEquals;
+
+public class surveyHelper {
+
+ private static final String FULFIL_SURVEY_URL = "/mifosng-provider/api/v1/survey/ppi_kenya_2009/clientId?tenantIdentifier=default";
+
+ public static Integer fulfilSurvey(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
+ return fulfilSurvey(requestSpec, responseSpec, "04 March 2011");
+ }
+
+ public static Integer fulfilSurvey(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
+ final String activationDate) {
+ System.out.println("---------------------------------FULFIL PPI ---------------------------------------------");
+ return Utils.performServerPost(requestSpec, responseSpec,FULFIL_SURVEY_URL, getTestPPIAsJSON(), "clientId");
+ }
+
+ public static String getTestPPIAsJSON() {
+ final HashMap map = new HashMap();
+
+ map.put("date", "2014-05-19 00:00:00");
+ map.put("ppi_household_members_cd_q1_householdmembers","107");
+ map.put("ppi_highestschool_cd_q2_highestschool","112");
+ map.put("ppi_businessoccupation_cd_q3_businessoccupation","116");
+ map.put("dateFormat", "dd MMMM yyyy");
+ map.put("locale", "en");
+ map.put("ppi_habitablerooms_cd_q4_habitablerooms", "120");
+
+ map.put("ppi_floortype_cd_q5_floortype", "124");
+ map.put("ppi_lightingsource_cd_q6_lightingsource", "126");
+ map.put("ppi_irons_cd_q7_irons", "128");
+ map.put("ppi_mosquitonets_cd_q8_mosquitonets", "132");
+ map.put("ppi_towels_cd_q9_towels", "134");
+ map.put("ppi_fryingpans_cd_q10_fryingpans", "138");
+
+ System.out.println("map : " + map);
+ return new Gson().toJson(map);
+ }
+
+ public static void verifySurveyCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
+ final Integer generatedClientID) {
+ System.out.println("------------------------------CHECK CLIENT DETAILS------------------------------------\n");
+ final String SURVEY_URL = "/mifosng-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?tenantIdentifier=default";
+ final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, SURVEY_URL, "id");
+ assertEquals("ERROR IN CREATING THE CLIENT", generatedClientID, responseClientID);
+ }
+
+
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
index 7b132cc26..9c03d4082 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
@@ -5,7 +5,6 @@
*/
package org.mifosplatform.commands.domain;
-
public class CommandWrapper {
private final Long commandId;
@@ -838,4 +837,31 @@ public class CommandWrapper {
public boolean isOfficeToGLAccountMapping() {
return this.entityName.equalsIgnoreCase("OFFICEGLACCOUNT");
}
+
+ public boolean isRegisterDatatable() {
+ return this.actionName.equalsIgnoreCase("REGISTER") && this.href.startsWith("/datatables/") && this.entityId == null;
+ }
+
+ public boolean isLikelihoodResource() {
+ return this.entityName.equalsIgnoreCase("Likelihood");
+ }
+
+ public boolean isSurveyResource() {
+
+ return this.href.startsWith("/survey/");
+
+ }
+
+ public boolean isUpdateLikelihood() {
+ return this.actionName.equalsIgnoreCase("UPDATE");
+ }
+
+ public boolean isRegisterSurvey() {
+ return this.actionName.equalsIgnoreCase("REGISTER");
+ }
+
+ public boolean isFullFilSurvey() {
+ return this.actionName.equalsIgnoreCase("CREATE");
+ }
+
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
index f502342b7..78938f1f1 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
@@ -26,8 +26,7 @@ public class CommandWrapperBuilder {
public CommandWrapper build() {
return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.savingsId, this.actionName,
- this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId,
- this.templateId);
+ this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId, this.templateId);
}
public CommandWrapperBuilder withLoanId(final Long withLoanId) {
@@ -1182,7 +1181,7 @@ public class CommandWrapperBuilder {
this.actionName = "CREATE";
this.entityName = "CHARTSLAB";
this.entityId = null;
- this.subentityId = chartId; //refer to chart id
+ this.subentityId = chartId; // refer to chart id
this.href = "/interestratechart/" + chartId + "/chartdetails/template";
return this;
}
@@ -1191,7 +1190,7 @@ public class CommandWrapperBuilder {
this.actionName = "UPDATE";
this.entityName = "CHARTSLAB";
this.entityId = chartSlabId;
- this.subentityId = chartId;//refers parent chart
+ this.subentityId = chartId;// refers parent chart
this.href = "/interestratechart/" + chartId + "/chartdetails/" + chartSlabId;
return this;
}
@@ -1200,7 +1199,7 @@ public class CommandWrapperBuilder {
this.actionName = "DELETE";
this.entityName = "CHARTSLAB";
this.entityId = chartSlabId;
- this.subentityId = chartId;//refers parent chart
+ this.subentityId = chartId;// refers parent chart
this.href = "/interestratechart/" + chartId + "/chartdetails/" + chartSlabId;
return this;
}
@@ -1983,4 +1982,36 @@ public class CommandWrapperBuilder {
return this;
}
+ public CommandWrapperBuilder registerDBDatatable(final String datatable, final String apptable) {
+ this.actionName = "REGISTER";
+ this.entityName = "DATATABLE";
+ this.entityId = null;
+ this.href = "/datatables/register/" + datatable + "/" + apptable;
+ return this;
+ }
+
+ public CommandWrapperBuilder registerSurvey(final String datatable, final String apptable) {
+ this.actionName = "REGISTER";
+ this.entityName = "SURVEY";
+ this.entityId = null;
+ this.href = "/survey/register/" + datatable + "/" + apptable;
+ return this;
+ }
+
+ public CommandWrapperBuilder fullFilSurvey(final String datatable, final Long apptableId) {
+ this.entityName = datatable;
+ this.entityId = apptableId;
+ this.actionName = "CREATE";
+ this.href = "/survey/" + datatable + "/" + apptableId;
+ return this;
+ }
+
+ public CommandWrapperBuilder updateLikelihood(final Long entityId) {
+ this.actionName = "UPDATE";
+ this.entityName = "LIKELIHOOD";
+ this.href = "/likelihood/" + entityId;
+ this.entityId = entityId;
+ return this;
+ }
+
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
index e1d529e43..9b33c32ab 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
@@ -5,6 +5,8 @@
*/
package org.mifosplatform.commands.service;
+import java.util.Map;
+
import org.joda.time.DateTime;
import org.mifosplatform.commands.domain.CommandSource;
import org.mifosplatform.commands.domain.CommandSourceRepository;
@@ -24,8 +26,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.Map;
-
@Service
public class SynchronousCommandProcessingService implements CommandProcessingService {
@@ -143,6 +143,8 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
handler = this.applicationContext.getBean("deleteOneToManyDatatableEntryCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDeleteOneToOne()) {
handler = this.applicationContext.getBean("deleteOneToOneDatatableEntryCommandHandler", NewCommandSourceHandler.class);
+ } else if (wrapper.isRegisterDatatable()) {
+ handler = this.applicationContext.getBean("registerDatatableCommandHandler", NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
@@ -507,7 +509,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
if (wrapper.isCreate()) {
handler = this.applicationContext.getBean("fixedDepositAccountApplicationSubmittalCommandHandler",
NewCommandSourceHandler.class);
- }else if (wrapper.isUpdate()) {
+ } else if (wrapper.isUpdate()) {
handler = this.applicationContext.getBean("fixedDepositAccountApplicationModificationCommandHandler",
NewCommandSourceHandler.class);
} else if (wrapper.isDelete()) {
@@ -519,8 +521,9 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else if (wrapper.isWithdrawFixedDepositAccountApplicationByApplicant()) {
handler = this.applicationContext.getBean("fixedDepositAccountApplicationWithdrawnByApplicantCommandHandler",
NewCommandSourceHandler.class);
- } else if (wrapper.isApprovalOfFixedDepositAccountApplication()) {
- handler = this.applicationContext.getBean("fixedDepositAccountApplicationApprovalCommandHandler", NewCommandSourceHandler.class);
+ } else if (wrapper.isApprovalOfFixedDepositAccountApplication()) {
+ handler = this.applicationContext.getBean("fixedDepositAccountApplicationApprovalCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isUndoApprovalOfFixedDepositAccountApplication()) {
handler = this.applicationContext.getBean("fixedDepositAccountApplicationApprovalUndoCommandHandler",
NewCommandSourceHandler.class);
@@ -531,11 +534,13 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else if (wrapper.isActivation()) {
handler = this.applicationContext.getBean("activateFixedDepositAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isInterestCalculation()) {
- handler = this.applicationContext.getBean("calculateInterestFixedDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("calculateInterestFixedDepositAccountCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isInterestPosting()) {
handler = this.applicationContext.getBean("postInterestFixedDepositAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isUndoTransaction()) {
- handler = this.applicationContext.getBean("undoTransactionFixedDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext
+ .getBean("undoTransactionFixedDepositAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isAdjustTransaction()) {
handler = this.applicationContext.getBean("fixedDepositTransactionAdjustmentCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDepositAccountClose()) {
@@ -549,7 +554,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
if (wrapper.isCreate()) {
handler = this.applicationContext.getBean("recurringDepositAccountApplicationSubmittalCommandHandler",
NewCommandSourceHandler.class);
- }else if (wrapper.isUpdate()) {
+ } else if (wrapper.isUpdate()) {
handler = this.applicationContext.getBean("recurringDepositAccountApplicationModificationCommandHandler",
NewCommandSourceHandler.class);
} else if (wrapper.isDelete()) {
@@ -562,7 +567,8 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
handler = this.applicationContext.getBean("recurringDepositAccountApplicationWithdrawnByApplicantCommandHandler",
NewCommandSourceHandler.class);
} else if (wrapper.isApprovalOfRecurringDepositAccountApplication()) {
- handler = this.applicationContext.getBean("recurringDepositAccountApplicationApprovalCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("recurringDepositAccountApplicationApprovalCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isUndoApprovalOfRecurringDepositAccountApplication()) {
handler = this.applicationContext.getBean("recurringDepositAccountApplicationApprovalUndoCommandHandler",
NewCommandSourceHandler.class);
@@ -573,17 +579,22 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else if (wrapper.isActivation()) {
handler = this.applicationContext.getBean("activateRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isInterestCalculation()) {
- handler = this.applicationContext.getBean("calculateInterestRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("calculateInterestRecurringDepositAccountCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isInterestPosting()) {
- handler = this.applicationContext.getBean("postInterestRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("postInterestRecurringDepositAccountCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isUndoTransaction()) {
- handler = this.applicationContext.getBean("undoTransactionRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("undoTransactionRecurringDepositAccountCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isAdjustTransaction()) {
- handler = this.applicationContext.getBean("recurringDepositTransactionAdjustmentCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("recurringDepositTransactionAdjustmentCommandHandler",
+ NewCommandSourceHandler.class);
} else if (wrapper.isDepositAccountClose()) {
handler = this.applicationContext.getBean("closeRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDepositAccountPrematureClose()) {
- handler = this.applicationContext.getBean("prematureCloseRecurringDepositAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = this.applicationContext.getBean("prematureCloseRecurringDepositAccountCommandHandler",
+ NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
@@ -787,6 +798,20 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
+ } else if (wrapper.isLikelihoodResource()) {
+ if (wrapper.isUpdateLikelihood()) {
+ handler = this.applicationContext.getBean("updateLikelihoodCommandHandler", NewCommandSourceHandler.class);
+ } else {
+ throw new UnsupportedCommandException(wrapper.commandName());
+ }
+ } else if (wrapper.isSurveyResource()) {
+ if (wrapper.isRegisterSurvey()) {
+ handler = this.applicationContext.getBean("registerSurveyCommandHandler", NewCommandSourceHandler.class);
+ } else if (wrapper.isFullFilSurvey()) {
+ handler = this.applicationContext.getBean("fullFilSurveyCommandHandler", NewCommandSourceHandler.class);
+ } else {
+ throw new UnsupportedCommandException(wrapper.commandName());
+ }
} else {
throw new UnsupportedCommandException(wrapper.commandName());
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java
index 40559c585..7dcf00c56 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java
@@ -9,12 +9,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
@@ -68,11 +63,11 @@ public class GlobalConfigurationApiResource {
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String retrieveConfiguration(@Context final UriInfo uriInfo) {
+ public String retrieveConfiguration(@Context final UriInfo uriInfo,@DefaultValue("false") @QueryParam("survey") final boolean survey) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
- final GlobalConfigurationData configurationData = this.readPlatformService.retrieveGlobalConfiguration();
+ final GlobalConfigurationData configurationData = this.readPlatformService.retrieveGlobalConfiguration(survey);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, configurationData, this.RESPONSE_DATA_PARAMETERS);
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java
index 2c235fc19..cb0b75b0b 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java
@@ -76,4 +76,9 @@ public class GlobalConfigurationProperty extends AbstractPersistable {
}
+ public static GlobalConfigurationProperty newSurveyConfiguration(final String name)
+ {
+ return new GlobalConfigurationProperty(name,false,null);
+ }
+
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformService.java
index ee1e94eb7..cea6ecf29 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformService.java
@@ -10,8 +10,8 @@ import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationPr
public interface ConfigurationReadPlatformService {
- GlobalConfigurationData retrieveGlobalConfiguration();
-
GlobalConfigurationPropertyData retrieveGlobalConfiguration(Long configId);
+ GlobalConfigurationData retrieveGlobalConfiguration(boolean survey);
+
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java
index e952b391a..265bb75b3 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java
@@ -8,6 +8,7 @@ package org.mifosplatform.infrastructure.configuration.service;
import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationData;
import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationPropertyData;
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
+import org.mifosplatform.infrastructure.dataqueries.api.DataTableApiConstant;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -34,11 +35,20 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
}
@Override
- public GlobalConfigurationData retrieveGlobalConfiguration() {
+ public GlobalConfigurationData retrieveGlobalConfiguration(final boolean survey) {
this.context.authenticatedUser();
- final String sql = "SELECT c.id, c.name, c.enabled, c.value FROM c_configuration c order by c.id";
+ String sql = "SELECT c.id, c.name, c.enabled, c.value FROM c_configuration c ";
+
+ if(survey)
+ {
+ sql += " JOIN x_registered_table on x_registered_table.registered_table_name = c.name ";
+ sql += " WHERE x_registered_table.category ="+DataTableApiConstant.CATEGORY_PPI;
+
+ }
+
+ sql += " order by c.id";
final List globalConfiguration = this.jdbcTemplate.query(sql, this.rm, new Object[] {});
return new GlobalConfigurationData(globalConfiguration);
@@ -55,6 +65,8 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
return globalConfiguration;
}
+
+
private static final class GlobalConfigurationRowMapper implements RowMapper {
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformService.java
index a14b99c77..95fa15d0a 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformService.java
@@ -11,4 +11,5 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
public interface GlobalConfigurationWritePlatformService {
CommandProcessingResult update(Long configId, JsonCommand command);
+ void addSurveyConfig(String name);
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformServiceJpaRepositoryImpl.java
index f77c682f6..ca3e6b950 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformServiceJpaRepositoryImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/GlobalConfigurationWritePlatformServiceJpaRepositoryImpl.java
@@ -66,6 +66,24 @@ public class GlobalConfigurationWritePlatformServiceJpaRepositoryImpl implements
}
+
+ @Transactional
+ @Override
+ public void addSurveyConfig(final String name)
+ {
+ try{
+ final GlobalConfigurationProperty ppi = GlobalConfigurationProperty.newSurveyConfiguration(name);
+ this.repository.save(ppi);
+ }
+ catch (final DataIntegrityViolationException dve)
+ {
+ handleDataIntegrityIssues(dve);
+ }
+
+ }
+
+
+
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java
new file mode 100644
index 000000000..7abcd71c4
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java
@@ -0,0 +1,21 @@
+package org.mifosplatform.infrastructure.dataqueries.api;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Created by Cieyou on 2/26/14.
+ */
+public class DataTableApiConstant {
+
+ public static final Integer CATEGORY_PPI = 200;
+ public static final Integer CATEGORY_DEFAULT = 100;
+
+ public static final String categoryParamName ="category";
+ public static final String localParamName = "locale";
+ public static final Set REGISTER_PARAMS = new HashSet(Arrays.asList(categoryParamName,localParamName));
+
+ public static final String DATATABLE_RESOURCE_NAME ="dataTables";
+
+}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DatatablesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DatatablesApiResource.java
index 35ae92dc3..fe91a33e7 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DatatablesApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DatatablesApiResource.java
@@ -6,6 +6,7 @@
package org.mifosplatform.infrastructure.dataqueries.api;
import java.util.List;
+import java.util.logging.Logger;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -32,10 +33,14 @@ import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData;
import org.mifosplatform.infrastructure.dataqueries.service.GenericDataService;
import org.mifosplatform.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+//import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
@Path("/datatables")
@Component
@Scope("singleton")
@@ -46,6 +51,9 @@ public class DatatablesApiResource {
private final ReadWriteNonCoreDataService readWriteNonCoreDataService;
private final ToApiJsonSerializer toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ private final static org.slf4j.Logger logger = LoggerFactory.getLogger(DatatablesApiResource.class);
+
+
@Autowired
public DatatablesApiResource(final PlatformSecurityContext context, final GenericDataService genericDataService,
@@ -109,11 +117,12 @@ public class DatatablesApiResource {
@Path("register/{datatable}/{apptable}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String registerDatatable(@PathParam("datatable") final String datatable, @PathParam("apptable") final String apptable) {
+ public String registerDatatable(@PathParam("datatable") final String datatable, @PathParam("apptable") final String apptable,final String apiRequestBodyAsJson) {
- this.readWriteNonCoreDataService.registerDatatable(datatable, apptable);
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().registerDBDatatable(datatable,apptable).withJson(apiRequestBodyAsJson).build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
- final CommandProcessingResult result = new CommandProcessingResultBuilder().withResourceIdAsString(datatable).build();
return this.toApiJsonSerializer.serialize(result);
}
@@ -173,6 +182,8 @@ public class DatatablesApiResource {
public String getDatatableManyEntry(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
@PathParam("datatableId") final Long datatableId, @QueryParam("order") final String order, @Context final UriInfo uriInfo) {
+ logger.debug("::1 we came in the getDatatbleManyEntry apiRessource method");
+
this.context.authenticatedUser().validateHasDatatableReadPermission(datatable);
final GenericResultsetData results = this.readWriteNonCoreDataService.retrieveDataTableGenericResultSet(datatable, apptableId,
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java
new file mode 100644
index 000000000..1096d1bbb
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java
@@ -0,0 +1,51 @@
+package org.mifosplatform.infrastructure.dataqueries.data;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+import org.apache.commons.lang.StringUtils;
+import org.mifosplatform.infrastructure.core.api.JsonCommand;
+import org.mifosplatform.infrastructure.core.data.ApiParameterError;
+import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
+import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
+import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
+import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static org.mifosplatform.infrastructure.dataqueries.api.DataTableApiConstant.*;
+
+@Component
+public class DataTableValidator {
+
+ private final FromJsonHelper fromApiJsonHelper;
+
+ @Autowired
+ public DataTableValidator(final FromJsonHelper fromApiJsonHelper) {
+ this.fromApiJsonHelper = fromApiJsonHelper;
+ }
+
+ public void validateDataTableRegistration(final String json) {
+
+
+ final Type typeOfMap = new TypeToken