Batch API extensions and a couple of OpenAPI fixes + minor datatable fixes
This commit is contained in:
committed by
Arnold Gálovics
parent
4f832f9481
commit
8c023e74a8
+1
-1
@@ -129,7 +129,7 @@ final class GLAccountsApiResourceSwagger {
|
||||
public Long parentId;
|
||||
|
||||
@Schema(example = "1")
|
||||
public EnumOptionData usage;
|
||||
public String usage;
|
||||
|
||||
@Schema(example = "Desc")
|
||||
public String description;
|
||||
|
||||
+9
-1
@@ -92,7 +92,10 @@ public class CommandStrategyProvider {
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/charges").method("GET").build(),
|
||||
"collectChargesCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\?command=repayment").method("POST").build(),
|
||||
"repayLoanCommandStrategy");
|
||||
"createTransactionLoanCommandStrategy");
|
||||
this.commandStrategies.put(
|
||||
CommandContext.resource("loans\\/\\d+\\/transactions\\?command=creditBalanceRefund").method("POST").build(),
|
||||
"createTransactionLoanCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("clients\\/\\d+\\?command=activate").method("POST").build(),
|
||||
"activateClientCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\?command=approve").method("POST").build(),
|
||||
@@ -103,6 +106,11 @@ public class CommandStrategyProvider {
|
||||
"approveLoanRescheduleCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("loans\\/\\d+\\/transactions\\/\\d+").method("GET").build(),
|
||||
"getTransactionByIdCommandStrategy");
|
||||
this.commandStrategies.put(CommandContext.resource("datatables\\/[a-zA-Z0-9_]*\\/\\d+").method("GET").build(),
|
||||
"getDatatableEntryByAppTableIdCommandStrategy");
|
||||
this.commandStrategies.put(
|
||||
CommandContext.resource("datatables\\/[a-zA-Z0-9_]*\\/\\d+(\\?(\\w+(?:\\=[\\w,]+|&)+)+)").method("GET").build(),
|
||||
"getDatatableEntryByAppTableIdCommandStrategy");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-22
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.client.api.ClientsApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -61,27 +59,14 @@ public class ActivateClientCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long clientId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'activate' function from 'ClientsApiResource' to activate a
|
||||
// client
|
||||
responseBody = clientsApiResource.activate(clientId, "activate", request.getBody());
|
||||
|
||||
// Calls 'activate' function from 'ClientsApiResource' to activate a
|
||||
// client
|
||||
responseBody = clientsApiResource.activate(clientId, "activate", request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful activation of
|
||||
// the client
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful activation of
|
||||
// the client
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+6
-21
@@ -23,8 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoansApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -56,26 +54,13 @@ public class ApplyLoanCommandStrategy implements CommandStrategy {
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'SubmitLoanFunction' function from 'LoansApiResource' to
|
||||
// Apply Loan to an existing client
|
||||
responseBody = loansApiResource.calculateLoanScheduleOrSubmitLoanApplication(null, null, request.getBody());
|
||||
|
||||
// Calls 'SubmitLoanFunction' function from 'LoansApiResource' to
|
||||
// Apply Loan to an existing client
|
||||
responseBody = loansApiResource.calculateLoanScheduleOrSubmitLoanApplication(null, null, request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after loan is successfully applied
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after loan is successfully applied
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+8
-23
@@ -23,8 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -56,28 +54,15 @@ public class ApplySavingsCommandStrategy implements CommandStrategy {
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'submitApplication' function from
|
||||
// 'SavingsAccountsApiResource' to Apply Savings to an existing
|
||||
// client
|
||||
responseBody = savingsAccountsApiResource.submitApplication(request.getBody());
|
||||
|
||||
// Calls 'submitApplication' function from
|
||||
// 'SavingsAccountsApiResource' to Apply Savings to an existing
|
||||
// client
|
||||
responseBody = savingsAccountsApiResource.submitApplication(request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after savings is successfully
|
||||
// applied
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after savings is successfully
|
||||
// applied
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+7
-22
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoansApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -61,27 +59,14 @@ public class ApproveLoanCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'approve' function from 'LoansApiResource' to approve a
|
||||
// loan
|
||||
responseBody = loansApiResource.stateTransitions(loanId, "approve", request.getBody());
|
||||
|
||||
// Calls 'approve' function from 'LoansApiResource' to approve a
|
||||
// loan
|
||||
responseBody = loansApiResource.stateTransitions(loanId, "approve", request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful approval of a
|
||||
// loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful approval of a
|
||||
// loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+8
-23
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.api.RescheduleLoansApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -47,28 +45,15 @@ public class ApproveLoanRescheduleCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long scheduleId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'approve' function from 'Loans reschedule Request' to
|
||||
// approve a
|
||||
// loan
|
||||
responseBody = rescheduleLoansApiResource.updateLoanRescheduleRequest(scheduleId, "approve", request.getBody());
|
||||
|
||||
// Calls 'approve' function from 'Loans reschedule Request' to
|
||||
// approve a
|
||||
// loan
|
||||
responseBody = rescheduleLoansApiResource.updateLoanRescheduleRequest(scheduleId, "approve", request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful approval of a
|
||||
// Loans reschedule Request
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful approval of a
|
||||
// Loans reschedule Request
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+8
-23
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -63,28 +61,15 @@ public class CollectChargesCommandStrategy implements CommandStrategy {
|
||||
// Pluck out the loanId out of the relative path
|
||||
Long loanId = Long.parseLong(pathParameters.get(1));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'retrieveAllLoanCharges' function from
|
||||
// 'LoanChargesApiResource' to Collect
|
||||
// Charges for a loan
|
||||
responseBody = loanChargesApiResource.retrieveAllLoanCharges(loanId, uriInfo);
|
||||
|
||||
// Calls 'retrieveAllLoanCharges' function from
|
||||
// 'LoanChargesApiResource' to Collect
|
||||
// Charges for a loan
|
||||
responseBody = loanChargesApiResource.retrieveAllLoanCharges(loanId, uriInfo);
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charges have been
|
||||
// successfully collected
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charges have been
|
||||
// successfully collected
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+8
-23
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -61,28 +59,15 @@ public class CreateChargeCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long loanId = Long.parseLong(pathParameters.get(1));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'executeLoanCharge' function from 'LoanChargesApiResource'
|
||||
// to create
|
||||
// a new charge for a loan
|
||||
responseBody = loanChargesApiResource.executeLoanCharge(loanId, null, request.getBody());
|
||||
|
||||
// Calls 'executeLoanCharge' function from 'LoanChargesApiResource'
|
||||
// to create
|
||||
// a new charge for a loan
|
||||
responseBody = loanChargesApiResource.executeLoanCharge(loanId, null, request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charge has been successfully
|
||||
// created
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charge has been successfully
|
||||
// created
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+7
-22
@@ -23,8 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.client.api.ClientsApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -56,27 +54,14 @@ public class CreateClientCommandStrategy implements CommandStrategy {
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'create' function from 'ClientsApiResource' to create a new
|
||||
// client
|
||||
responseBody = clientsApiResource.create(request.getBody());
|
||||
|
||||
// Calls 'create' function from 'ClientsApiResource' to create a new
|
||||
// client
|
||||
responseBody = clientsApiResource.create(request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful creation of
|
||||
// the client
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful creation of
|
||||
// the client
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+26
-23
@@ -20,20 +20,22 @@ package org.apache.fineract.batch.command.internal;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoanTransactionsApiResource;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implements {@link CommandStrategy} and handles repayment for a Loan. It passes the contents of the body from the
|
||||
* BatchRequest to {@link LoanTransactionsApiResource} and gets back the response. This class will also catch any errors
|
||||
* raised by {@link LoanTransactionsApiResource} and map those errors to appropriate status codes in BatchResponse.
|
||||
* Implements {@link CommandStrategy} and handles the creation of a transaction for a Loan. It passes the contents of
|
||||
* the body from the BatchRequest to {@link LoanTransactionsApiResource} and gets back the response. This class will
|
||||
* also catch any errors raised by {@link LoanTransactionsApiResource} and map those errors to appropriate status codes
|
||||
* in BatchResponse.
|
||||
*
|
||||
* @author Mohit Sinha
|
||||
*
|
||||
@@ -43,7 +45,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RepayLoanCommandStrategy implements CommandStrategy {
|
||||
public class CreateTransactionLoanCommandStrategy implements CommandStrategy {
|
||||
|
||||
private final LoanTransactionsApiResource loanTransactionsApiResource;
|
||||
|
||||
@@ -59,25 +61,26 @@ public class RepayLoanCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long loanId = Long.parseLong(pathParameters.get(1));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
|
||||
Matcher commandMatcher = commandPattern.matcher(pathParameters.get(2));
|
||||
|
||||
responseBody = loanTransactionsApiResource.executeLoanTransaction(loanId, "repayment", request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charge has been successfully
|
||||
// created
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
if (!commandMatcher.find()) {
|
||||
// This would only occur if the CommandStrategyProvider is incorrectly configured.
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED);
|
||||
response.setBody(
|
||||
"Resource with method " + request.getMethod() + " and relativeUrl " + request.getRelativeUrl() + " doesn't exist");
|
||||
return response;
|
||||
}
|
||||
String commandQueryParam = commandMatcher.group(0);
|
||||
String command = commandQueryParam.substring(commandQueryParam.indexOf("=") + 1);
|
||||
|
||||
responseBody = loanTransactionsApiResource.executeLoanTransaction(loanId, command, request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after Charge has been successfully
|
||||
// created
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
+7
-22
@@ -25,8 +25,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoansApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -61,28 +59,15 @@ public class DisburseLoanCommandStrategy implements CommandStrategy {
|
||||
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
|
||||
Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'disburse' function from 'LoansApiResource' to disburse a
|
||||
// loan
|
||||
responseBody = loansApiResource.stateTransitions(loanId, "disburse", request.getBody());
|
||||
|
||||
// Calls 'disburse' function from 'LoansApiResource' to disburse a
|
||||
// loan
|
||||
responseBody = loansApiResource.stateTransitions(loanId, "disburse", request.getBody());
|
||||
response.setStatusCode(200);
|
||||
|
||||
response.setStatusCode(200);
|
||||
|
||||
// Sets the body of the response after the successful disbursal of
|
||||
// the loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
// Sets the body of the response after the successful disbursal of
|
||||
// the loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* 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.command.internal;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.command.CommandStrategyUtils;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.infrastructure.core.api.MutableUriInfo;
|
||||
import org.apache.fineract.infrastructure.dataqueries.api.DatatablesApiResource;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implements {@link CommandStrategy} and get datatable by appTableId. It passes the contents of the body from the
|
||||
* BatchRequest to {@link DatatablesApiResource} and gets back the response. This class will also catch any errors
|
||||
* raised by {@link DatatablesApiResource} and map those errors to appropriate status codes in BatchResponse.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GetDatatableEntryByAppTableIdCommandStrategy implements CommandStrategy {
|
||||
|
||||
/**
|
||||
* Data table api resource {@link DatatablesApiResource}.
|
||||
*/
|
||||
private final DatatablesApiResource dataTablesApiResource;
|
||||
|
||||
@Override
|
||||
public BatchResponse execute(final BatchRequest request, @SuppressWarnings("unused") UriInfo uriInfo) {
|
||||
final MutableUriInfo parameterizedUriInfo = new MutableUriInfo(uriInfo);
|
||||
final BatchResponse response = new BatchResponse();
|
||||
final String responseBody;
|
||||
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
|
||||
final String relativeUrl = request.getRelativeUrl();
|
||||
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
|
||||
|
||||
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
|
||||
// for example: batches?enclosingTransaction=true
|
||||
// But the query parameters that are sent in the batch relative url has to be sent to
|
||||
// datatablesApiResource.getDatatable
|
||||
// To use the relative url query parameters
|
||||
// - Parse and fetch the query parameters sent in the relative url
|
||||
// (datatables/dt_123/1?genericResultSet=true)
|
||||
// - Add them to the MutableUriInfo query parameters list
|
||||
// - Call datatablesApiResource.getDatatable(dataTable, appTableId, null, uriInfo)
|
||||
long appTableId;
|
||||
if (relativeUrl.indexOf('?') > 0) {
|
||||
appTableId = Long.parseLong(StringUtils.substringBetween(relativeUrlSubString, "/", "?"));
|
||||
Map<String, String> queryParameters = CommandStrategyUtils.getQueryParameters(relativeUrl);
|
||||
|
||||
// Add the query parameters sent in the relative URL to MutableUriInfo
|
||||
CommandStrategyUtils.addQueryParametersToUriInfo(parameterizedUriInfo, queryParameters);
|
||||
} else {
|
||||
appTableId = Long.parseLong(StringUtils.substringAfter(relativeUrlSubString, "/"));
|
||||
}
|
||||
|
||||
String dataTableName = relativeUrlSubString.substring(0, relativeUrlSubString.indexOf("/"));
|
||||
|
||||
// Calls 'getDatatable' function from 'DatatablesApiResource' to
|
||||
// get the datatable details based on the appTableId
|
||||
responseBody = dataTablesApiResource.getDatatable(dataTableName, appTableId, null, parameterizedUriInfo);
|
||||
|
||||
response.setStatusCode(HttpStatus.SC_OK);
|
||||
|
||||
// Sets the response after retrieving the datatable
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
+44
-58
@@ -26,8 +26,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.infrastructure.core.api.MutableUriInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoansApiResource;
|
||||
import org.apache.http.HttpStatus;
|
||||
@@ -60,65 +58,53 @@ public class GetLoanByIdCommandStrategy implements CommandStrategy {
|
||||
final String relativeUrl = request.getRelativeUrl();
|
||||
Long loanId;
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
|
||||
// for example: batches?enclosingTransaction=true
|
||||
// But the query parameters that are sent in the batch relative url has to be sent to
|
||||
// LoansApiResource.retrieveLoan
|
||||
// To use the relative url query parameters
|
||||
// - Parse and fetch the query parameters sent in the relative url
|
||||
// (loans/66?fields=id,principal,annualInterestRate)
|
||||
// - Add them to the UriInfo query parameters list
|
||||
// - Call loansApiResource.retrieveLoan(loanId, false, uriInfo)
|
||||
// - Remove the relative url query parameters from UriInfo in the finally (after loan details are retrieved)
|
||||
Map<String, String> queryParameters = null;
|
||||
if (relativeUrl.indexOf('?') > 0) {
|
||||
loanId = Long.parseLong(StringUtils.substringBetween(relativeUrl, "/", "?"));
|
||||
queryParameters = getQueryParameters(relativeUrl);
|
||||
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
|
||||
// for example: batches?enclosingTransaction=true
|
||||
// But the query parameters that are sent in the batch relative url has to be sent to
|
||||
// LoansApiResource.retrieveLoan
|
||||
// To use the relative url query parameters
|
||||
// - Parse and fetch the query parameters sent in the relative url
|
||||
// (loans/66?fields=id,principal,annualInterestRate)
|
||||
// - Add them to the UriInfo query parameters list
|
||||
// - Call loansApiResource.retrieveLoan(loanId, false, uriInfo)
|
||||
// - Remove the relative url query parameters from UriInfo in the finally (after loan details are retrieved)
|
||||
Map<String, String> queryParameters = null;
|
||||
if (relativeUrl.indexOf('?') > 0) {
|
||||
loanId = Long.parseLong(StringUtils.substringBetween(relativeUrl, "/", "?"));
|
||||
queryParameters = getQueryParameters(relativeUrl);
|
||||
|
||||
// Add the query parameters sent in the relative URL to UriInfo
|
||||
addQueryParametersToUriInfo(parameterizedUriInfo, queryParameters);
|
||||
} else {
|
||||
loanId = Long.parseLong(StringUtils.substringAfter(relativeUrl, "/"));
|
||||
}
|
||||
|
||||
// Calls 'retrieveLoan' function from 'LoansApiResource' to
|
||||
// get the loan details based on the loan id
|
||||
final boolean staffInSelectedOfficeOnly = false;
|
||||
String associations = null;
|
||||
String exclude = null;
|
||||
String fields = null;
|
||||
if (queryParameters != null && queryParameters.size() > 0) {
|
||||
if (queryParameters.containsKey("associations")) {
|
||||
associations = queryParameters.get("associations");
|
||||
}
|
||||
if (queryParameters.containsKey("exclude")) {
|
||||
exclude = queryParameters.get("exclude");
|
||||
}
|
||||
if (queryParameters.containsKey("fields")) {
|
||||
fields = queryParameters.get("fields");
|
||||
}
|
||||
}
|
||||
|
||||
responseBody = loansApiResource.retrieveLoan(loanId, staffInSelectedOfficeOnly, associations, exclude, fields,
|
||||
parameterizedUriInfo);
|
||||
|
||||
response.setStatusCode(HttpStatus.SC_OK);
|
||||
|
||||
// Sets the response after retrieving the loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
// Add the query parameters sent in the relative URL to UriInfo
|
||||
addQueryParametersToUriInfo(parameterizedUriInfo, queryParameters);
|
||||
} else {
|
||||
loanId = Long.parseLong(StringUtils.substringAfter(relativeUrl, "/"));
|
||||
}
|
||||
|
||||
// Calls 'retrieveLoan' function from 'LoansApiResource' to
|
||||
// get the loan details based on the loan id
|
||||
final boolean staffInSelectedOfficeOnly = false;
|
||||
String associations = null;
|
||||
String exclude = null;
|
||||
String fields = null;
|
||||
if (queryParameters != null && queryParameters.size() > 0) {
|
||||
if (queryParameters.containsKey("associations")) {
|
||||
associations = queryParameters.get("associations");
|
||||
}
|
||||
if (queryParameters.containsKey("exclude")) {
|
||||
exclude = queryParameters.get("exclude");
|
||||
}
|
||||
if (queryParameters.containsKey("fields")) {
|
||||
fields = queryParameters.get("fields");
|
||||
}
|
||||
}
|
||||
|
||||
responseBody = loansApiResource.retrieveLoan(loanId, staffInSelectedOfficeOnly, associations, exclude, fields,
|
||||
parameterizedUriInfo);
|
||||
|
||||
response.setStatusCode(HttpStatus.SC_OK);
|
||||
|
||||
// Sets the response after retrieving the loan
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
+5
-19
@@ -29,8 +29,6 @@ import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.command.CommandStrategyUtils;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.infrastructure.core.api.MutableUriInfo;
|
||||
import org.apache.fineract.portfolio.loanaccount.api.LoanTransactionsApiResource;
|
||||
import org.apache.http.HttpStatus;
|
||||
@@ -88,25 +86,13 @@ public class GetTransactionByIdCommandStrategy implements CommandStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'retrieveTransaction' function from 'loanTransactionsApiResource'
|
||||
responseBody = loanTransactionsApiResource.retrieveTransaction(loanId, transactionId, fields, uriInfo);
|
||||
// Calls 'retrieveTransaction' function from 'loanTransactionsApiResource'
|
||||
responseBody = loanTransactionsApiResource.retrieveTransaction(loanId, transactionId, fields, uriInfo);
|
||||
|
||||
response.setStatusCode(HttpStatus.SC_OK);
|
||||
response.setStatusCode(HttpStatus.SC_OK);
|
||||
|
||||
// Sets the body of the response after retrieving the transaction
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
// Sets the body of the response after retrieving the transaction
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+7
-22
@@ -23,8 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.exception.ErrorHandler;
|
||||
import org.apache.fineract.batch.exception.ErrorInfo;
|
||||
import org.apache.fineract.portfolio.client.api.ClientsApiResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -60,27 +58,14 @@ public class UpdateClientCommandStrategy implements CommandStrategy {
|
||||
final String relativeUrl = request.getRelativeUrl();
|
||||
final Long clientId = Long.parseLong(relativeUrl.substring(relativeUrl.indexOf('/') + 1));
|
||||
|
||||
// Try-catch blocks to map exceptions to appropriate status codes
|
||||
try {
|
||||
// Calls 'update' function from 'ClientsApiResource' to update a
|
||||
// client
|
||||
responseBody = clientsApiResource.update(clientId, request.getBody());
|
||||
|
||||
// Calls 'update' function from 'ClientsApiResource' to update a
|
||||
// client
|
||||
responseBody = clientsApiResource.update(clientId, request.getBody());
|
||||
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful update of
|
||||
// client information
|
||||
response.setBody(responseBody);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
// Gets an object of type ErrorInfo, containing information about
|
||||
// raised exception
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
}
|
||||
response.setStatusCode(200);
|
||||
// Sets the body of the response after the successful update of
|
||||
// client information
|
||||
response.setBody(responseBody);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
+22
-9
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.batch.command.CommandContext;
|
||||
import org.apache.fineract.batch.command.CommandStrategy;
|
||||
import org.apache.fineract.batch.command.CommandStrategyProvider;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class BatchApiServiceImpl implements BatchApiService {
|
||||
|
||||
private final CommandStrategyProvider strategyProvider;
|
||||
@@ -86,24 +88,35 @@ public class BatchApiServiceImpl implements BatchApiService {
|
||||
final BatchRequest rootRequest = rootNode.getRequest();
|
||||
final CommandStrategy commandStrategy = this.strategyProvider
|
||||
.getCommandStrategy(CommandContext.resource(rootRequest.getRelativeUrl()).method(rootRequest.getMethod()).build());
|
||||
final BatchResponse rootResponse = commandStrategy.execute(rootRequest, uriInfo);
|
||||
final BatchResponse rootResponse = safelyExecuteStrategy(commandStrategy, rootRequest, uriInfo);
|
||||
|
||||
responseList.add(rootResponse);
|
||||
responseList.addAll(this.processChildRequests(rootNode, rootResponse, uriInfo));
|
||||
}
|
||||
|
||||
Collections.sort(responseList, new Comparator<BatchResponse>() {
|
||||
|
||||
@Override
|
||||
public int compare(BatchResponse source, BatchResponse testee) {
|
||||
return source.getRequestId().compareTo(testee.getRequestId());
|
||||
}
|
||||
});
|
||||
Collections.sort(responseList, Comparator.comparing(BatchResponse::getRequestId));
|
||||
|
||||
return responseList;
|
||||
|
||||
}
|
||||
|
||||
private BatchResponse safelyExecuteStrategy(CommandStrategy commandStrategy, BatchRequest request, UriInfo uriInfo) {
|
||||
try {
|
||||
return commandStrategy.execute(request, uriInfo);
|
||||
} catch (RuntimeException e) {
|
||||
log.warn("Exception while executing batch strategy {}", commandStrategy.getClass().getSimpleName(), e);
|
||||
|
||||
ErrorInfo ex = ErrorHandler.handler(e);
|
||||
|
||||
final BatchResponse response = new BatchResponse();
|
||||
response.setRequestId(request.getRequestId());
|
||||
response.setHeaders(request.getHeaders());
|
||||
response.setStatusCode(ex.getStatusCode());
|
||||
response.setBody(ex.getMessage());
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
private List<BatchResponse> processChildRequests(final BatchRequestNode rootRequest, BatchResponse rootResponse, UriInfo uriInfo) {
|
||||
|
||||
final List<BatchResponse> childResponses = new ArrayList<>();
|
||||
@@ -121,7 +134,7 @@ public class BatchApiServiceImpl implements BatchApiService {
|
||||
final CommandStrategy commandStrategy = this.strategyProvider.getCommandStrategy(
|
||||
CommandContext.resource(childRequest.getRelativeUrl()).method(childRequest.getMethod()).build());
|
||||
|
||||
childResponse = commandStrategy.execute(childRequest, uriInfo);
|
||||
childResponse = safelyExecuteStrategy(commandStrategy, childRequest, uriInfo);
|
||||
|
||||
} else {
|
||||
// Something went wrong with the parent request, create
|
||||
|
||||
+2
@@ -55,6 +55,8 @@ final class CodeValuesApiResourceSwagger {
|
||||
|
||||
@Schema(example = "Passport")
|
||||
public String name;
|
||||
@Schema(example = "true")
|
||||
public Boolean isActive;
|
||||
@Schema(example = "Passport information")
|
||||
public String description;
|
||||
@Schema(example = "0")
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.configuration.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
@@ -103,7 +102,7 @@ public class GlobalConfigurationApiResource {
|
||||
+ "Returns the list global enable/disable survey configurations.\n" + "\n" + "Example Requests:\n" + "\n"
|
||||
+ "configurations/survey")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "List of example \\n response \\nsurveys response \\ngiven below", content = @Content(array = @ArraySchema(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class)))) })
|
||||
@ApiResponse(responseCode = "200", description = "List of example \\n response \\nsurveys response \\ngiven below", content = @Content(schema = @Schema(implementation = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class))) })
|
||||
public String retrieveConfiguration(@Context final UriInfo uriInfo,
|
||||
@DefaultValue("false") @QueryParam("survey") @Parameter(description = "survey") final boolean survey) {
|
||||
|
||||
|
||||
+4
@@ -326,4 +326,8 @@ public final class ResultsetColumnHeaderData implements Serializable {
|
||||
public String getColumnCode() {
|
||||
return this.columnCode;
|
||||
}
|
||||
|
||||
public List<ResultsetColumnValueData> getColumnValues() {
|
||||
return this.columnValues;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -1652,7 +1652,13 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
pValueWrite = "null";
|
||||
} else {
|
||||
if ("bit".equalsIgnoreCase(pColumnHeader.getColumnType())) {
|
||||
pValueWrite = BooleanUtils.toString(BooleanUtils.toBooleanObject(pValue), "1", "0", "null");
|
||||
if (databaseTypeResolver.isMySQL()) {
|
||||
pValueWrite = BooleanUtils.toString(BooleanUtils.toBooleanObject(pValue), "1", "0", "null");
|
||||
} else if (databaseTypeResolver.isPostgreSQL()) {
|
||||
pValueWrite = BooleanUtils.toString(BooleanUtils.toBooleanObject(pValue), "B'1'", "B'0'", "null");
|
||||
} else {
|
||||
throw new IllegalStateException("Current database is not supported");
|
||||
}
|
||||
} else {
|
||||
pValueWrite = singleQuote + this.genericDataService.replace(pValue, singleQuote, singleQuote + singleQuote)
|
||||
+ singleQuote;
|
||||
|
||||
+21
-1
@@ -25,7 +25,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||
import org.apache.fineract.portfolio.rate.data.RateData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
/**
|
||||
* Created by Chirag Gupta on 12/27/17.
|
||||
@@ -69,6 +69,26 @@ final class LoanProductsApiResourceSwagger {
|
||||
public Integer id;
|
||||
}
|
||||
|
||||
static final class RateData {
|
||||
|
||||
private RateData() {}
|
||||
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
|
||||
@Schema(example = "some name")
|
||||
public String name;
|
||||
|
||||
@Schema(example = "20")
|
||||
public BigDecimal percentage;
|
||||
|
||||
@Schema(description = "Apply specific product using its id, code, and value.")
|
||||
public EnumOptionData productApply;
|
||||
|
||||
@Schema(example = "false")
|
||||
public boolean active;
|
||||
}
|
||||
|
||||
@Schema(example = "LP Accrual Accounting")
|
||||
public String name;
|
||||
@Schema(example = "LPAA")
|
||||
|
||||
Reference in New Issue
Block a user