Resolving merge conflicts

This commit is contained in:
ThisuraThejith
2017-06-13 06:20:34 +05:30
119 changed files with 3155 additions and 366 deletions
+154
View File
@@ -0,0 +1,154 @@
/**
* 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.
*/
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
+11 -135
View File
@@ -1,145 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Not Found :(</title>
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
<link rel="stylesheet" href="404.css">
</head>
<body>
<div class="container">
<h1>Not found <span>:(</span></h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
@@ -148,10 +19,15 @@
<li>a mistyped address</li>
<li>an out-of-date link</li>
</ul>
<script>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
</script>
<script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
</div>
</body>
</html>
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:
+1
View File
@@ -92,6 +92,7 @@ rat {
excludes = [
'**/licenses/**',
'**/*.md',
'**/MANIFEST.MF',
'**/*.txt',
'**/*.log',
'**/fineractdev-eclipse-preferences.epf',
@@ -379,18 +379,17 @@ public class AccountingProcessorHelper {
* The target accounts for debits and credits are switched in case of a
* reversal
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited
* Enum of the placeholder of the GLAccount to be credited
* @param loanProductId
* @param paymentTypeId
* @param loanId
* @param transactionId
* @param transactionDate
* @param amount
* @param isReversal
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited Enum of the placeholder of the GLAccount to be credited
* @param loanProductId loanProductId
* @param loanId loanId
* @param transactionId transactionId
* @param transactionDate transactionDate
* @param totalAmount totalAmount
* @param isReversal isReversal
* @param chargePaymentDTOs chargePaymentDTOs
*/
public void createAccrualBasedJournalEntriesAndReversalsForLoanCharges(final Office office, final String currencyCode,
final Integer accountTypeToBeDebited, final Integer accountTypeToBeCredited, final Long loanProductId, final Long loanId,
@@ -568,17 +567,17 @@ public class AccountingProcessorHelper {
* reversal
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited
* Enum of the placeholder of the GLAccount to be credited
* @param currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited Enum of the placeholder of the GLAccount to be credited
* @param savingsProductId
* @param paymentTypeId
* @param loanId
* @param savingsId
* @param transactionId
* @param transactionDate
* @param amount
* @param isReversal
* @param taxDetails
*/
public void createCashBasedJournalEntriesAndReversalsForSavingsTax(final Office office, final String currencyCode,
final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited, final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited,
@@ -726,18 +725,18 @@ public class AccountingProcessorHelper {
* The target accounts for debits and credits are switched in case of a
* reversal
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited
* Enum of the placeholder of the GLAccount to be credited
* @param savingsProductId
* @param paymentTypeId
* @param loanId
* @param transactionId
* @param transactionDate
* @param amount
* @param isReversal
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
* @param accountTypeToBeCredited Enum of the placeholder of the GLAccount to be credited
* @param savingsProductId savingsProductId
* @param paymentTypeId paymentTypeId
* @param loanId loanId
* @param transactionId transactionId
* @param transactionDate transactionDate
* @param totalAmount totalAmount
* @param isReversal isReversal
* @param chargePaymentDTOs chargePaymentDTOs
*/
public void createCashBasedJournalEntriesAndReversalsForSavingsCharges(final Office office, final String currencyCode,
final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited, final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited,
@@ -33,9 +33,9 @@ import org.springframework.stereotype.Component;
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* applies a new loan on an existing client. It passes the contents of the body
* from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and gets back
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets back
* the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and map those
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those
* errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -33,9 +33,9 @@ import org.springframework.stereotype.Component;
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* applies a new savings on an existing client. It passes the contents of the
* body from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.SavingsAccountsApiResource} and
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.SavingsAccountsApiResource} and
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and
* map those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -33,9 +33,9 @@ import org.springframework.stereotype.Component;
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle
* approval of a pending loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and gets
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets
* back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and map
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map
* those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -33,9 +33,9 @@ import org.springframework.stereotype.Component;
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* Collect Charges for a Loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.LoanChargesApiResource} and
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.LoanChargesApiResource} and map
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and map
* those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -32,9 +32,9 @@ import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and Create
* Charge for a Loan. It passes the contents of the body from the BatchRequest
* to {@link org.apache.fineract.portfolio.client.api.LoanChargesApiResource} and
* to {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.LoanChargesApiResource} and map
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and map
* those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -33,9 +33,9 @@ import org.springframework.stereotype.Component;
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle
* disburse of a loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and gets
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets
* back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.LoansApiResource} and map
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map
* those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
@@ -46,7 +46,7 @@ public class BatchRequestJsonHelper extends FromJsonHelper {
* JSON string.
*
* @param json
* @return List<BatchRequest>
* @return List&lt;BatchRequest&gt;
*/
public List<BatchRequest> extractList(final String json) {
final Type listType = new TypeToken<List<BatchRequest>>() {}.getType();
@@ -45,7 +45,7 @@ public interface BatchApiService {
*
* @param requestList
* @param uriInfo
* @return List<BatchResponse>
* @return List&lt;BatchResponse&gt;
*/
List<BatchResponse> handleBatchRequestsWithoutEnclosingTransaction(List<BatchRequest> requestList, UriInfo uriInfo);
@@ -59,7 +59,7 @@ public interface BatchApiService {
*
* @param requestList
* @param uriInfo
* @return List<BatchResponse>
* @return List&lt;BatchResponse&gt;
*/
List<BatchResponse> handleBatchRequestsWithEnclosingTransaction(List<BatchRequest> requestList, UriInfo uriInfo);
}
@@ -91,7 +91,7 @@ public class ResolutionHelper {
* dependency hierarchy of that particular list.
*
* @param batchRequests
* @return List<ArrayList<BatchRequestNode>>
* @return List&lt;ArrayList&lt;BatchRequestNode&gt;&gt;
*/
public List<BatchRequestNode> getDependingRequests(final List<BatchRequest> batchRequests) {
final List<BatchRequestNode> rootRequests = new ArrayList<>();
@@ -128,7 +128,7 @@ public class ResolutionHelper {
* Request.
*
* @param request
* @param lastResponse
* @param parentResponse
* @return BatchRequest
*/
public BatchRequest resoluteRequest(final BatchRequest request, final BatchResponse parentResponse) {
@@ -21,8 +21,8 @@ package org.apache.fineract.commands.annotation;
import java.lang.annotation.*;
/**
* Specifies the command type for the annotated class.<br/>
* <br/>
* Specifies the command type for the annotated class.<br>
* <br>
* The entity name (e.g. CLIENT, SAVINGSACCOUNT, LOANPRODUCT) and the action (e.g. CREATE, DELETE) must be given.
*
* @author Markus Geiss
@@ -95,6 +95,12 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
@Column(name = "transaction_id", length = 100)
private String transactionId;
@Column(name="creditbureau_id")
private Long creditBureauId;
@Column(name="organisation_creditbureau_id")
private Long organisationCreditBureauId;
public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) {
return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(),
@@ -116,8 +122,25 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
this.maker = maker;
this.madeOnDate = madeOnDateTime.toDate();
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
} public Long getCreditBureauId() {
return this.creditBureauId;
}
public void setCreditBureauId(Long creditBureauId) {
this.creditBureauId = creditBureauId;
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public void setOrganisationCreditBureauId(Long OrganisationCreditBureauId) {
this.organisationCreditBureauId = OrganisationCreditBureauId;
}
public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) {
this.checker = checker;
this.checkedOnDate = checkedOnDate.toDate();
@@ -38,6 +38,8 @@ public class CommandWrapper {
private final String json;
private final String transactionId;
private final Long productId;
private final Long creditBureauId;
private final Long organisationCreditBureauId;
@SuppressWarnings("unused")
private Long templateId;
@@ -53,9 +55,10 @@ public class CommandWrapper {
public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String entityName,
final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId,
final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId) {
final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId,
final Long creditBureauId,final Long organisationCreditBureauId) {
return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId, officeId,
groupId, clientId, loanId, savingsId, transactionId);
groupId, clientId, loanId, savingsId, transactionId,creditBureauId,organisationCreditBureauId);
}
private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
@@ -75,11 +78,14 @@ public class CommandWrapper {
this.json = null;
this.transactionId = null;
this.productId = productId;
this.creditBureauId=null;
this.organisationCreditBureauId=null;
}
public CommandWrapper(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId,
final String actionName, final String entityName, final Long entityId, final Long subentityId, final String href,
final String json, final String transactionId, final Long productId, final Long templateId) {
final String json, final String transactionId, final Long productId, final Long templateId,
final Long creditBureauId,final Long organisationCreditBureauId) {
this.commandId = null;
this.officeId = officeId;
@@ -97,11 +103,14 @@ public class CommandWrapper {
this.transactionId = transactionId;
this.productId = productId;
this.templateId = templateId;
this.creditBureauId=creditBureauId;
this.organisationCreditBureauId=organisationCreditBureauId;
}
private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId, final Long groupId,
final Long clientId, final Long loanId, final Long savingsId, final String transactionId) {
final Long clientId, final Long loanId, final Long savingsId, final String transactionId,
final Long creditBureauId,final Long organisationCreditBureauId) {
this.commandId = commandId;
this.officeId = officeId;
@@ -118,6 +127,16 @@ public class CommandWrapper {
this.json = null;
this.transactionId = transactionId;
this.productId = productId;
this.creditBureauId=creditBureauId;
this.organisationCreditBureauId=organisationCreditBureauId;
}
public Long getCreditBureauId() {
return this.creditBureauId;
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public String getHref() {
@@ -35,8 +35,9 @@ import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* {@link CommandHandlerProvider} provides {@link NewCommandSourceHandler}s for a given entity and action.<br/>
* <br/>
* {@link CommandHandlerProvider} provides {@link NewCommandSourceHandler}s for a given entity and action.
* <br>
* <br>
* A {@link NewCommandSourceHandler} can be registered and the annotation {@link CommandType} is used to determine
* the entity and the action the handler is capable to process.
*
@@ -60,8 +61,8 @@ public class CommandHandlerProvider implements ApplicationContextAware {
}
/**
* Returns a handler for the given entity and action.<br/>
* <br/>
* Returns a handler for the given entity and action.<br>
* <br>
* Throws an {@link UnsupportedCommandException} if no handler
* for the given entity, action combination can be found.
* @param entity the entity to lookup the handler, must be given.
@@ -41,12 +41,48 @@ public class CommandWrapperBuilder {
private String transactionId;
private Long productId;
private Long templateId;
private Long creditBureauId;
private Long organisationCreditBureauId;
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.templateId,this.creditBureauId,this.organisationCreditBureauId);
}
public CommandWrapperBuilder updateCreditBureau() {
this.actionName = "UPDATE";
this.entityName = "ORGANISATIONCREDITBUREAU";
this.entityId = null;
this.href = "/creditBureauConfiguration/template";
return this;
}
public CommandWrapperBuilder updateCreditBureauLoanProductMapping() {
this.actionName = "UPDATE";
this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
this.entityId = null;
this.href = "/creditBureauConfiguration/template";
return this;
}
public CommandWrapperBuilder addOrganisationCreditBureau(final long organisationCreditBureauId) {
this.actionName = "CREATE";
this.entityName = "ORGANISATIONCREDITBUREAU";
this.entityId = organisationCreditBureauId;
this.href = "/creditBureauConfiguration/organizationCreditBureau/template";
this.organisationCreditBureauId=organisationCreditBureauId;
return this;
}
public CommandWrapperBuilder createCreditBureauLoanProductMapping(final long CreditBureauId) {
this.actionName = "CREATE";
this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
this.entityId = CreditBureauId;
this.href = "/creditBureauConfiguration/template";
this.creditBureauId=CreditBureauId;
return this;
}
public CommandWrapperBuilder addClientAddress(final long clientId,final long addressTypeId) {
@@ -92,7 +92,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json);
command = JsonCommand.from(json, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(), wrapper.getEntityId(),
wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getSavingsId(),
wrapper.getTransactionId(), wrapper.getHref(), wrapper.getProductId());
wrapper.getTransactionId(), wrapper.getHref(), wrapper.getProductId(),wrapper.getCreditBureauId(),wrapper.getOrganisationCreditBureauId());
while (numberOfRetries <= maxNumberOfRetries) {
try {
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
@@ -139,13 +139,14 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(),
commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(),
commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(),
commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId());
commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId(),commandSourceInput.getCreditBureauId(),commandSourceInput.getOrganisationCreditBureauId());
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json());
final JsonCommand command = JsonCommand.fromExistingCommand(makerCheckerId, commandSourceInput.json(), parsedCommand,
this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(),
commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(),
commandSourceInput.getLoanId(), commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId(),
commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId());
commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(),commandSourceInput.getCreditBureauId(),
commandSourceInput.getOrganisationCreditBureauId());
final boolean makerCheckerApproval = true;
return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval);
@@ -34,7 +34,7 @@ import org.springframework.stereotype.Component;
* <li>Pretty printing through pretty=true, defaults to false</li>
* <li>Partial response through fields=id, name etc, when empty, the full data
* is returned by default.</li>
* </ul
* </ul>
*/
@Component
public class ApiRequestParameterHelper {
@@ -64,28 +64,31 @@ public final class JsonCommand {
private final String transactionId;
private final String url;
private final Long productId;
private final Long creditBureauId;
private final Long organisationCreditBureauId;
public static JsonCommand from(final String jsonCommand, final JsonElement parsedCommand, final FromJsonHelper fromApiJsonHelper,
final String entityName, final Long resourceId, final Long subresourceId, final Long groupId, final Long clientId,
final Long loanId, final Long savingsId, final String transactionId, final String url, final Long productId) {
final Long loanId, final Long savingsId, final String transactionId, final String url, final Long productId,
final Long creditBureauId,final Long organisationCreditBureauId) {
return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId,
clientId, loanId, savingsId, transactionId, url, productId);
clientId, loanId, savingsId, transactionId, url, productId,creditBureauId,organisationCreditBureauId);
}
public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
final String url, final Long productId) {
final String url, final Long productId,final Long creditBureauId,final Long organisationCreditBureauId) {
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, null, null,
null, null, null, url, productId);
null, null, null, url, productId,creditBureauId,organisationCreditBureauId);
}
public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId, final String url,
final Long productId) {
final Long productId,Long creditBureauId,final Long organisationCreditBureauId) {
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId,
clientId, loanId, savingsId, transactionId, url, productId);
clientId, loanId, savingsId, transactionId, url, productId,creditBureauId,organisationCreditBureauId);
}
@@ -93,13 +96,13 @@ public final class JsonCommand {
final String jsonCommand = command.fromApiJsonHelper.toJson(parsedCommand);
return new JsonCommand(command.commandId, jsonCommand, parsedCommand, command.fromApiJsonHelper, command.entityName,
command.resourceId, command.subresourceId, command.groupId, command.clientId, command.loanId, command.savingsId,
command.transactionId, command.url, command.productId);
command.transactionId, command.url, command.productId,command.creditBureauId,command.organisationCreditBureauId);
}
public JsonCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId, final String url,
final Long productId) {
final Long productId,final Long creditBureauId, final Long organisationCreditBureauId) {
this.commandId = commandId;
this.jsonCommand = jsonCommand;
@@ -115,6 +118,16 @@ public final class JsonCommand {
this.transactionId = transactionId;
this.url = url;
this.productId = productId;
this.creditBureauId=creditBureauId;
this.organisationCreditBureauId=organisationCreditBureauId;
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public Long getCreditBureauId() {
return this.creditBureauId;
}
public String json() {
@@ -32,7 +32,7 @@ import org.springframework.context.annotation.PropertySource;
* Base Spring Configuration with what's common to all Configuration subclasses.
*
* Notably the EnableAutoConfiguration excludes relevant for (and often adjusted
* when upgrading versions of) Spring Boot, the "old" (pre. Spring Boot &
* when upgrading versions of) Spring Boot, the "old" (pre. Spring Boot &amp;
* MariaDB4j) fineract appContext.xml which all configurations need, and the
* web.xml successor WebXmlConfiguration.
*
@@ -28,7 +28,7 @@ import org.springframework.context.annotation.ImportResource;
* Configuration just adds the JNDI-based DataSource lookup to its
* AbstractApplicationConfiguration.
*
* This (intentionally) only configures the original (pre-Spring Boot &
* This (intentionally) only configures the original (pre-Spring Boot &amp;
* MariaDB4j) fineract Spring Beans, and does NOT include the embedded Tomcat
* (incl. TomcatSSLConfiguration) nor the MariaDB4jSetupService or
* MariaDB4jDataSourceConfiguration, and not even the DataSourceConfiguration
@@ -145,7 +145,7 @@ public class DataValidatorBuilder {
* param and if it has invalid value or value not passed then call this
* method, this method is always used with input as false
*/
public DataValidatorBuilder trueOrFalseRequired(final boolean trueOfFalseFieldProvided) {
public DataValidatorBuilder trueOrFalseRequired1(final boolean trueOfFalseFieldProvided) {
if (!trueOfFalseFieldProvided && !this.ignoreNullValue) {
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
.append(this.parameter).append(".must.be.true.or.false");
@@ -157,6 +157,27 @@ public class DataValidatorBuilder {
}
return this;
}
public DataValidatorBuilder trueOrFalseRequired(final Object trueOfFalseField)
{
if(trueOfFalseField!=null)
{
if((!trueOfFalseField.toString().equalsIgnoreCase("true")) && (!trueOfFalseField.toString().equalsIgnoreCase("false")) )
{
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
.append(this.parameter).append(".must.be.true.or.false");
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
" must be set as true or false.");
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
defaultEnglishMessage.toString(), this.parameter);
this.dataValidationErrors.add(error);
}
}
return this;
}
public DataValidatorBuilder notNull() {
if (this.value == null && !this.ignoreNullValue) {
@@ -31,7 +31,7 @@ import com.google.gson.GsonBuilder;
/**
* <p>
* A google gson implementation of {@link ExcludeNothingJsonSerializer}
* A google gson implementation of
* contract.
* </p>
*
@@ -31,7 +31,7 @@ import com.google.gson.GsonBuilder;
/**
* <p>
* A google gson implementation of {@link ExcludeNothingJsonSerializer}
* A google gson implementation of
* contract.
* </p>
*
@@ -31,7 +31,7 @@ import com.google.gson.GsonBuilder;
/**
* <p>
* A google gson implementation of {@link ExcludeNothingJsonSerializer}
* A google gson implementation of
* contract.
* </p>
*
@@ -115,7 +115,7 @@ public class FromJsonHelper {
/**
* @param parentPropertyName
* The full json path to this property,the value is appended to
* the parameter name while generating an error message <br/>
* the parameter name while generating an error message <br>
* Ex: property "name" in Object "person" would be named as
* "person.name"
* @param object
@@ -0,0 +1,239 @@
/**
* 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.infrastructure.creditbureau.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurationData;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingReadPlatformService;
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadConfigurationService;
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/CreditBureauConfiguration")
@Component
@Scope("singleton")
public class CreditBureauConfigurationAPI {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
private final String resourceNameForPermissions = "CreditBureau";
private final PlatformSecurityContext context;
private final CreditBureauReadPlatformService readPlatformService;
private final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer;
private final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct;
private final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau;
private final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct;
private final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau;
private final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final CreditBureauReadConfigurationService creditBureauConfiguration;
@Autowired
public CreditBureauConfigurationAPI(final PlatformSecurityContext context,
final CreditBureauReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
final CreditBureauReadConfigurationService creditBureauConfiguration) {
this.context = context;
this.readPlatformService = readPlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonSerializerReport = toApiJsonSerializerReport;
this.creditBureauConfiguration = creditBureauConfiguration;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getCreditBureau(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, creditBureau, this.RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("/mappings")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getCreditBureauLoanProductMapping(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
.readCreditBureauLoanProductMapping();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("/organisationCreditBureau")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getOrganisationCreditBureau(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final Collection<OrganisationCreditBureauData> organisationCreditBureau = this.readPlatformServiceOrganisationCreditBureau
.retrieveOrgCreditBureau();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau,
this.RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("/config/{organisationCreditBureauId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getConfiguration(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, @Context final UriInfo uriInfo) {
// System.out.println("config triggered");
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final Collection<CreditBureauConfigurationData> configurationData = this.creditBureauConfiguration
.readConfigurationByOrganisationCreditBureauId(organisationCreditBureauId);
return this.toApiJsonSerializerReport.serialize(configurationData);
}
@GET
@Path("/loanProduct")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String fetchLoanProducts(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
.fetchLoanProducts();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
}
@PUT
@Path("/organisationCreditBureau")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String updateCreditBureau(final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureau()
.withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@PUT
@Path("/mappings")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String updateCreditBureauLoanProductMapping(final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureauLoanProductMapping()
.withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@POST
@Path("/organisationCreditBureau/{organisationCreditBureauId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String addOrganisationCreditBureau(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().addOrganisationCreditBureau(organisationCreditBureauId)
.withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@POST
@Path("/mappings/{CreditBureauId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String createCreditBureauLoanProductMapping(@PathParam("CreditBureauId") final Long CreditBureauId, final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(CreditBureauId)
.withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
}
@@ -0,0 +1,68 @@
/**
* 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.infrastructure.creditbureau.data;
public class CreditBureauConfigurationData {
private final long creditBureauConfigurationId;
private final String configurationKey;
private final String value;
private final long organizationCreditBureauId;
private final String description;
private CreditBureauConfigurationData(final long creditBureauConfigurationId, final String configurationKey,
final String value, final long organizationCreditBureauId, final String description) {
this.creditBureauConfigurationId = creditBureauConfigurationId;
this.configurationKey = configurationKey;
this.value = value;
this.organizationCreditBureauId = organizationCreditBureauId;
this.description = description;
}
public static CreditBureauConfigurationData instance(final long creditBureauConfigurationId, final String configurationKey,
final String value, final long organizationCreditBureauId, final String description) {
return new CreditBureauConfigurationData(creditBureauConfigurationId, configurationKey, value,
organizationCreditBureauId, description);
}
public long getCreditBureauConfigurationId() {
return this.creditBureauConfigurationId;
}
public String getConfigurationKey() {
return this.configurationKey;
}
public String getValue() {
return this.value;
}
public long getOrganizationCreditBureauId() {
return this.organizationCreditBureauId;
}
public String getDescription() {
return this.description;
}
}
@@ -0,0 +1,77 @@
/**
* 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.infrastructure.creditbureau.data;
public class CreditBureauData {
private final long creditBureauId;
private final String creditBureauName;
private final String country;
private final String productName;
private final String creditBureauSummary;
private final long implementationKey;
private CreditBureauData(final long creditBureauId, final String creditBureauName, final String country,
final String productName, final String creditBureauSummary, final long implementationKey) {
this.creditBureauId = creditBureauId;
this.creditBureauName = creditBureauName;
this.country = country;
this.productName = productName;
this.creditBureauSummary = creditBureauSummary;
this.implementationKey = implementationKey;
}
public static CreditBureauData instance(final long creditBureauId, final String creditBureauName,
final String country, final String productName, final String creditBureauSummary, final long implementationKey) {
return new CreditBureauData(creditBureauId, creditBureauName, country, productName, creditBureauSummary,
implementationKey);
}
public String getCreditBureauSummary() {
return this.creditBureauSummary;
}
public long getCreditBureauId() {
return this.creditBureauId;
}
public String getCreditBureauName() {
return this.creditBureauName;
}
public String getCountry() {
return this.country;
}
public String getProductName() {
return this.productName;
}
public long getImplementationKey() {
return this.implementationKey;
}
}
@@ -0,0 +1,112 @@
/**
* 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.infrastructure.creditbureau.data;
public class CreditBureauLoanProductMappingData {
private final long creditbureauLoanProductMappingId;
private final long organisationCreditBureauId;
private final String alias;
private final String creditbureauSummary;
private final String loanProductName;
private final long loanProductId;
private final boolean isCreditCheckMandatory;
private final boolean skipCrediCheckInFailure;
private final long stalePeriod;
private final boolean is_active;
private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId,
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId;
this.organisationCreditBureauId = organisationCreditBureauId;
this.alias = alias;
this.creditbureauSummary = creditbureauSummary;
this.loanProductName = loanProductName;
this.loanProductId = loanProductId;
this.isCreditCheckMandatory = isCreditCheckMandatory;
this.skipCrediCheckInFailure = skipCrediCheckInFailure;
this.stalePeriod = stalePeriod;
this.is_active = is_active;
}
public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId,
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias,
creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure,
stalePeriod, is_active);
}
public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) {
return new CreditBureauLoanProductMappingData(0, 0, "", "", loanProductName, loanProductId, false, false, 0, false);
}
public long getCreditbureauLoanProductMappingId() {
return this.creditbureauLoanProductMappingId;
}
public String getAlias() {
return this.alias;
}
public String getCreditbureauSummary() {
return this.creditbureauSummary;
}
public String getLoanProductName() {
return this.loanProductName;
}
public long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public long getLoanProductId() {
return this.loanProductId;
}
public boolean isCreditCheckMandatory() {
return this.isCreditCheckMandatory;
}
public boolean isSkipCrediCheckInFailure() {
return this.skipCrediCheckInFailure;
}
public long getStalePeriod() {
return this.stalePeriod;
}
public boolean isIs_active() {
return this.is_active;
}
}
@@ -0,0 +1,52 @@
/**
* 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.infrastructure.creditbureau.data;
public class CreditBureauMasterData {
private final long creditBureauId;
private final String creditBureauName;
private final String country;
public static CreditBureauMasterData instance(final Long creditBureauId, final String creditBureauName, final String country) {
return new CreditBureauMasterData(creditBureauId, creditBureauName, country);
}
private CreditBureauMasterData(final Long creditBureauId, final String creditBureauName, final String country) {
this.creditBureauId = creditBureauId;
this.creditBureauName = creditBureauName;
this.country = country;
}
public String getCreditBureauName() {
return this.creditBureauName;
}
public String getCountry() {
return this.country;
}
public Long getCreditBureauId() {
return this.creditBureauId;
}
}
@@ -0,0 +1,53 @@
/**
* 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.infrastructure.creditbureau.data;
public class CreditBureauProduct {
private final long creditBureauProductId;
private final String creditBureauProductName;
private final long creditBureauMasterId;
private CreditBureauProduct(final long creditBureauProductId, final String creditBureauProductName,
final long creditBureauMasterId) {
this.creditBureauProductId = creditBureauProductId;
this.creditBureauProductName = creditBureauProductName;
this.creditBureauMasterId = creditBureauMasterId;
}
public static CreditBureauProduct instance(final long creditBureauProductId, final String creditBureauProductName,
final long creditBureauMasterId) {
return new CreditBureauProduct(creditBureauProductId, creditBureauProductName, creditBureauMasterId);
}
public long getCreditBureauProductId() {
return this.creditBureauProductId;
}
public String getCreditBureauProductName() {
return this.creditBureauProductName;
}
public long getCreditBureauMasterId() {
return this.creditBureauMasterId;
}
}
@@ -0,0 +1,91 @@
/**
* 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.infrastructure.creditbureau.data;
public class OrganisationCreditBureauData {
private final long organisationCreditBureauId;
private final String alias;
private final long creditBureauId;
private final String creditBureauName;
private final String creditBureauProduct;
private final String creditBureauCountry;
private final String creditBureauSummary;
private final boolean is_active;
private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias,
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
this.organisationCreditBureauId = organisationCreditBureauId;
this.alias = alias;
this.creditBureauId = creditBureauId;
this.creditBureauName = creditBureauName;
this.creditBureauProduct = creditBureauProduct;
this.creditBureauCountry = creditBureauCountry;
this.creditBureauSummary = creditBureauSummary;
this.is_active = is_active;
}
public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias,
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName,
creditBureauProduct, creditBureauCountry, creditBureauSummary, is_active);
}
public long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public String getCreditBureauName() {
return this.creditBureauName;
}
public String getCreditBureauProduct() {
return this.creditBureauProduct;
}
public String getCreditBureauCountry() {
return this.creditBureauCountry;
}
public String getCreditBureauSummary() {
return this.creditBureauSummary;
}
public String getAlias() {
return this.alias;
}
public long getCreditBureauId() {
return this.creditBureauId;
}
public boolean isActive() {
return this.is_active;
}
}
@@ -0,0 +1,112 @@
/**
* 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.infrastructure.creditbureau.domain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@Entity
@Table(name = "m_creditbureau")
public class CreditBureau extends AbstractPersistableCustom<Long> {
private String name;
private String product;
private String country;
private String implementationKey;
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
private List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping = new ArrayList<>();
public CreditBureau(String name, String product, String country, String implementationKey,
List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
this.name = name;
this.product = product;
this.country = country;
this.implementationKey = implementationKey;
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
}
public CreditBureau() {
}
public static CreditBureau fromJson(final JsonCommand command) {
final String tname = command.stringValueOfParameterNamed("name");
final String tproduct = command.stringValueOfParameterNamed("product");
final String tcountry = command.stringValueOfParameterNamed("country");
final String timplementationKey = command.stringValueOfParameterNamed("implementationKey");
return new CreditBureau(tname, tproduct, tcountry, timplementationKey, null);
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getProduct() {
return this.product;
}
public void setProduct(String product) {
this.product = product;
}
public String getCountry() {
return this.country;
}
public void setCountry(String country) {
this.country = country;
}
public String getImplementationKey() {
return this.implementationKey;
}
public void setImplementationKey(String implementationKey) {
this.implementationKey = implementationKey;
}
public List<CreditBureauLoanProductMapping> getCreditBureauLpMapping() {
return this.CreditBureauLoanProductMapping;
}
public void setCreditBureauLpMapping(List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
}
}
@@ -0,0 +1,101 @@
/**
* 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.infrastructure.creditbureau.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@Entity
@Table(name = "m_creditbureau_configuration")
public class CreditBureauConfiguration extends AbstractPersistableCustom<Long> {
@Column(name = "configkey")
private String configurationKey;
@Column(name = "value")
private String value;
@Column(name = "description")
private String description;
@ManyToOne
@JoinColumn(name = "organisation_creditbureau_id")
private OrganisationCreditBureau organisationCreditbureau;
public CreditBureauConfiguration() {
}
public CreditBureauConfiguration(String configkey, String value, String description,
OrganisationCreditBureau organisationCreditbureau) {
this.configurationKey = configkey;
this.value = value;
this.description = description;
this.organisationCreditbureau = organisationCreditbureau;
}
public CreditBureauConfiguration fromJson(JsonCommand command, OrganisationCreditBureau organisation_creditbureau) {
final String configkey = command.stringValueOfParameterNamed("configkey");
final String value = command.stringValueOfParameterNamed("value");
final String description = command.stringValueOfParameterNamed("description");
return new CreditBureauConfiguration(configkey, value, description, organisation_creditbureau);
}
public String getConfigkey() {
return this.configurationKey;
}
public void setConfigkey(String configkey) {
this.configurationKey = configkey;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public OrganisationCreditBureau getOrganisation_creditbureau() {
return this.organisationCreditbureau;
}
public void setOrganisation_creditbureau(OrganisationCreditBureau organisation_creditbureau) {
this.organisationCreditbureau = organisation_creditbureau;
}
}
@@ -0,0 +1,150 @@
/**
* 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.infrastructure.creditbureau.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@Entity
@Table(name = "m_creditbureau_loanproduct_mapping")
public class CreditBureauLoanProductMapping extends AbstractPersistableCustom<Long> {
@Column(name = "is_CreditCheck_Mandatory")
private boolean isCreditCheckMandatory;
@Column(name = "skip_CreditCheck_in_Failure")
private boolean skipCreditCheckInFailure;
@Column(name = "stale_Period")
private int stalePeriod;
private boolean is_active;
@ManyToOne
private OrganisationCreditBureau organisation_creditbureau;
@OneToOne
@JoinColumn(name="loan_product_id")
private LoanProduct loanProduct;
public CreditBureauLoanProductMapping() {
}
public CreditBureauLoanProductMapping(boolean isCreditCheckMandatory, boolean skipCreditCheckInFailure, int stalePeriod,
boolean is_active, OrganisationCreditBureau organisationCreditbureau, LoanProduct loanProduct) {
this.isCreditCheckMandatory = isCreditCheckMandatory;
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
this.stalePeriod = stalePeriod;
this.is_active = is_active;
this.organisation_creditbureau = organisationCreditbureau;
this.loanProduct = loanProduct;
}
public static CreditBureauLoanProductMapping fromJson(final JsonCommand command,
OrganisationCreditBureau organisation_creditbureau, LoanProduct loanProduct) {
Boolean isCreditCheckMandatory=false;
Boolean skipCreditCheckInFailure=false;
Integer stalePeriod=-1;
Boolean is_active=false;
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory")!=null)
{
isCreditCheckMandatory = command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory");
}
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure")!=null)
{
skipCreditCheckInFailure = command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure");
}
if((Integer)command.integerValueOfParameterNamed("stalePeriod")!=null)
{
stalePeriod = command.integerValueOfParameterNamed("stalePeriod");
}
if((Boolean) command.booleanPrimitiveValueOfParameterNamed("is_active"))
{
is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
}
return new CreditBureauLoanProductMapping(isCreditCheckMandatory, skipCreditCheckInFailure, stalePeriod, is_active,
organisation_creditbureau, loanProduct);
}
public boolean isCreditCheckMandatory() {
return this.isCreditCheckMandatory;
}
public void setCreditCheckMandatory(boolean isCreditCheckMandatory) {
this.isCreditCheckMandatory = isCreditCheckMandatory;
}
public boolean isSkipCreditCheckInFailure() {
return this.skipCreditCheckInFailure;
}
public void setSkipCreditCheckInFailure(boolean skipCreditCheckInFailure) {
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
}
public int getStalePeriod() {
return this.stalePeriod;
}
public void setStalePeriod(int stalePeriod) {
this.stalePeriod = stalePeriod;
}
public boolean isIs_active() {
return this.is_active;
}
public void setIs_active(boolean is_active) {
this.is_active = is_active;
}
public OrganisationCreditBureau getOrganisationCreditbureau() {
return this.organisation_creditbureau;
}
public void setOrganisationCreditbureau(OrganisationCreditBureau organisationCreditbureau) {
this.organisation_creditbureau = organisationCreditbureau;
}
public LoanProduct getLoanProduct() {
return this.loanProduct;
}
public void setLoanProduct(LoanProduct loanProduct) {
this.loanProduct = loanProduct;
}
}
@@ -0,0 +1,27 @@
/**
* 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.infrastructure.creditbureau.domain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface CreditBureauLoanProductMappingRepository
extends JpaRepository<CreditBureauLoanProductMapping, Long>, JpaSpecificationExecutor<CreditBureauLoanProductMapping> {
}
@@ -0,0 +1,30 @@
/**
* 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.infrastructure.creditbureau.domain;
//import org.apache.fineract.infrastructure.jobs.domain.ScheduledJobDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface CreditBureauRepository
extends JpaRepository<CreditBureau, Long>, JpaSpecificationExecutor<CreditBureau> {
// CreditBureau findOne(long id);
}
@@ -0,0 +1,100 @@
/**
* 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.infrastructure.creditbureau.domain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@Entity
@Table(name = "m_organisation_creditbureau")
public class OrganisationCreditBureau extends AbstractPersistableCustom<Long> {
private String alias;
@OneToOne
private CreditBureau creditbureau;
private boolean is_active;
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>();
public OrganisationCreditBureau(String alias, CreditBureau creditBureau, boolean is_active,
List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
this.alias = alias;
this.creditbureau = creditBureau;
this.is_active = is_active;
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
}
public OrganisationCreditBureau() {
}
public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditBureau) {
final String alias = command.stringValueOfParameterNamed("alias");
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
return new OrganisationCreditBureau(alias, creditBureau, is_active, null);
}
public String getAlias() {
return this.alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public CreditBureau getCreditBureau() {
return this.creditbureau;
}
public void setCreditBureau(CreditBureau creditBureau) {
this.creditbureau = creditBureau;
}
public boolean isActive() {
return this.is_active;
}
public void setIsActive(boolean is_active) {
this.is_active = is_active;
}
public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() {
return this.creditBureauLoanProductMapping;
}
public void setCreditBureauLoanProductMapping(List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
}
}
@@ -0,0 +1,27 @@
/**
* 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.infrastructure.creditbureau.domain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface OrganisationCreditBureauRepository
extends JpaRepository<OrganisationCreditBureau, Long>, JpaSpecificationExecutor<OrganisationCreditBureau> {
}
@@ -0,0 +1,45 @@
/**
* 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.infrastructure.creditbureau.handler;
import org.apache.fineract.commands.annotation.CommandType;
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauWritePlatflormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@CommandType(entity = "ORGANISATIONCREDITBUREAU", action = "CREATE")
public class AddOrganisationCreditBureauCommandHandler implements NewCommandSourceHandler {
private final OrganisationCreditBureauWritePlatflormService writePlatformService;
@Autowired
public AddOrganisationCreditBureauCommandHandler(final OrganisationCreditBureauWritePlatflormService writePlatformService) {
this.writePlatformService = writePlatformService;
}
@Override
public CommandProcessingResult processCommand(JsonCommand command) {
return this.writePlatformService.addOrganisationCreditBureau(command.getOrganisationCreditBureauId(), command);
}
}
@@ -0,0 +1,46 @@
/**
* 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.infrastructure.creditbureau.handler;
import org.apache.fineract.commands.annotation.CommandType;
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@CommandType(entity = "CREDITBUREAU_LOANPRODUCT_MAPPING", action = "CREATE")
public class CreateCreditBureauLoanProductMappingCommandHandler implements NewCommandSourceHandler {
private final CreditBureauLoanProductMappingWritePlatformService writePlatformService;
@Autowired
public CreateCreditBureauLoanProductMappingCommandHandler(final CreditBureauLoanProductMappingWritePlatformService writePlatformService) {
this.writePlatformService = writePlatformService;
}
@Override
public CommandProcessingResult processCommand(JsonCommand command) {
return this.writePlatformService.addCreditBureauLoanProductMapping(command.getCreditBureauId(), command);
}
}
@@ -0,0 +1,48 @@
/**
* 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.infrastructure.creditbureau.handler;
import org.apache.fineract.commands.annotation.CommandType;
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauWritePlatflormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "ORGANISATIONCREDITBUREAU", action = "UPDATE")
public class UpdateCreditBureauCommandHandler implements NewCommandSourceHandler {
private final OrganisationCreditBureauWritePlatflormService writePlatformService;
@Autowired
public UpdateCreditBureauCommandHandler(final OrganisationCreditBureauWritePlatflormService writePlatformService) {
this.writePlatformService = writePlatformService;
}
@Transactional
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.updateCreditBureau(command);
}
}
@@ -0,0 +1,49 @@
/**
* 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.infrastructure.creditbureau.handler;
import org.apache.fineract.commands.annotation.CommandType;
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@CommandType(entity = "CREDITBUREAU_LOANPRODUCT_MAPPING", action = "UPDATE")
public class UpdateCreditBureauLoanProductMappingCommandHandler implements NewCommandSourceHandler {
private final CreditBureauLoanProductMappingWritePlatformService writePlatformService;
@Autowired
public UpdateCreditBureauLoanProductMappingCommandHandler(final CreditBureauLoanProductMappingWritePlatformService writePlatformService) {
this.writePlatformService = writePlatformService;
}
@Transactional
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.updateCreditBureauLoanProductMapping(command);
}
}
@@ -0,0 +1,90 @@
/**
* 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.infrastructure.creditbureau.serialization;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
@Component
public class CreditBureauCommandFromApiJsonDeserializer {
private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("alias", "is_active"));
private final FromJsonHelper fromApiJsonHelper;
@Autowired
public CreditBureauCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
}
public void validateForCreate(final String json, final Long creditBureauId) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
}
final Type typeOfMap = new TypeToken<Map<String, Object>>() {
}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
.resource("CreditBureau");
final JsonElement element = this.fromApiJsonHelper.parse(json);
baseDataValidator.reset().value(creditBureauId).notBlank().integerGreaterThanZero();
final String alias = this.fromApiJsonHelper.extractStringNamed("alias", element);
baseDataValidator.reset().parameter("alias").value(alias).notNull().notBlank().notExceedingLengthOf(100);
final String is_activeParameter = "is_active";
if (this.fromApiJsonHelper.parameterExists(is_activeParameter, element)) {
final boolean is_active = this.fromApiJsonHelper.extractBooleanNamed("is_active", element);
baseDataValidator.reset().parameter("is_active").value(is_active).notNull().notBlank().trueOrFalseRequired(is_active);
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
if (!dataValidationErrors.isEmpty()) {
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
"Validation errors exist.", dataValidationErrors);
}
}
}
@@ -0,0 +1,137 @@
/**
* 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.infrastructure.creditbureau.serialization;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
@Component
public class CreditBureauLoanProductCommandFromApiJsonDeserializer {
private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("loan_product_id",
"is_creditcheck_mandatory", "skip_creditcheck_in_failure", "stale_period", "is_active", "locale"));
private final FromJsonHelper fromApiJsonHelper;
@Autowired
public CreditBureauLoanProductCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
}
public void validateForCreate(final String json, final Long cb_id) {
if (StringUtils.isBlank(json)) {
throw new InvalidJsonException();
}
final Type typeOfMap = new TypeToken<Map<String, Object>>() {
}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
.resource("CREDITBUREAU_LOANPRODUCT_MAPPING");
final JsonElement element = this.fromApiJsonHelper.parse(json);
baseDataValidator.reset().value(cb_id).notBlank().integerGreaterThanZero();
final long loan_product_id = this.fromApiJsonHelper.extractLongNamed("loan_product_id", element);
baseDataValidator.reset().parameter("loan_product_id").value(loan_product_id).notBlank()
.integerGreaterThanZero();
System.out.println("loan product id " + loan_product_id);
if(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",element)!= null)
{
final boolean is_creditcheck_mandatory = this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
element);
baseDataValidator.reset().parameter("is_creditcheck_mandatory").value(is_creditcheck_mandatory).notBlank()
.trueOrFalseRequired(is_creditcheck_mandatory);
}
else
{
baseDataValidator.reset().parameter("is_creditcheck_mandatory").value(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
element)).notBlank()
.trueOrFalseRequired(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
element));
}
if( this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element)!=null)
{
final boolean skip_creditcheck_in_failure = this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element);
baseDataValidator.reset().parameter("skip_creditcheck_in_failure").value(skip_creditcheck_in_failure).notBlank().trueOrFalseRequired(skip_creditcheck_in_failure);
}
else
{
baseDataValidator.reset().parameter("skip_creditcheck_in_failure").value(this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element)).notBlank().trueOrFalseRequired(this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element));
}
if(this.fromApiJsonHelper.extractLongNamed("stale_period", element)!=null)
{
final long stale_period = this.fromApiJsonHelper.extractLongNamed("stale_period", element);
baseDataValidator.reset().parameter("stale_period").value(stale_period).notBlank().integerGreaterThanZero();
}
else
{
baseDataValidator.reset().parameter("stale_period").value(this.fromApiJsonHelper.extractLongNamed("stale_period", element)).notBlank().integerGreaterThanZero();
}
if(this.fromApiJsonHelper.extractBooleanNamed("is_active", element)!=null)
{
Boolean is_active = this.fromApiJsonHelper.extractBooleanNamed("is_active", element);
if (is_active == null) {
is_active = false;
} else {
baseDataValidator.reset().parameter("is_active").value(is_active).notBlank().trueOrFalseRequired(is_active);
}
}
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
if (!dataValidationErrors.isEmpty()) {
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
"Validation errors exist.", dataValidationErrors);
}
}
}
@@ -0,0 +1,33 @@
/**
* 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.infrastructure.creditbureau.service;
import java.util.Collection;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
public interface CreditBureauLoanProductMappingReadPlatformService {
Collection<CreditBureauLoanProductMappingData> readCreditBureauLoanProductMapping();
Collection<CreditBureauLoanProductMappingData> fetchLoanProducts();
CreditBureauLoanProductMappingData readMappingByLoanId(long loanProductId);
}
@@ -0,0 +1,122 @@
/**
* 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.infrastructure.creditbureau.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
@Service
public class CreditBureauLoanProductMappingReadPlatformServiceImpl implements CreditBureauLoanProductMappingReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
@Autowired
public CreditBureauLoanProductMappingReadPlatformServiceImpl(final PlatformSecurityContext context,
final RoutingDataSource dataSource) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private static final class CreditBureauLoanProductMapper implements RowMapper<CreditBureauLoanProductMappingData> {
public String schema() {
return "cblp.id as mappingId, cblp.organisation_creditbureau_id as orgcbId,"
+ "orgcb.alias as alias,concat( cb.product,' - ' ,cb.name,' - ',cb.country) as creditbureau,"
+ "cblp.loan_product_id as lpId,lp.name as loan_product_name,cblp.is_creditcheck_mandatory as crCheck,cblp.skip_creditcheck_in_failure as skipcheck,"
+ "cblp.stale_period as staleperiod,cblp.is_active as is_active from"
+ " m_creditbureau_loanproduct_mapping cblp, m_organisation_creditbureau orgcb,m_product_loan lp,m_creditbureau cb"
+ " where cblp.organisation_creditbureau_id=orgcb.id and cblp.loan_product_id=lp.id and orgcb.creditbureau_id=cb.id";
}
@Override
public CreditBureauLoanProductMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
final Long mapping_id = rs.getLong("mappingId");
final Long orgcbID = rs.getLong("orgcbId");
final String alias = rs.getString("alias");
final String credit_bureau_name = rs.getString("creditbureau");
final String loan_product_name = rs.getString("loan_product_name");
final Long lpId = rs.getLong("lpId");
final boolean is_creditcheck_mandatory = rs.getBoolean("crCheck");
final boolean skip_credit_check_in_failure = rs.getBoolean("skipcheck");
final int stale_period = rs.getInt("staleperiod");
final boolean is_active = rs.getBoolean("is_active");
return CreditBureauLoanProductMappingData.instance(mapping_id, orgcbID, alias, credit_bureau_name, loan_product_name,
lpId, is_creditcheck_mandatory, skip_credit_check_in_failure, stale_period, is_active);
}
}
private static final class LoanProductMapper implements RowMapper<CreditBureauLoanProductMappingData> {
public String schema() {
return "lp.name as loan_product_name,lp.id as loanid from m_product_loan lp";
}
@Override
public CreditBureauLoanProductMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
final Long loanid = rs.getLong("loanid");
final String loan_product_name = rs.getString("loan_product_name");
return CreditBureauLoanProductMappingData.instance1(loan_product_name, loanid);
}
}
@Override
public Collection<CreditBureauLoanProductMappingData> readCreditBureauLoanProductMapping() {
this.context.authenticatedUser();
final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
final String sql = "select " + rm.schema() + " order by cblp.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
}
@Override
public CreditBureauLoanProductMappingData readMappingByLoanId(long loanProductId) {
this.context.authenticatedUser();
final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
final String sql = "select " + rm.schema() + " and cblp.loan_product_id=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
}
@Override
public Collection<CreditBureauLoanProductMappingData> fetchLoanProducts() {
this.context.authenticatedUser();
final LoanProductMapper rm = new LoanProductMapper();
final String sql = "select " + rm.schema() + " order by lp.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
}
}
@@ -0,0 +1,30 @@
/**
* 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.infrastructure.creditbureau.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
public interface CreditBureauLoanProductMappingWritePlatformService {
CommandProcessingResult addCreditBureauLoanProductMapping(Long creditBureauId, JsonCommand command);
CommandProcessingResult updateCreditBureauLoanProductMapping(JsonCommand command);
}
@@ -0,0 +1,96 @@
/**
* 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.infrastructure.creditbureau.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauLoanProductMapping;
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauLoanProductMappingRepository;
import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureau;
import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureauRepository;
import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauLoanProductCommandFromApiJsonDeserializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements CreditBureauLoanProductMappingWritePlatformService {
private final PlatformSecurityContext context;
private final CreditBureauLoanProductMappingRepository creditBureauLoanProductMappingRepository;
private final OrganisationCreditBureauRepository organisationCreditBureauRepository;
private final LoanProductRepository loanProductRepository;
private final CreditBureauLoanProductCommandFromApiJsonDeserializer fromApiJsonDeserializer;
@Autowired
public CreditBureauLoanProductMappingWritePlatformServiceImpl(final PlatformSecurityContext context,
final CreditBureauLoanProductMappingRepository creditbureauLoanProductMappingRepository,
final OrganisationCreditBureauRepository organisationCreditBureauRepository, LoanProductRepository loanProductRepository,
final CreditBureauLoanProductCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
this.context = context;
this.creditBureauLoanProductMappingRepository = creditbureauLoanProductMappingRepository;
this.organisationCreditBureauRepository = organisationCreditBureauRepository;
this.loanProductRepository = loanProductRepository;
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
}
@Transactional
@Override
public CommandProcessingResult addCreditBureauLoanProductMapping(Long creditBureau_id, JsonCommand command) {
this.context.authenticatedUser();
System.out.println("mapping called for creditBureau_id "+creditBureau_id);
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureau_id);
final long lpid = command.longValueOfParameterNamed("loan_product_id");
final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getOne(creditBureau_id);
final LoanProduct lp = this.loanProductRepository.getOne(lpid);
final CreditBureauLoanProductMapping cb_lp = CreditBureauLoanProductMapping.fromJson(command, orgcb, lp);
this.creditBureauLoanProductMappingRepository.save(cb_lp);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cb_lp.getId())
.build();
}
@Override
public CommandProcessingResult updateCreditBureauLoanProductMapping(JsonCommand command) {
final Long mappingid = command.longValueOfParameterNamed("creditbureauLoanProductMappingId");
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getOne(mappingid);
cblpmapping.setIs_active(is_active);
this.creditBureauLoanProductMappingRepository.saveAndFlush(cblpmapping);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cblpmapping.getId())
.build();
}
}
@@ -0,0 +1,31 @@
/**
* 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.infrastructure.creditbureau.service;
import java.util.Collection;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauMasterData;
public interface CreditBureauMasterReadPlatformService {
Collection<CreditBureauMasterData> retrieveCreditBureauByCountry(String country);
Collection<CreditBureauMasterData> retrieveCreditBureauByCountry();
}
@@ -0,0 +1,33 @@
/**
* 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.infrastructure.creditbureau.service;
import java.util.Collection;
import java.util.Map;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurationData;
public interface CreditBureauReadConfigurationService {
Collection<CreditBureauConfigurationData> readConfigurationByOrganisationCreditBureauId(long id);
Map<String, String> retrieveConfigMap(long id);
}
@@ -0,0 +1,102 @@
/**
* 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.infrastructure.creditbureau.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurationData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
@Service
public class CreditBureauReadConfigurationServiceImpl implements CreditBureauReadConfigurationService {
private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
@Autowired
public CreditBureauReadConfigurationServiceImpl(final PlatformSecurityContext context,
final RoutingDataSource dataSource) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private static final class CbConfigMapper implements RowMapper<CreditBureauConfigurationData> {
public String schema() {
return "cbconfig.id as configId,cbconfig.configkey,cbconfig.value as configValue,"
+ "cbconfig.organisation_creditbureau_id as orgCBId,cbconfig.description as description from m_creditbureau_configuration cbconfig ";
}
@Override
public CreditBureauConfigurationData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
final long configId = rs.getLong("configId");
final String configkey = rs.getString("configkey");
final String configValue = rs.getString("configValue");
final long orgCBId = rs.getLong("orgCBId");
final String desc = rs.getString("description");
return CreditBureauConfigurationData.instance(configId, configkey, configValue, orgCBId, desc);
}
}
@Override
public Collection<CreditBureauConfigurationData> readConfigurationByOrganisationCreditBureauId(long id) {
this.context.authenticatedUser();
final CbConfigMapper rm = new CbConfigMapper();
final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { id });
}
@Override
public Map<String, String> retrieveConfigMap(long id) {
this.context.authenticatedUser();
final CbConfigMapper rm = new CbConfigMapper();
final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id=" + id;
List<CreditBureauConfigurationData> config = (List<CreditBureauConfigurationData>) this.jdbcTemplate.query(sql,
rm, new Object[] {});
Map<String, String> configuration = new HashMap<String, String>();
for (CreditBureauConfigurationData data : config) {
configuration.put(data.getConfigurationKey(), data.getValue());
}
return configuration;
}
}
@@ -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.infrastructure.creditbureau.service;
import java.util.Collection;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
public interface CreditBureauReadPlatformService {
Collection<CreditBureauData> retrieveCreditBureau();
}
@@ -0,0 +1,77 @@
/**
* 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.infrastructure.creditbureau.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
@Service
public class CreditBureauReadPlatformServiceImpl implements CreditBureauReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
@Autowired
public CreditBureauReadPlatformServiceImpl(final PlatformSecurityContext context,
final RoutingDataSource dataSource) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private static final class CBMapper implements RowMapper<CreditBureauData> {
public String schema() {
return "cb.id as creditBureauID,cb.name as creditBureauName,cb.product as creditBureauProduct,"
+ "cb.country as country,concat(cb.product,' - ',cb.name,' - ',cb.country) as cbSummary,cb.implementationKey as implementationKey from m_creditbureau cb";
}
@Override
public CreditBureauData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
final long id = rs.getLong("creditBureauID");
final String name = rs.getString("creditBureauName");
final String product = rs.getString("creditBureauProduct");
final String country = rs.getString("country");
final String cbSummary = rs.getString("cbSummary");
final long implementationKey = rs.getLong("implementationKey");
return CreditBureauData.instance(id, name, product, country, cbSummary, implementationKey);
}
}
@Override
public Collection<CreditBureauData> retrieveCreditBureau() {
this.context.authenticatedUser();
final CBMapper rm = new CBMapper();
final String sql = "select " + rm.schema() + " order by id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
}
}
@@ -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.infrastructure.creditbureau.service;
import java.util.Collection;
import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
public interface OrganisationCreditBureauReadPlatformService {
Collection<OrganisationCreditBureauData> retrieveOrgCreditBureau();
OrganisationCreditBureauData retrieveOrgCreditBureauById(long orgCbId);
}
@@ -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.infrastructure.creditbureau.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
@Service
public class OrganisationCreditBureauReadPlatformServiceImpl implements OrganisationCreditBureauReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
@Autowired
public OrganisationCreditBureauReadPlatformServiceImpl(final PlatformSecurityContext context,
final RoutingDataSource dataSource) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
private static final class OrganisationCreditBureauMapper implements RowMapper<OrganisationCreditBureauData> {
public String schema() {
return "ocb.id as orgCbId,ocb.alias as orgCbAlias,cb.name as creditbureauName,cb.product as creditbureauProduct,cb.country as creditbureauCountry,"
+ "concat(cb.product,' - ',cb.name,' - ',cb.country) as CreditBureauSummary,"
+ "ocb.creditbureau_id as cbid,ocb.is_active as is_active"
+ " from m_organisation_creditbureau ocb,m_creditbureau cb where ocb.creditbureau_id=cb.id";
}
@Override
public OrganisationCreditBureauData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
final long orgCbId = rs.getLong("orgCbId");
final String orgCbAlias = rs.getString("orgCbAlias");
final String creditbureauName = rs.getString("creditbureauName");
final String creditbureauProduct = rs.getString("creditbureauProduct");
final String creditbureauCountry = rs.getString("creditbureauCountry");
final String CreditBureauSummary = rs.getString("CreditBureauSummary");
final long cbid = rs.getLong("cbid");
final boolean is_active = rs.getBoolean("is_active");
return OrganisationCreditBureauData.instance(orgCbId, orgCbAlias, cbid, creditbureauName,
creditbureauProduct, creditbureauCountry, CreditBureauSummary, is_active);
}
}
@Override
public Collection<OrganisationCreditBureauData> retrieveOrgCreditBureau() {
this.context.authenticatedUser();
final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
final String sql = "select " + rm.schema() + " order by ocb.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
}
@Override
public OrganisationCreditBureauData retrieveOrgCreditBureauById(long orgCbId) {
this.context.authenticatedUser();
final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
final String sql = "select " + rm.schema() + " and ocb.id=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { orgCbId });
}
}
@@ -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.infrastructure.creditbureau.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
public interface OrganisationCreditBureauWritePlatflormService {
CommandProcessingResult addOrganisationCreditBureau(Long ocb_id, JsonCommand command);
CommandProcessingResult updateCreditBureau(JsonCommand command);
}
@@ -0,0 +1,94 @@
/**
* 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.infrastructure.creditbureau.service;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureau;
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauRepository;
import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureau;
import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureauRepository;
import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauCommandFromApiJsonDeserializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class OrganisationCreditBureauWritePlatflormServiceImpl
implements OrganisationCreditBureauWritePlatflormService {
private final PlatformSecurityContext context;
private final OrganisationCreditBureauRepository organisationCreditBureauRepository;
private final CreditBureauRepository creditBureauRepository;
private final CreditBureauCommandFromApiJsonDeserializer fromApiJsonDeserializer;
@Autowired
public OrganisationCreditBureauWritePlatflormServiceImpl(final PlatformSecurityContext context,
final OrganisationCreditBureauRepository organisationCreditBureauRepository, final CreditBureauRepository creditBureauRepository,
final CreditBureauCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
this.context = context;
this.organisationCreditBureauRepository = organisationCreditBureauRepository;
this.creditBureauRepository = creditBureauRepository;
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
}
@Override
public CommandProcessingResult addOrganisationCreditBureau(Long creditBureauId, JsonCommand command) {
this.context.authenticatedUser();
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
final CreditBureau creditBureau = this.creditBureauRepository.getOne(creditBureauId);
final OrganisationCreditBureau organisationCreditBureau = OrganisationCreditBureau.fromJson(command, creditBureau);
this.organisationCreditBureauRepository.save(organisationCreditBureau);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(organisationCreditBureau.getId())
.build();
}
@Transactional
@Override
public CommandProcessingResult updateCreditBureau(JsonCommand command) {
// this.context.authenticatedUser();
// this.fromApiJsonDeserializer.validateForCreate(command.json());
final long creditbureauID = command.longValueOfParameterNamed("creditBureauId");
//System.out.println("creditbureauID is " + creditbureauID);
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getOne(creditbureauID);
orgcb.setIsActive(is_active);
organisationCreditBureauRepository.saveAndFlush(orgcb);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(orgcb.getId())
.build();
}
}
@@ -862,7 +862,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final String apptableName = this.fromJsonHelper.extractStringNamed("apptableName", element);
validateDatatableName(datatableName);
int rowCount = getRowCount(datatableName);
final List<ResultsetColumnHeaderData> columnHeaderData = this.genericDataService.fillResultsetColumnHeaders(datatableName);
final Map<String, ResultsetColumnHeaderData> mapColumnNameDefinition = new HashMap<>();
for (final ResultsetColumnHeaderData columnHeader : columnHeaderData) {
@@ -908,7 +908,10 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
if (changeColumns == null && addColumns == null && dropColumns == null) { return; }
if (dropColumns != null) {
if(rowCount>0){
throw new GeneralPlatformDomainRuleException("error.msg.non.empty.datatable.column.cannot.be.deleted",
"Non-empty datatable columns can not be deleted.");
}
StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`");
final StringBuilder constrainBuilder = new StringBuilder();
final List<String> codeMappings = new ArrayList<>();
@@ -931,7 +934,12 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final StringBuilder constrainBuilder = new StringBuilder();
final Map<String, Long> codeMappings = new HashMap<>();
for (final JsonElement column : addColumns) {
parseDatatableColumnForAdd(column.getAsJsonObject(), sqlBuilder, datatableName.toLowerCase().replaceAll("\\s", "_"),
JsonObject columnAsJson = column.getAsJsonObject();
if(rowCount>0 && columnAsJson.has("mandatory") && columnAsJson.get("mandatory").getAsBoolean()){
throw new GeneralPlatformDomainRuleException("error.msg.non.empty.datatable.mandatory.column.cannot.be.added",
"Non empty datatable mandatory columns can not be added.");
}
parseDatatableColumnForAdd(columnAsJson, sqlBuilder, datatableName.toLowerCase().replaceAll("\\s", "_"),
constrainBuilder, codeMappings, isConstraintApproach);
}
@@ -1050,11 +1058,15 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
}
private void assertDataTableEmpty(final String datatableName) {
final String sql = "select count(*) from `" + datatableName + "`";
final int rowCount = this.jdbcTemplate.queryForObject(sql, Integer.class);
final int rowCount = getRowCount(datatableName);
if (rowCount != 0) { throw new GeneralPlatformDomainRuleException("error.msg.non.empty.datatable.cannot.be.deleted",
"Non-empty datatable cannot be deleted."); }
}
private int getRowCount(final String datatableName){
final String sql = "select count(*) from `" + datatableName + "`";
return this.jdbcTemplate.queryForObject(sql, Integer.class);
}
@Transactional
@Override
@@ -121,7 +121,7 @@ public class ContentRepositoryUtils {
/**
* Extracts Image from a Data URL
*
* @param mimeType
* @param dataURL mimeType
*/
public static Base64EncodedImage extractImageFromDataURL(final String dataURL) {
String fileExtension = "";
@@ -322,7 +322,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
* update the stretchy report entity associated with the credit check
*
* @param stretchyReport -- Report entity
* @return None
*
**/
public void update(final Report stretchyReport) {
if (stretchyReport != null) {
@@ -333,7 +333,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
/**
* delete the report mailing job, set the isDeleted property to 1 and alter the name
*
* @return None
*
**/
public void delete() {
this.isDeleted = true;
@@ -491,7 +491,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
/**
* increase the numberOfRuns by 1
*
* @return None
*
**/
public void increaseNumberOfRunsByOne() {
this.numberOfRuns++;
@@ -501,7 +501,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
* update the previousRunStatus
*
* @param previousRunStatus -- the status of the previous job execution
* @return None
*
**/
public void updatePreviousRunStatus(final String previousRunStatus) {
if (!StringUtils.isEmpty(previousRunStatus)) {
@@ -513,7 +513,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
* update the previousRunDateTime
*
* @param previousRunDateTime -- previous run date
* @return None
*
**/
public void updatePreviousRunDateTime(final DateTime previousRunDateTime) {
if (previousRunDateTime != null) {
@@ -525,7 +525,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
* update the nextRunDateTime
*
* @param nextRunDateTime -- the next run DateTime
* @return None
*
**/
public void updateNextRunDateTime(final DateTime nextRunDateTime) {
if (nextRunDateTime != null) {
@@ -540,7 +540,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
/**
* deactivate the report mailing job by setting the isActive property to 0
*
* @return None
*
**/
public void deactivate() {
this.isActive = false;
@@ -550,7 +550,7 @@ public class ReportMailingJob extends AbstractAuditableCustom<AppUser, Long> {
* update the previousRunErrorLog property
*
* @param previousRunErrorLog -- the previous job run error log
* @return None
*
**/
public void updatePreviousRunErrorLog(final String previousRunErrorLog) {
this.previousRunErrorLog = previousRunErrorLog;
@@ -301,7 +301,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
* @param reportMailingJob -- the report mailing job entity
* @param errorLog -- StringBuilder object containing the error log if any
* @param jobStartDateTime -- the start DateTime of the job
* @return None
*
**/
private void updateReportMailingJobAfterJobExecution(final ReportMailingJob reportMailingJob, final StringBuilder errorLog,
final DateTime jobStartDateTime) {
@@ -374,7 +374,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
* @param errorLog -- StringBuilder object containing the error log if any
* @param jobStartDateTime -- the start DateTime of the job
* @param jobRunStatus -- the status of the job (success/error)
* @return None
*
**/
private void createReportMailingJobRunHistroryAfterJobExecution(final ReportMailingJob reportMailingJob, final StringBuilder errorLog,
final DateTime jobStartDateTime, final String jobRunStatus) {
@@ -391,7 +391,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
*
* @param jsonCommand -- JsonCommand object
* @param dve -- data integrity exception object
* @return None
*
**/
private void handleDataIntegrityIssues(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause();
@@ -63,7 +63,7 @@ public class ReportMailingJobValidator {
* validate the request to create a new report mailing job
*
* @param jsonCommand -- the JSON command object (instance of the JsonCommand class)
* @return None
*
**/
public void validateCreateRequest(final JsonCommand jsonCommand) {
final String jsonString = jsonCommand.json();
@@ -142,7 +142,7 @@ public class ReportMailingJobValidator {
* validate the request to update a report mailing job
*
* @param jsonCommand -- the JSON command object (instance of the JsonCommand class)
* @return None
*
**/
public void validateUpdateRequest(final JsonCommand jsonCommand) {
final String jsonString = jsonCommand.json();
@@ -309,7 +309,7 @@ public class ReportMailingJobValidator {
* throw a PlatformApiDataValidationException exception if there are validation errors
*
* @param dataValidationErrors -- list of ApiParameterError objects
* @return None
*
**/
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
if (!dataValidationErrors.isEmpty()) {
@@ -22,7 +22,7 @@ package org.apache.fineract.infrastructure.security.exception;
* {@link RuntimeException} thrown when an invalid tenant identifier is used in
* request to platform.
*
* @see CustomRequestHeaderAuthenticationFilter
*
*/
public class InvalidTenantIdentiferException extends RuntimeException {
@@ -30,7 +30,7 @@ public class SmsMessageApiResponseData {
/**
* SmsMessageApiResponseData constructor
*
* @return void
*
**/
private SmsMessageApiResponseData(Integer httpStatusCode, List<SmsMessageDeliveryReportData> data) {
this.httpStatusCode = httpStatusCode;
@@ -40,7 +40,7 @@ public class SmsMessageApiResponseData {
/**
* Default SmsMessageApiResponseData constructor
*
* @return void
*
**/
protected SmsMessageApiResponseData() {}
@@ -33,7 +33,7 @@ public class SmsMessageDeliveryReportData {
/**
* SmsMessageDeliveryReportData constructor
*
* @return void
*
**/
private SmsMessageDeliveryReportData(Long id, String externalId, String addedOnDate, String deliveredOnDate,
Integer deliveryStatus, Boolean hasError, String errorMessage) {
@@ -49,7 +49,7 @@ public class SmsMessageDeliveryReportData {
/**
* Default SmsMessageDeliveryReportData constructor
*
* @return void
*
**/
protected SmsMessageDeliveryReportData() {}
@@ -34,7 +34,7 @@ import org.joda.time.LocalDate;
* information, teller, and more.
*
* @author Markus Geiss
<<<<<<< HEAD
* @since 2.0.0
* @see org.apache.fineract.organisation.teller.domain.Cashier
* @since 2.0.0
@@ -86,24 +86,27 @@ public final class CashierData implements Serializable {
/**
* Creates a new cashier.
* <p/>
*
* <p>The valid from/to dates may be used to define a time period in which
* the cashier is assignable to a teller.</p>
* <p/>
*
* <p>The start/end times may be used to define a time period in which
* the cashier works part time.</p>
*
* @param id the primary key of this cashier
* @param officeId the primary key of the related office
* @param staffId the primary key of the related staff
* @param tellerId the primary key of the related teller
* @param id the primary key of this cashier
* @param officeId the primary key of the related office
* @param officeName the primary key of the related staff
* @param staffId the primary key of the related teller
* @param staffName
* @param tellerId the primary key of the related teller
* @param tellerName
* @param description the description of this cashier
* @param validFrom the valid from date of this cashier
* @param validTo the valid to date of this cashier
* @param partTime the part time flag of this cashier
* @param startTime the start time of this cashier
* @param endTime the end time of this cashier
* @return the cashier
* @param startDate the valid from date of this cashier
* @param endDate the valid to date of this cashier
* @param isFullDay the part time flag of this cashier
* @param startTime the start time of this cashier
* @param endTime the end time of this cashier
* @return
*/
public static CashierData instance(final Long id, final Long officeId, String officeName,
final Long staffId, final String staffName, final Long tellerId, final String tellerName,
@@ -169,7 +172,7 @@ public final class CashierData implements Serializable {
/**
* Returns the valid from date of this cashier.
* <p/>
*
* <p>The valid from/to dates may be used to define a time period in which
* the cashier is assignable to a teller.</p>
*
@@ -181,7 +184,7 @@ public final class CashierData implements Serializable {
/**
* Returns the valid to date of this cashier.
* <p/>
*
* <p>The valid from/to dates may be used to define a time period in which
* the cashier is assignable to a teller.</p>
*
@@ -202,7 +205,7 @@ public final class CashierData implements Serializable {
/**
* Returns the start time of this cashier.
* <p/>
*
* <p>The start/end times may be used to define a time period in which
* the cashier works part time.</p>
*
@@ -214,7 +217,7 @@ public final class CashierData implements Serializable {
/**
* Returns the end time of this cashier.
* <p/>
*
* <p>The start/end times may be used to define a time period in which
* the cashier works part time.</p>
*
@@ -32,7 +32,7 @@ import java.util.Date;
* {@code TellerData} represents an immutable data object for teller data.
*
* @version 1.0
<<<<<<< HEAD
* @since 2.0.0
* @see java.io.Serializable
* @since 2.0.0
@@ -25,7 +25,7 @@ import java.util.Date;
* {@code TellerJournalData} represents an immutable journal data object.
*
* @version 1.0.0
<<<<<<< HEAD
* @since 2.0.0
* @see java.io.Serializable
* @since 2.0.0
@@ -27,7 +27,7 @@ import java.util.Date;
* {@code TellerTransactionData} represents an immutable data object for a transction.
*
* @version 1.0.0
<<<<<<< HEAD
* @since 2.0.0
* @see java.io.Serializable
* @since 2.0.0
@@ -324,7 +324,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Returns the valid from date of this cashier.
* <p/>
*
* <p>
* The valid from/to dates may be used to define a time period in which the
* cashier is assignable to a teller.
@@ -346,13 +346,13 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Sets the valid from date of this cashier.
* <p/>
*
* <p>
* The valid from/to dates may be used to define a time period in which the
* cashier is assignable to a teller.
* </p>
*
* @param validFrom
* @param startDate validFrom
* the valid from date of this cashier
*/
public void setStartDate(Date startDate) {
@@ -361,7 +361,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Returns the valid to date of this cashier.
* <p/>
*
* <p>
* The valid from/to dates may be used to define a time period in which the
* cashier is assignable to a teller.
@@ -383,13 +383,13 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Sets the valid to date of this cashier.
* <p/>
*
* <p>
* The valid from/to dates may be used to define a time period in which the
* cashier is assignable to a teller.
* </p>
*
* @param validTo
* @param endDate validTo
* the valid to date of this cashier
*/
public void setEndDate(Date endDate) {
@@ -409,7 +409,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Sets the part time flag of this cashier.
*
* @param partTime
* @param isFullDay partTime
* the part time flag of this cashier
*/
public void setFullDay(Boolean isFullDay) {
@@ -418,7 +418,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Returns the start time of this cashier.
* <p/>
*
* <p>
* The start/end times may be used to define a time period in which the
* cashier works part time.
@@ -432,7 +432,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Set the start time of this cashier.
* <p/>
*
* <p>
* The start/end times may be used to define a time period in which the
* cashier works part time.
@@ -447,7 +447,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Returns the end time of this cashier.
* <p/>
*
* <p>
* The start/end times may be used to define a time period in which the
* cashier works part time.
@@ -461,7 +461,7 @@ public class Cashier extends AbstractPersistableCustom<Long> {
/**
* Sets the end time of this cashier.
* <p/>
*
* <p>
* The start/end times may be used to define a time period in which the
* cashier works part time.
@@ -213,7 +213,7 @@ public class CashierTransaction extends AbstractPersistableCustom<Long> {
/**
* Sets the transaction type of this cashier transaction.
*
* @param description the transaction type of this cashier transaction
* @param txnType description the transaction type of this cashier transaction
*/
public void setTxnType(Integer txnType) {
this.txnType = txnType;
@@ -239,7 +239,7 @@ public class CashierTransaction extends AbstractPersistableCustom<Long> {
/**
* Sets the transaction date of this cashier transaction.
*
* @param transaction date of this cashier transaction
* @param txnDate transaction date of this cashier transaction
*/
public void setTxnDate(Date txnDate) {
this.txnDate = txnDate;
@@ -107,8 +107,8 @@ public enum CalendarFrequencyType {
* To convert from period frequency type tp calendar frequency type. This
* method requires code refactoring.
*
* @param periodFrequencyType
* @return
* @param periodFrequencyType periodFrequencyType
* @return CalendarFrequencyType
*/
public static CalendarFrequencyType from(final PeriodFrequencyType periodFrequencyType) {
switch (periodFrequencyType) {
@@ -144,8 +144,8 @@ public class ClientTransaction extends AbstractPersistableCustom<Long> {
* Converts the content of this Client Transaction to a map which can be
* passed to the accounting module
*
* @param currencyData
* @return
*
*
*/
public Map<String, Object> toMapData() {
final Map<String, Object> thisTransactionData = new LinkedHashMap<>();
@@ -50,4 +50,5 @@ public class CollectionSheetConstants {
public static final String loanIdParamName = "loanId";
public static final String savingsIdParamName = "savingsId";
public static final String transactionAmountParamName = "transactionAmount";
public static final String depositAccountTypeParamName = "depositAccountType";
}
@@ -36,6 +36,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -138,7 +139,7 @@ public class CollectionSheetTransactionDataValidator {
final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
.transactionDateParamName, element);
baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
.notNull();
.notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
if (StringUtils.isNotBlank(note)) {
@@ -40,14 +40,16 @@ public class SavingsDueData {
private final CurrencyData currency;
@SuppressWarnings("unused")
private BigDecimal dueAmount = BigDecimal.ZERO;
@SuppressWarnings("unused")
private String depositAccountType;
public static SavingsDueData instance(final Long savingsId, final String accountId, final Integer accountStatusId,
final String productName, final Long productId, final CurrencyData currency, final BigDecimal dueAmount) {
return new SavingsDueData(savingsId, accountId, accountStatusId, productName, productId, currency, dueAmount);
final String productName, final Long productId, final CurrencyData currency, final BigDecimal dueAmount, final String depositAccountType) {
return new SavingsDueData(savingsId, accountId, accountStatusId, productName, productId, currency, dueAmount, depositAccountType);
}
private SavingsDueData(final Long savingsId, final String accountId, final Integer accountStatusId, final String productName,
final Long productId, final CurrencyData currency, final BigDecimal dueAmount) {
final Long productId, final CurrencyData currency, final BigDecimal dueAmount, final String depositAccountType) {
this.savingsId = savingsId;
this.accountId = accountId;
this.accountStatusId = accountStatusId;
@@ -55,6 +57,7 @@ public class SavingsDueData {
this.productId = productId;
this.currency = currency;
this.dueAmount = dueAmount;
this.depositAccountType = depositAccountType;
}
public String productName() {
@@ -64,5 +67,9 @@ public class SavingsDueData {
public Long productId() {
return this.productId;
}
public String getDepositAccountType() {
return depositAccountType;
}
}
@@ -235,7 +235,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
.append("if(ln.loan_status_id = 200 , ln.principal_amount , null) As disbursementAmount, ")
.append("sum(ifnull(if(ln.loan_status_id = 300, ls.principal_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.principal_completed_derived, 0.0), 0.0)) As principalDue, ")
.append("ln.principal_repaid_derived As principalPaid, ")
.append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0)) As interestDue, ")
.append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0) - IFNULL(IF(ln.loan_status_id = 300, ls.interest_waived_derived, 0.0), 0.0)) As interestDue, ")
.append("ln.interest_repaid_derived As interestPaid, ")
.append("sum(ifnull(if(ln.loan_status_id = 300, ls.fee_charges_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.fee_charges_completed_derived, 0.0), 0.0)) As feeDue, ")
.append("ln.fee_charges_repaid_derived As feePaid, ")
@@ -439,6 +439,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
for (SavingsDueData savingsDueData : savingsDatas) {
final SavingsProductData savingsProduct = SavingsProductData.lookup(savingsDueData.productId(),
savingsDueData.productName());
savingsProduct.setDepositAccountType(savingsDueData.getDepositAccountType());
if (!savingsProducts.contains(savingsProduct)) {
savingsProducts.add(savingsProduct);
}
@@ -515,6 +516,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
.append("sa.currency_multiplesof as inMultiplesOf, ")
.append("rc.`name` as currencyName, ")
.append("rc.display_symbol as currencyDisplaySymbol, ")
.append("if(sa.deposit_type_enum=100,'Saving Deposit',if(sa.deposit_type_enum=300,'Recurring Deposit','Current Deposit')) as depositAccountType, ")
.append("rc.internationalized_name_code as currencyNameCode, ")
.append("sum(ifnull(mss.deposit_amount,0) - ifnull(mss.deposit_amount_completed_derived,0)) as dueAmount ")
@@ -526,8 +528,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
.append("JOIN m_client cl ON cl.id = gc.client_id ")
.append("JOIN m_savings_account sa ON sa.client_id=cl.id and sa.status_enum=300 ")
.append("JOIN m_savings_product sp ON sa.product_id=sp.id ")
.append("JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id AND dard.is_mandatory = true AND dard.is_calendar_inherited = true ")
.append("JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id AND mss.duedate <= :dueDate ")
.append("LEFT JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id AND dard.is_mandatory = true AND dard.is_calendar_inherited = true ")
.append("LEFT JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id AND mss.duedate <= :dueDate ")
.append("LEFT JOIN m_currency rc on rc.`code` = sa.currency_code ");
if (isCenterCollection) {
@@ -655,25 +657,25 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
private SavingsDueDataMapper() {}
@Override
public SavingsDueData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
public SavingsDueData mapRow(ResultSet rs, int rowNum) throws SQLException {
final Long savingsId = rs.getLong("savingsId");
final String accountId = rs.getString("accountId");
final Integer accountStatusId = JdbcSupport.getInteger(rs, "accountStatusId");
final String productName = rs.getString("productShortName");
final Long productId = rs.getLong("productId");
final BigDecimal dueAmount = rs.getBigDecimal("dueAmount");
final String currencyCode = rs.getString("currencyCode");
final String currencyName = rs.getString("currencyName");
final String currencyNameCode = rs.getString("currencyNameCode");
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf");
final String depositAccountType = rs.getString("depositAccountType");
// currency
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMultiplesOf,
currencyDisplaySymbol, currencyNameCode);
return SavingsDueData.instance(savingsId, accountId, accountStatusId, productName, productId, currency, dueAmount);
return SavingsDueData.instance(savingsId, accountId, accountStatusId, productName, productId, currency, dueAmount, depositAccountType);
}
}
@@ -818,7 +820,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
public IndividualMandatorySavingsCollectionsheetExtractor(final boolean checkForOfficeId, final boolean checkforStaffId) {
final StringBuffer sb = new StringBuffer(400);
sb.append("SELECT cl.display_name As clientName, cl.id As clientId, ");
sb.append("SELECT if(sa.deposit_type_enum=100,'Saving Deposit',if(sa.deposit_type_enum=300,'Recurring Deposit','Current Deposit')) as depositAccountType, cl.display_name As clientName, cl.id As clientId, ");
sb.append("sa.id As savingsId, sa.account_no As accountId, sa.status_enum As accountStatusId, ");
sb.append("sp.short_name As productShortName, sp.id As productId, ");
sb.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMultiplesOf, ");
@@ -827,11 +829,11 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
sb.append("FROM m_savings_account sa ");
sb.append("JOIN m_client cl ON cl.id = sa.client_id ");
sb.append("JOIN m_savings_product sp ON sa.product_id=sp.id ");
sb.append("JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id AND dard.is_mandatory = true AND dard.is_calendar_inherited = false ");
sb.append("JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id AND mss.completed_derived = 0 AND mss.duedate <= :dueDate ");
sb.append("LEFT JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id AND dard.is_mandatory = true AND dard.is_calendar_inherited = false ");
sb.append("LEFT JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id AND mss.completed_derived = 0 AND mss.duedate <= :dueDate ");
sb.append("LEFT JOIN m_office of ON of.id = cl.office_id AND of.hierarchy like :officeHierarchy ");
sb.append("LEFT JOIN m_currency rc on rc.`code` = sa.currency_code ");
sb.append("WHERE sa.status_enum=300 and sa.group_id is null ");
sb.append("WHERE sa.status_enum=300 and sa.group_id is null and sa.deposit_type_enum in (100,300,400) ");
sb.append("and (cl.status_enum = 300 or (cl.status_enum = 600 and cl.closedon_date >= :dueDate)) ");
if (checkForOfficeId) {
sb.append("and of.id = :officeId ");
@@ -21,9 +21,10 @@ import java.util.ArrayList;
import java.util.List;
/**
* <ul>
*
* People typically use either of the following settings when calculating there
* interest using the daily method:
* <ul>
* <li>Actual or</li>
* <li>30</li>
* </ul>
@@ -22,9 +22,10 @@ import java.util.ArrayList;
import java.util.List;
/**
* <ul>
*
* People typically use either of the following settings when calculating there
* interest using the daily method:
* <ul>
* <li>Actual or</li>
* <li>360 or</li>
* <li>364 or</li>
@@ -564,9 +564,6 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
LocalDate localDate = new LocalDate(meetingDate);
final CenterCalendarDataMapper centerCalendarMapper = new CenterCalendarDataMapper();
String passeddate = formatter.print(localDate);
if (!isCentersHavingMeetingFrequencyBasedOnOfficeIdAndMeetingDate(officeId, passeddate, staffId)) { throw new GeneralPlatformDomainRuleException(
"error.msg.collection.sheet.can.not.be.selected.meeting.date.not.attached.to.any.center",
"Collection sheet can not be generated without meeting date " + passeddate + " attached to any center ", passeddate); }
String sql = centerCalendarMapper.schema();
Collection<CenterData> centerDataArray = null;
if (staffId != null) {
@@ -617,27 +614,6 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
return staffCenterDataArray;
}
@SuppressWarnings("deprecation")
private boolean isCentersHavingMeetingFrequencyBasedOnOfficeIdAndMeetingDate(final Long officeId, final String passeddate,
final Long staffId) {
final StringBuilder sb = new StringBuilder(100);
sb.append("SELECT COUNT(*) ");
sb.append("FROM m_calendar c ");
sb.append("JOIN m_calendar_instance ci ON ci.calendar_id=c.id AND ci.entity_type_enum=4 ");
sb.append("JOIN m_group ce ON ce.id = ci.entity_id ");
sb.append("JOIN m_group g ON g.parent_id = ce.id ");
sb.append("WHERE c.start_date = ? AND g.office_id= ? ");
int i = 0;
if (staffId != null) {
sb.append(" AND g.staff_id = ? ");
i = this.jdbcTemplate.queryForInt(sb.toString(), new Object[] { passeddate, officeId, staffId });
} else {
i = this.jdbcTemplate.queryForInt(sb.toString(), new Object[] { passeddate, officeId });
}
if (i > 0) { return true; }
return false;
}
public void validateForGenerateCollectionSheet(final Long staffId) {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -320,11 +320,14 @@ public class LoansApiResource {
Map<Long, Integer> memberLoanCycle = new HashMap<>();
Collection<ClientData> members = loanAccountGroupData.groupData().clientMembers();
accountLinkingOptions = new ArrayList<>();
for (ClientData clientData : members) {
Integer loanCounter = this.loanReadPlatformService.retriveLoanCounter(clientData.id(), productId);
memberLoanCycle.put(clientData.id(), loanCounter);
accountLinkingOptions.addAll(getaccountLinkingOptions(newLoanAccount, clientData.id(), groupId));
if(members != null){
for (ClientData clientData : members) {
Integer loanCounter = this.loanReadPlatformService.retriveLoanCounter(clientData.id(), productId);
memberLoanCycle.put(clientData.id(), loanCounter);
accountLinkingOptions.addAll(getaccountLinkingOptions(newLoanAccount, clientData.id(), groupId));
}
}
newLoanAccount = LoanAccountData.associateMemberVariations(newLoanAccount, memberLoanCycle);
}
@@ -5585,14 +5585,17 @@ public class Loan extends AbstractPersistableCustom<Long> {
}
/**
* @param applicationCurrency
* @param restCalendarInstance
* TODO
* @param compoundingCalendarInstance
* TODO
* @param loanCalendar
* @param floatingRateDTO
* TODO
* @param isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled
* @param loanCalendarInstance
* @param isSkipRepaymentonmonthFirst
* @param numberofdays
* @param holidayDetailDTO
* Used for accessing the loan's calendar object
* @return application terms of the Loan object
**/
@@ -741,10 +741,14 @@ public class LoanCharge extends AbstractPersistableCustom<Long> {
}
/**
* @param incrementBy
*
* @param installmentNumber
*
* @param feeAmount
* TODO
* @param processAmount
* Amount used to pay off this charge
*
*
* @return Actual amount paid on this charge
*/
public Money updatePaidAmountBy(final Money incrementBy, final Integer installmentNumber, final Money feeAmount) {
@@ -32,7 +32,7 @@ import org.apache.fineract.organisation.monetary.domain.Money;
* Encapsulates all the summary details of a {@link Loan}.
*
* {@link LoanSummary} fields are updated through a scheduled job. see -
* {@link UpdateLoanSummariesScheduledJob}.
*
*/
@Embeddable
public final class LoanSummary {
@@ -386,6 +386,11 @@ public class LoanTransaction extends AbstractPersistableCustom<Long> {
*
* This accumulates the values passed to the already existent values for
* each of the portions.
*
* @param principal principal
* @param interest interest
* @param feeCharges feeCharges
* @param penaltyCharges penaltyCharges
*/
public void updateComponents(final Money principal, final Money interest, final Money feeCharges, final Money penaltyCharges) {
final MonetaryCurrency currency = principal.getCurrency();
@@ -39,7 +39,7 @@ import org.joda.time.LocalDate;
* <li>Equal principal payments</li>
* <li>Equal installment payments</li>
* </ol>
* </p>
* <p></p>
*
* <p>
* When amortized using <i>equal principal payments</i>, the <b>principal
@@ -81,7 +81,7 @@ public class LoanRescheduleRequestDataValidator {
*
* @param jsonCommand
* the JSON command object (instance of the JsonCommand class)
* @return void
*
**/
public void validateForCreateAction(final JsonCommand jsonCommand, final Loan loan) {
@@ -214,7 +214,7 @@ public class LoanRescheduleRequestDataValidator {
*
* @param jsonCommand
* the JSON command object (instance of the JsonCommand class)
* @return void
*
**/
public void validateForApproveAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) {
final String jsonString = jsonCommand.json();
@@ -283,7 +283,7 @@ public class LoanRescheduleRequestDataValidator {
*
* @param jsonCommand
* the JSON command object (instance of the JsonCommand class)
* @return void
*
**/
public void validateForRejectAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) {
final String jsonString = jsonCommand.json();
@@ -267,7 +267,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom<Long> {
*
* @param approvedByUser the user who approved the request
* @param approvedOnDate the date of the approval
* @return void
*
**/
public void approve(final AppUser approvedByUser, final LocalDate approvedOnDate) {
@@ -284,7 +284,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom<Long> {
*
* @param approvedByUser the user who approved the request
* @param approvedOnDate the date of the approval
* @return void
*
**/
public void reject(final AppUser approvedByUser, final LocalDate approvedOnDate) {
@@ -29,7 +29,7 @@ public class LoanRescheduleRequestNotFoundException extends AbstractPlatformReso
* LoanRescheduleRequestNotFoundException constructor
*
* @param requestId the loan reschedule request identifier
* @return void
*
**/
public LoanRescheduleRequestNotFoundException(final Long requestId) {
super("error.msg.loan.reschedule.request.id.invalid",
@@ -118,7 +118,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
/**
* LoanRescheduleRequestWritePlatformServiceImpl constructor
*
* @return void
*
**/
@Autowired
public LoanRescheduleRequestWritePlatformServiceImpl(final CodeValueRepositoryWrapper codeValueRepositoryWrapper,
@@ -585,7 +585,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
*
* @param dve
* data integrity violation exception
* @return void
*
**/
private void handleDataIntegrityViolation(final DataIntegrityViolationException dve) {
@@ -130,4 +130,6 @@ public interface LoanReadPlatformService {
Collection<Long> retrieveLoanIdsWithPendingIncomePostingTransactions();
LoanTransactionData retrieveLoanForeclosureTemplate(final Long loanId, final LocalDate transactionDate);
LoanAccountData retrieveLoanByLoanAccount(String loanAccountNumber);
}
@@ -219,6 +219,22 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
throw new LoanNotFoundException(loanId);
}
}
@Override
public LoanAccountData retrieveLoanByLoanAccount(String loanAccountNumber)
{
//final AppUser currentUser = this.context.authenticatedUser();
this.context.authenticatedUser();
final LoanMapper rm = new LoanMapper();
String sql="select "+rm.loanSchema()+" where l.account_no=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanAccountNumber });
}
@Override
public LoanScheduleData retrieveRepaymentSchedule(final Long loanId,
@@ -237,6 +253,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
throw new LoanNotFoundException(loanId);
}
}
@Override
public Collection<LoanTransactionData> retrieveLoanTransactions(final Long loanId) {
@@ -449,7 +449,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
*
* @param loan
* the disbursed loan
* @return void
*
**/
private void createStandingInstruction(Loan loan) {
@@ -2318,7 +2318,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(overdueInstallment.toString());
final JsonCommand command = JsonCommand.from(overdueInstallment.toString(), parsedCommand, this.fromApiJsonHelper, null, null,
null, null, null, loanId, null, null, null, null);
null, null, null, loanId, null, null, null, null,null,null);
LoanOverdueDTO overdueDTO = applyChargeToOverdueLoanInstallment(loanId, overdueInstallment.getChargeId(),
overdueInstallment.getPeriodNumber(), command, loan, existingTransactionIds, existingReversedTransactionIds);
loan = overdueDTO.getLoan();
@@ -22,9 +22,10 @@ import java.util.HashMap;
import java.util.Map;
/***
* <ul>
*
* People typically use either of the following settings when defining interest
* recalculation method:
* <ul>
* <li>NONE</li>
* <li>INTEREST</li>
* <li>FEE</li>
@@ -22,9 +22,10 @@ import java.util.HashMap;
import java.util.Map;
/***
* <ul>
*
* People typically use either of the following settings when defining interest
* recalculation method:
* <ul>
* <li>SAME_AS_REPAYMENT_PERIOD</li>
* <li>DAILY</li>
* <li>WEEKLY</li>

Some files were not shown because too many files have changed in this diff Show More