FINERACT-234 - Can't process bulk JLG loan application [MIFOSX-2137]
This commit is contained in:
+29
@@ -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", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+7
-1
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.batch.exception;
|
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.AbstractPlatformResourceNotFoundException;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||||
@@ -69,7 +70,12 @@ public class ErrorHandler extends RuntimeException {
|
|||||||
*/
|
*/
|
||||||
public static ErrorInfo handler(final RuntimeException exception) {
|
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 PlatformResourceNotFoundExceptionMapper mapper = new PlatformResourceNotFoundExceptionMapper();
|
||||||
final String errorBody = jsonHelper
|
final String errorBody = jsonHelper
|
||||||
|
|||||||
+9
-1
@@ -32,6 +32,7 @@ import org.apache.fineract.batch.command.CommandStrategy;
|
|||||||
import org.apache.fineract.batch.command.CommandStrategyProvider;
|
import org.apache.fineract.batch.command.CommandStrategyProvider;
|
||||||
import org.apache.fineract.batch.domain.BatchRequest;
|
import org.apache.fineract.batch.domain.BatchRequest;
|
||||||
import org.apache.fineract.batch.domain.BatchResponse;
|
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.ErrorHandler;
|
||||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||||
import org.apache.fineract.batch.service.ResolutionHelper.BatchRequestNode;
|
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);
|
final List<BatchRequestNode> batchRequestNodes = this.resolutionHelper.getDependingRequests(requestList);
|
||||||
checkList.clear();
|
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) {
|
for (BatchRequestNode rootNode : batchRequestNodes) {
|
||||||
final BatchRequest rootRequest = rootNode.getRequest();
|
final BatchRequest rootRequest = rootNode.getRequest();
|
||||||
final CommandStrategy commandStrategy = this.strategyProvider.getCommandStrategy(CommandContext
|
final CommandStrategy commandStrategy = this.strategyProvider.getCommandStrategy(CommandContext
|
||||||
|
|||||||
Reference in New Issue
Block a user