fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] incubator-fineract git commit: FINERACT-234 - Can't process bulk JLG loan application [MIFOSX-2137]
Date Fri, 17 Feb 2017 11:04:31 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop c6da909d6 -> ffa7bd71d


FINERACT-234 - Can't process bulk JLG loan application [MIFOSX-2137]


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/dc3bf98c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/dc3bf98c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/dc3bf98c

Branch: refs/heads/develop
Commit: dc3bf98c44fdd3603aad60179c457a20c4fadc48
Parents: b6f4230
Author: Nazeer Hussain Shaik <nazeer.shaik@confluxtechnologies.com>
Authored: Wed Feb 8 19:19:02 2017 +0530
Committer: Nazeer Hussain Shaik <nazeer.shaik@confluxtechnologies.com>
Committed: Wed Feb 8 19:19:02 2017 +0530

----------------------------------------------------------------------
 .../ClientDetailsNotFoundException.java         | 29 ++++++++++++++++++++
 .../fineract/batch/exception/ErrorHandler.java  |  8 +++++-
 .../batch/service/BatchApiServiceImpl.java      | 10 ++++++-
 3 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/dc3bf98c/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ClientDetailsNotFoundException.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ClientDetailsNotFoundException.java
b/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ClientDetailsNotFoundException.java
new file mode 100644
index 0000000..9d13c16
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ClientDetailsNotFoundException.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.batch.exception;
+
+import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
+
+public class ClientDetailsNotFoundException extends AbstractPlatformDomainRuleException{
+
+	public ClientDetailsNotFoundException() {
+		super("validation.msg.batch.jlg.no.clients.defined", "No Client details found", "");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/dc3bf98c/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
index 76b373c..f88d955 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
@@ -18,6 +18,7 @@
  */
 package org.apache.fineract.batch.exception;
 
+import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
 import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
 import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
 import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
@@ -69,7 +70,12 @@ public class ErrorHandler extends RuntimeException {
      */
     public static ErrorInfo handler(final RuntimeException exception) {
 
-        if (exception instanceof AbstractPlatformResourceNotFoundException) {
+    	if(exception instanceof AbstractPlatformDomainRuleException) {
+    		PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper()
;
+    		final String errorBody = jsonHelper
+                    .toJson(mapper.toResponse((AbstractPlatformDomainRuleException) exception).getEntity());
+    		return new ErrorInfo(500, 9999, errorBody);
+    	}else if (exception instanceof AbstractPlatformResourceNotFoundException) {
 
             final PlatformResourceNotFoundExceptionMapper mapper = new PlatformResourceNotFoundExceptionMapper();
             final String errorBody = jsonHelper

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/dc3bf98c/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
index d6261db..6e61ee4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/service/BatchApiServiceImpl.java
@@ -32,6 +32,7 @@ import org.apache.fineract.batch.command.CommandStrategy;
 import org.apache.fineract.batch.command.CommandStrategyProvider;
 import org.apache.fineract.batch.domain.BatchRequest;
 import org.apache.fineract.batch.domain.BatchResponse;
+import org.apache.fineract.batch.exception.ClientDetailsNotFoundException;
 import org.apache.fineract.batch.exception.ErrorHandler;
 import org.apache.fineract.batch.exception.ErrorInfo;
 import org.apache.fineract.batch.service.ResolutionHelper.BatchRequestNode;
@@ -95,7 +96,14 @@ public class BatchApiServiceImpl implements BatchApiService {
 
         final List<BatchRequestNode> batchRequestNodes = this.resolutionHelper.getDependingRequests(requestList);
         checkList.clear();
-
+        if(batchRequestNodes.isEmpty()) {
+        	 final BatchResponse response = new BatchResponse();
+        	 ErrorInfo ex = ErrorHandler.handler(new ClientDetailsNotFoundException());
+             response.setStatusCode(500);
+             response.setBody(ex.getMessage());
+             responseList.add(response) ;
+             return responseList ;
+        }
         for (BatchRequestNode rootNode : batchRequestNodes) {
             final BatchRequest rootRequest = rootNode.getRequest();
             final CommandStrategy commandStrategy = this.strategyProvider.getCommandStrategy(CommandContext


Mime
View raw message