update api-docs around client and client account summary.
This commit is contained in:
+50
-66
@@ -513,7 +513,7 @@ var jqxhr = $.ajax({
|
||||
"firstname" : "Patrick",
|
||||
"lastname" : "Asare-Frimpong",
|
||||
"displayName" : "Patrick Asare-Frimpong",
|
||||
"externalId" : null,
|
||||
"externalId" : "123AB",
|
||||
"joinedDate" : [ 2012, 4, 18 ]
|
||||
}, {
|
||||
"officeId" : 5,
|
||||
@@ -522,7 +522,6 @@ var jqxhr = $.ajax({
|
||||
"firstname" : "firstMajmoua",
|
||||
"lastname" : "client",
|
||||
"displayName" : "firstMajmoua client",
|
||||
"externalId" : null,
|
||||
"joinedDate" : [ 2011, 12, 1 ]
|
||||
}... ]
|
||||
</code>
|
||||
@@ -589,7 +588,6 @@ var jqxhr = $.ajax({
|
||||
"firstname" : "Patrick",
|
||||
"lastname" : "O'Meara",
|
||||
"displayName" : "Patrick O'Meara",
|
||||
"externalId" : null,
|
||||
"joinedDate" : [ 2009, 1, 4 ]
|
||||
}
|
||||
</code>
|
||||
@@ -602,12 +600,11 @@ var jqxhr = $.ajax({
|
||||
<h4>Create a Client</h4>
|
||||
<p> <b>Note:</b> You can enter either:<br>
|
||||
firstname/lastname - for a person OR<br>
|
||||
clientOrBusinessName - for a business or organisation (or person known by one name).<br><br>
|
||||
If you use clientOrBusinessName, the value is placed in the lastname field when you retrieve clients.
|
||||
clientOrBusinessName - for a business or organisation (or person known by one name).<br>
|
||||
</p>
|
||||
<table class=matrixHeading>
|
||||
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
||||
<tr class=alt><td>firstname and lastname OR clientOrBusinessName<br>, joiningDate, officeId</td></tr>
|
||||
<tr class=alt><td>firstname and lastname OR clientOrBusinessName<br>, joinedDate, officeId</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
@@ -620,8 +617,9 @@ Request Body:
|
||||
"firstname": "Petra",
|
||||
"lastname": "Yton",
|
||||
"externalId": "786YYH7",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"joiningDate": "04 March 2009"
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"locale": "en",
|
||||
"joinedDate": "04 March 2009"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
@@ -639,7 +637,8 @@ Request Body:
|
||||
"clientOrBusinessName": "New Business to Create",
|
||||
"externalId": "one/78",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"joiningDate": "13 June 2006"
|
||||
"locale": "en",
|
||||
"joinedDate": "13 June 2006"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
@@ -663,7 +662,8 @@ Request Body:
|
||||
{
|
||||
"externalId": "786444UUUYYH7",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"joiningDate": "09 June 2006"
|
||||
"locale": "en",
|
||||
"joinedDate": "09 June 2006"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{ "resourceId": 23}</code>
|
||||
@@ -682,44 +682,48 @@ Request Body:
|
||||
<p>Example Requests: </p>
|
||||
<div class=apiClick>clients/1/loans</div>
|
||||
<br><br>
|
||||
<div class=apiClick>clients/1/loans?fields=openLoans,%20closedLoans,activeLoanCount</div>
|
||||
<div class=apiClick>clients/1/loans?fields=openLoans,closedLoans,activeLoanCount</div>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">GET https://Domain Name/api/v1/clients/{clientId}/loans</code>
|
||||
<code class="method-response">{
|
||||
"pendingApprovalLoans" : [ ],
|
||||
"awaitingDisbursalLoans" : [ {
|
||||
"id" : 17,
|
||||
"externalId" : null,
|
||||
"loanProductId" : 1,
|
||||
"loanProductName" : "Agricultural Loan",
|
||||
"loanStatusId" : 200,
|
||||
"pendingApproval" : false,
|
||||
"waitingForDisbursal" : true,
|
||||
"open" : false,
|
||||
"closed" : false,
|
||||
"lifeCycleStatusText" : "Approved",
|
||||
"lifeCycleStatusDate" : null
|
||||
} ],
|
||||
"openLoans" : [ ],
|
||||
"closedLoans" : [ {
|
||||
"id" : 1,
|
||||
"externalId" : null,
|
||||
"loanProductId" : 1,
|
||||
"loanProductName" : "Agricultural Loan",
|
||||
"loanStatusId" : 600,
|
||||
"pendingApproval" : false,
|
||||
"waitingForDisbursal" : false,
|
||||
"open" : false,
|
||||
"closed" : true,
|
||||
"lifeCycleStatusText" : "Closed",
|
||||
"lifeCycleStatusDate" : null
|
||||
} ],
|
||||
"anyLoanCount" : 2,
|
||||
"pendingApprovalLoanCount" : 0,
|
||||
"awaitingDisbursalLoanCount" : 1,
|
||||
"activeLoanCount" : 0,
|
||||
"closedLoanCount" : 1
|
||||
"anyLoanCount": 3,
|
||||
"activeLoanCount": 2,
|
||||
"openLoans": [
|
||||
{
|
||||
"id": 22,
|
||||
"productId": 1,
|
||||
"productName": "Agricultural Loan",
|
||||
"status": {
|
||||
"id": 300,
|
||||
"code": "loanStatusType.active",
|
||||
"value": "Active"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 44,
|
||||
"productId": 1,
|
||||
"productName": "Agricultural Loan",
|
||||
"status": {
|
||||
"id": 300,
|
||||
"code": "loanStatusType.active",
|
||||
"value": "Active"
|
||||
}
|
||||
}
|
||||
],
|
||||
"closedLoanCount": 1,
|
||||
"closedLoans": [
|
||||
{
|
||||
"id": 33,
|
||||
"productId": 1,
|
||||
"productName": "Agricultural Loan",
|
||||
"status": {
|
||||
"id": 601,
|
||||
"code": "loanStatusType.closed.written.off",
|
||||
"value": "Closed (written off)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
@@ -743,8 +747,6 @@ Request Body:
|
||||
<code class="method-response">[ {
|
||||
"id" : 20,
|
||||
"clientId" : 2,
|
||||
"loanId" : null,
|
||||
"loanTransactionId" : null,
|
||||
"noteType" : {
|
||||
"id" : 100,
|
||||
"code" : "noteType.client",
|
||||
@@ -760,8 +762,6 @@ Request Body:
|
||||
}, {
|
||||
"id" : 16,
|
||||
"clientId" : 2,
|
||||
"loanId" : null,
|
||||
"loanTransactionId" : null,
|
||||
"noteType" : {
|
||||
"id" : 100,
|
||||
"code" : "noteType.client",
|
||||
@@ -814,8 +814,6 @@ Request Body:
|
||||
<code class="method-response">{
|
||||
"id" : 20,
|
||||
"clientId" : 2,
|
||||
"loanId" : null,
|
||||
"loanTransactionId" : null,
|
||||
"noteType" : {
|
||||
"id" : 100,
|
||||
"code" : "noteType.client",
|
||||
@@ -1422,8 +1420,6 @@ Request Body:
|
||||
<code class="method-response">{
|
||||
"id" : 10,
|
||||
"date" : [ 2009, 1, 29 ],
|
||||
"principal" : null,
|
||||
"interest" : null,
|
||||
"total" : {
|
||||
"currencyCode" : "XOF",
|
||||
"digitsAfterDecimal" : 0,
|
||||
@@ -1435,8 +1431,6 @@ Request Body:
|
||||
"greaterThanZero" : true,
|
||||
"displaySymbolValue" : "300000 CFA"
|
||||
},
|
||||
"totalWaived" : null,
|
||||
"overpaid" : null,
|
||||
"transactionOffsetFromToday" : -1218
|
||||
}
|
||||
</code>
|
||||
@@ -1514,13 +1508,10 @@ Request Body:
|
||||
"name" : "Demo MFI Head Office",
|
||||
"externalId" : "1",
|
||||
"openingDate" : [ 2009, 1, 1 ],
|
||||
"hierarchy" : ".",
|
||||
"parentName" : null,
|
||||
"parentId" : null
|
||||
"hierarchy" : "."
|
||||
}, {
|
||||
"id" : 2,
|
||||
"name" : "B1",
|
||||
"externalId" : null,
|
||||
"openingDate" : [ 2012, 4, 1 ],
|
||||
"hierarchy" : ".2.",
|
||||
"parentName" : "Demo MFI Head Office",
|
||||
@@ -1528,7 +1519,6 @@ Request Body:
|
||||
}, {
|
||||
"id" : 3,
|
||||
"name" : "B2",
|
||||
"externalId" : null,
|
||||
"openingDate" : [ 2012, 4, 4 ],
|
||||
"hierarchy" : ".3.",
|
||||
"parentName" : "Demo MFI Head Office",
|
||||
@@ -1588,9 +1578,7 @@ Request Body:
|
||||
"name" : "Demo MFI Head Office",
|
||||
"externalId" : "1",
|
||||
"openingDate" : [ 2009, 1, 1 ],
|
||||
"hierarchy" : ".",
|
||||
"parentName" : null,
|
||||
"parentId" : null
|
||||
"hierarchy" : "."
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
@@ -1775,7 +1763,6 @@ Request Body:
|
||||
}, {
|
||||
"id" : 2,
|
||||
"name" : "Brunei Loan",
|
||||
"description" : null,
|
||||
"principal" : {
|
||||
"currencyCode" : "BND",
|
||||
"digitsAfterDecimal" : 2,
|
||||
@@ -2169,7 +2156,6 @@ Request Body:
|
||||
"code" : "ETB",
|
||||
"name" : "Ethiopian Birr",
|
||||
"decimalPlaces" : 2,
|
||||
"displaySymbol" : null,
|
||||
"nameCode" : "currency.ETB",
|
||||
"displayLabel" : "Ethiopian Birr [ETB]"
|
||||
} ],
|
||||
@@ -2177,14 +2163,12 @@ Request Body:
|
||||
"code" : "AED",
|
||||
"name" : "UAE Dirham",
|
||||
"decimalPlaces" : 2,
|
||||
"displaySymbol" : null,
|
||||
"nameCode" : "currency.AED",
|
||||
"displayLabel" : "UAE Dirham [AED]"
|
||||
}, {
|
||||
"code" : "AFN",
|
||||
"name" : "Afghanistan Afghani",
|
||||
"decimalPlaces" : 2,
|
||||
"displaySymbol" : null,
|
||||
"nameCode" : "currency.AFN",
|
||||
"displayLabel" : "Afghanistan Afghani [AFN]"
|
||||
}, ...
|
||||
|
||||
+9
-5
@@ -254,11 +254,15 @@ public class ClientsApiResource {
|
||||
|
||||
final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("pendingApprovalLoans",
|
||||
"awaitingDisbursalLoans", "openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount",
|
||||
"awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount", "pendingApprovalDespositAccountsCount",
|
||||
"pendingApprovalDespositAccounts", "approvedDespositAccountsCount", "approvedDespositAccounts",
|
||||
"withdrawnByClientDespositAccountsCount", "withdrawnByClientDespositAccounts", "closedDepositAccountsCount",
|
||||
"closedDepositAccounts", "rejectedDepositAccountsCount", "rejectedDepositAccounts", "preclosedDepositAccountsCount",
|
||||
"preclosedDepositAccounts"));
|
||||
"awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount", "pendingApprovalDepositAccountsCount",
|
||||
"pendingApprovalDepositAccounts", "approvedDepositAccountsCount", "approvedDepositAccounts",
|
||||
"withdrawnByClientDepositAccountsCount", "withdrawnByClientDepositAccounts", "closedDepositAccountsCount",
|
||||
"closedDepositAccounts", "maturedDepositAccountsCount", "maturedDepositAccounts", "rejectedDepositAccountsCount",
|
||||
"rejectedDepositAccounts", "preclosedDepositAccountsCount", "preclosedDepositAccounts",
|
||||
|
||||
"pendingApprovalSavingAccountsCount", "pendingApprovalSavingAccounts", "approvedSavingAccountsCount",
|
||||
"approvedSavingAccounts", "withdrawnByClientSavingAccountsCount", "withdrawnByClientSavingAccounts",
|
||||
"rejectedSavingAccountsCount", "rejectedSavingAccounts", "closedSavingAccountsCount", "closedSavingAccounts"));
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.clientAccountSummaryToApiJsonSerializer.serialize(settings, clientAccount, CLIENT_ACCOUNTS_DATA_PARAMETERS);
|
||||
|
||||
+133
-170
@@ -1,189 +1,152 @@
|
||||
package org.mifosplatform.portfolio.client.data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Immutable data object representing a summary of a clients various accounts.
|
||||
* Immutable data object representing a summary of a clients various accounts.
|
||||
*/
|
||||
public class ClientAccountSummaryCollectionData {
|
||||
|
||||
private final int anyLoanCount;
|
||||
private final int pendingApprovalLoanCount;
|
||||
private final List<ClientAccountSummaryData> pendingApprovalLoans;
|
||||
private final int awaitingDisbursalLoanCount;
|
||||
private final List<ClientAccountSummaryData> awaitingDisbursalLoans;
|
||||
private final int activeLoanCount;
|
||||
private final List<ClientAccountSummaryData> openLoans;
|
||||
private final int closedLoanCount;
|
||||
private final List<ClientAccountSummaryData> closedLoans;
|
||||
private final int pendingApprovalDespositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> pendingApprovalDepositAccounts;
|
||||
private final int approvedDespositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> approvedDepositAccounts;
|
||||
private final int withdrawnByClientDespositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> withdrawnByClientDespositAccounts;
|
||||
private final int closedDepositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> closedDepositAccounts;
|
||||
private final int rejectedDepositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> rejectedDepositAccounts;
|
||||
private final int preclosedDepositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> preclosedDepositAccounts;
|
||||
private final int maturedDepositAccountsCount;
|
||||
private final List<ClientAccountSummaryData> maturedDepositAccounts;
|
||||
private final int pendingApprovalSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> pendingApprovalSavingAccounts;
|
||||
private final int approvedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> approvedSavingAccounts;
|
||||
private final int withdrawnByClientSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> withdrawnByClientSavingAccounts;
|
||||
private final int rejectedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> rejectedSavingAccounts;
|
||||
private final int closedSavingAccountsCount;
|
||||
private final List<ClientAccountSummaryData> closedSavingAccounts;
|
||||
|
||||
public ClientAccountSummaryCollectionData(
|
||||
final List<ClientAccountSummaryData> pendingApprovalLoans,
|
||||
final List<ClientAccountSummaryData> awaitingDisbursalLoans,
|
||||
final List<ClientAccountSummaryData> openLoans,
|
||||
final List<ClientAccountSummaryData> closedLoans,
|
||||
final List<ClientAccountSummaryData> pendingApprovalDepositAccounts,
|
||||
final List<ClientAccountSummaryData> approvedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> withdrawnByClientDespositAccounts,
|
||||
final List<ClientAccountSummaryData> rejectedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> closedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> preclosedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> maturedDepositAccounts,
|
||||
final List<ClientAccountSummaryData> pendingApprovalSavingAccounts,
|
||||
final List<ClientAccountSummaryData> approvedSavingAccounts,
|
||||
final List<ClientAccountSummaryData> withdrawnByClientSavingAccounts,
|
||||
final List<ClientAccountSummaryData> rejectedSavingAccounts,
|
||||
final List<ClientAccountSummaryData> closedSavingAccounts) {
|
||||
this.pendingApprovalLoans = pendingApprovalLoans;
|
||||
this.awaitingDisbursalLoans = awaitingDisbursalLoans;
|
||||
this.openLoans = openLoans;
|
||||
this.closedLoans = closedLoans;
|
||||
this.pendingApprovalDepositAccounts = pendingApprovalDepositAccounts;
|
||||
this.approvedDepositAccounts = approvedDepositAccounts;
|
||||
this.withdrawnByClientDespositAccounts = withdrawnByClientDespositAccounts;
|
||||
this.closedDepositAccounts = closedDepositAccounts;
|
||||
this.rejectedDepositAccounts = rejectedDepositAccounts;
|
||||
this.preclosedDepositAccounts = preclosedDepositAccounts;
|
||||
this.maturedDepositAccounts = maturedDepositAccounts;
|
||||
|
||||
// saving accounts
|
||||
this.pendingApprovalSavingAccounts = pendingApprovalSavingAccounts;
|
||||
this.approvedSavingAccounts = approvedSavingAccounts;
|
||||
this.withdrawnByClientSavingAccounts = withdrawnByClientSavingAccounts;
|
||||
this.rejectedSavingAccounts = rejectedSavingAccounts;
|
||||
this.closedSavingAccounts = closedSavingAccounts;
|
||||
|
||||
this.pendingApprovalLoanCount = this.pendingApprovalLoans.size();
|
||||
this.awaitingDisbursalLoanCount = this.awaitingDisbursalLoans.size();
|
||||
this.activeLoanCount = this.openLoans.size();
|
||||
this.closedLoanCount = this.closedLoans.size();
|
||||
|
||||
this.pendingApprovalDespositAccountsCount = this.pendingApprovalDepositAccounts.size();
|
||||
this.approvedDespositAccountsCount = this.approvedDepositAccounts.size();
|
||||
this.withdrawnByClientDespositAccountsCount = this.withdrawnByClientDespositAccounts.size();
|
||||
this.closedDepositAccountsCount = this.closedDepositAccounts.size();
|
||||
this.rejectedDepositAccountsCount = this.rejectedDepositAccounts.size();
|
||||
this.preclosedDepositAccountsCount = this.preclosedDepositAccounts.size();
|
||||
this.maturedDepositAccountsCount = this.maturedDepositAccounts.size();
|
||||
this.pendingApprovalSavingAccountsCount = this.pendingApprovalSavingAccounts.size();
|
||||
this.approvedSavingAccountsCount = this.approvedSavingAccounts.size();
|
||||
this.withdrawnByClientSavingAccountsCount = this.withdrawnByClientSavingAccounts.size();
|
||||
this.rejectedSavingAccountsCount = this.rejectedSavingAccounts.size();
|
||||
this.closedSavingAccountsCount = this.closedSavingAccounts.size();
|
||||
|
||||
this.anyLoanCount = this.pendingApprovalLoanCount + this.awaitingDisbursalLoanCount + this.activeLoanCount + this.closedLoanCount
|
||||
+this.pendingApprovalDespositAccountsCount+this.approvedDespositAccountsCount+this.withdrawnByClientDespositAccountsCount+this.closedDepositAccountsCount
|
||||
+this.rejectedDepositAccountsCount+this.preclosedDepositAccountsCount+this.maturedDepositAccountsCount
|
||||
+this.pendingApprovalSavingAccountsCount+this.approvedSavingAccountsCount+this.withdrawnByClientSavingAccountsCount
|
||||
+this.rejectedSavingAccountsCount+this.closedSavingAccountsCount;
|
||||
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer anyLoanCount;
|
||||
private final Integer pendingApprovalLoanCount;
|
||||
private final Collection<ClientAccountSummaryData> pendingApprovalLoans;
|
||||
private final Integer awaitingDisbursalLoanCount;
|
||||
private final Collection<ClientAccountSummaryData> awaitingDisbursalLoans;
|
||||
private final Integer activeLoanCount;
|
||||
private final Collection<ClientAccountSummaryData> openLoans;
|
||||
private final Integer closedLoanCount;
|
||||
private final Collection<ClientAccountSummaryData> closedLoans;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer pendingApprovalDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> pendingApprovalDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer approvedDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> approvedDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer withdrawnByClientDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> withdrawnByClientDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer closedDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> closedDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer rejectedDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> rejectedDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer preclosedDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> preclosedDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer maturedDepositAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> maturedDepositAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer pendingApprovalSavingAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> pendingApprovalSavingAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer approvedSavingAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> approvedSavingAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer withdrawnByClientSavingAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> withdrawnByClientSavingAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer rejectedSavingAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> rejectedSavingAccounts;
|
||||
@SuppressWarnings("unused")
|
||||
private final Integer closedSavingAccountsCount;
|
||||
private final Collection<ClientAccountSummaryData> closedSavingAccounts;
|
||||
|
||||
public int getAnyLoanCount() {
|
||||
return anyLoanCount;
|
||||
}
|
||||
public ClientAccountSummaryCollectionData(final Collection<ClientAccountSummaryData> pendingApprovalLoans,
|
||||
final Collection<ClientAccountSummaryData> awaitingDisbursalLoans, final Collection<ClientAccountSummaryData> openLoans,
|
||||
final Collection<ClientAccountSummaryData> closedLoans,
|
||||
final Collection<ClientAccountSummaryData> pendingApprovalDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> approvedDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> withdrawnByClientDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> rejectedDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> closedDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> preclosedDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> maturedDepositAccounts,
|
||||
final Collection<ClientAccountSummaryData> pendingApprovalSavingAccounts,
|
||||
final Collection<ClientAccountSummaryData> approvedSavingAccounts,
|
||||
final Collection<ClientAccountSummaryData> withdrawnByClientSavingAccounts,
|
||||
final Collection<ClientAccountSummaryData> rejectedSavingAccounts,
|
||||
final Collection<ClientAccountSummaryData> closedSavingAccounts) {
|
||||
|
||||
public int getPendingApprovalLoanCount() {
|
||||
return pendingApprovalLoanCount;
|
||||
}
|
||||
this.pendingApprovalLoans = defaultIfEmpty(pendingApprovalLoans);
|
||||
this.awaitingDisbursalLoans = defaultIfEmpty(awaitingDisbursalLoans);
|
||||
this.openLoans = defaultIfEmpty(openLoans);
|
||||
this.closedLoans = defaultIfEmpty(closedLoans);
|
||||
|
||||
public List<ClientAccountSummaryData> getPendingApprovalLoans() {
|
||||
return pendingApprovalLoans;
|
||||
}
|
||||
this.pendingApprovalDepositAccounts = defaultIfEmpty(pendingApprovalDepositAccounts);
|
||||
this.approvedDepositAccounts = defaultIfEmpty(approvedDepositAccounts);
|
||||
this.withdrawnByClientDepositAccounts = defaultIfEmpty(withdrawnByClientDepositAccounts);
|
||||
this.closedDepositAccounts = defaultIfEmpty(closedDepositAccounts);
|
||||
this.rejectedDepositAccounts = defaultIfEmpty(rejectedDepositAccounts);
|
||||
this.preclosedDepositAccounts = defaultIfEmpty(preclosedDepositAccounts);
|
||||
this.maturedDepositAccounts = defaultIfEmpty(maturedDepositAccounts);
|
||||
|
||||
public int getAwaitingDisbursalLoanCount() {
|
||||
return awaitingDisbursalLoanCount;
|
||||
}
|
||||
this.pendingApprovalSavingAccounts = defaultIfEmpty(pendingApprovalSavingAccounts);
|
||||
this.approvedSavingAccounts = defaultIfEmpty(approvedSavingAccounts);
|
||||
this.withdrawnByClientSavingAccounts = defaultIfEmpty(withdrawnByClientSavingAccounts);
|
||||
this.rejectedSavingAccounts = defaultIfEmpty(rejectedSavingAccounts);
|
||||
this.closedSavingAccounts = defaultIfEmpty(closedSavingAccounts);
|
||||
|
||||
public List<ClientAccountSummaryData> getAwaitingDisbursalLoans() {
|
||||
return awaitingDisbursalLoans;
|
||||
}
|
||||
this.pendingApprovalLoanCount = defaultToNullIfEmpty(this.pendingApprovalLoans);
|
||||
this.awaitingDisbursalLoanCount = defaultToNullIfEmpty(this.awaitingDisbursalLoans);
|
||||
this.activeLoanCount = defaultToNullIfEmpty(this.openLoans);
|
||||
this.closedLoanCount = defaultToNullIfEmpty(this.closedLoans);
|
||||
|
||||
public int getActiveLoanCount() {
|
||||
return activeLoanCount;
|
||||
}
|
||||
this.pendingApprovalDepositAccountsCount = defaultToNullIfEmpty(this.pendingApprovalDepositAccounts);
|
||||
this.approvedDepositAccountsCount = defaultToNullIfEmpty(this.approvedDepositAccounts);
|
||||
this.withdrawnByClientDepositAccountsCount = defaultToNullIfEmpty(this.withdrawnByClientDepositAccounts);
|
||||
this.closedDepositAccountsCount = defaultToNullIfEmpty(this.closedDepositAccounts);
|
||||
this.rejectedDepositAccountsCount = defaultToNullIfEmpty(this.rejectedDepositAccounts);
|
||||
this.preclosedDepositAccountsCount = defaultToNullIfEmpty(this.preclosedDepositAccounts);
|
||||
this.maturedDepositAccountsCount = defaultToNullIfEmpty(this.maturedDepositAccounts);
|
||||
this.pendingApprovalSavingAccountsCount = defaultToNullIfEmpty(this.pendingApprovalSavingAccounts);
|
||||
this.approvedSavingAccountsCount = defaultToNullIfEmpty(this.approvedSavingAccounts);
|
||||
this.withdrawnByClientSavingAccountsCount = defaultToNullIfEmpty(this.withdrawnByClientSavingAccounts);
|
||||
this.rejectedSavingAccountsCount = defaultToNullIfEmpty(this.rejectedSavingAccounts);
|
||||
this.closedSavingAccountsCount = defaultToNullIfEmpty(this.closedSavingAccounts);
|
||||
|
||||
public List<ClientAccountSummaryData> getOpenLoans() {
|
||||
return openLoans;
|
||||
}
|
||||
this.anyLoanCount = countOf(this.pendingApprovalLoanCount, this.awaitingDisbursalLoanCount, this.activeLoanCount,
|
||||
this.closedLoanCount);
|
||||
//
|
||||
// , this.pendingApprovalDepositAccountsCount,
|
||||
// this.approvedDepositAccountsCount
|
||||
// , this.withdrawnByClientDepositAccountsCount,
|
||||
// this.closedDepositAccountsCount, this.rejectedDepositAccountsCount
|
||||
// , this.preclosedDepositAccountsCount,
|
||||
// this.maturedDepositAccountsCount,
|
||||
// this.pendingApprovalSavingAccountsCount
|
||||
// , this.approvedSavingAccountsCount,
|
||||
// this.withdrawnByClientSavingAccountsCount,
|
||||
// this.rejectedSavingAccountsCount
|
||||
// , this.closedSavingAccountsCount);
|
||||
|
||||
public int getClosedLoanCount() {
|
||||
return closedLoanCount;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getClosedLoans() {
|
||||
return closedLoans;
|
||||
}
|
||||
private Integer countOf(final Integer... objects) {
|
||||
Integer count = Integer.valueOf(0);
|
||||
for (Integer value : objects) {
|
||||
if (value != null) {
|
||||
count = count + value;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public int getPendingApprovalDespositAccountsCount() {
|
||||
return pendingApprovalDespositAccountsCount;
|
||||
}
|
||||
private Integer defaultToNullIfEmpty(final Collection<ClientAccountSummaryData> collection) {
|
||||
Integer count = null;
|
||||
if (defaultIfEmpty(collection) != null) {
|
||||
count = collection.size();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getPendingApprovalDepositAccounts() {
|
||||
return pendingApprovalDepositAccounts;
|
||||
}
|
||||
|
||||
public int getApprovedDespositAccountsCount() {
|
||||
return approvedDespositAccountsCount;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getApprovedDepositAccounts() {
|
||||
return approvedDepositAccounts;
|
||||
}
|
||||
|
||||
public int getWithdrawnByClientDespositAccountsCount() {
|
||||
return withdrawnByClientDespositAccountsCount;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getWithdrawnByClientDespositAccounts() {
|
||||
return withdrawnByClientDespositAccounts;
|
||||
}
|
||||
|
||||
public int getClosedDepositAccountsCount() {
|
||||
return closedDepositAccountsCount;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getClosedDepositAccounts() {
|
||||
return closedDepositAccounts;
|
||||
}
|
||||
|
||||
public int getRejectedDepositAccountsCount() {
|
||||
return rejectedDepositAccountsCount;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getRejectedDepositAccounts() {
|
||||
return rejectedDepositAccounts;
|
||||
}
|
||||
|
||||
public int getPreclosedDepositAccountsCount() {
|
||||
return preclosedDepositAccountsCount;
|
||||
}
|
||||
|
||||
public List<ClientAccountSummaryData> getPreclosedDepositAccounts() {
|
||||
return preclosedDepositAccounts;
|
||||
}
|
||||
private Collection<ClientAccountSummaryData> defaultIfEmpty(final Collection<ClientAccountSummaryData> collection) {
|
||||
Collection<ClientAccountSummaryData> returnCollection = null;
|
||||
if (collection != null && !collection.isEmpty()) {
|
||||
returnCollection = collection;
|
||||
}
|
||||
return returnCollection;
|
||||
}
|
||||
}
|
||||
+24
-1
@@ -1,5 +1,7 @@
|
||||
package org.mifosplatform.portfolio.client.data;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
/**
|
||||
* Immutable data object for client loan accounts.
|
||||
*/
|
||||
@@ -13,7 +15,9 @@ public class ClientAccountSummaryData {
|
||||
private final Long productId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String productName;
|
||||
|
||||
private final Integer accountStatusId;
|
||||
private final EnumOptionData status;
|
||||
|
||||
public ClientAccountSummaryData(final Long id, final String externalId, final Long productId, final String loanProductName,
|
||||
final Integer loanStatusId) {
|
||||
@@ -22,9 +26,28 @@ public class ClientAccountSummaryData {
|
||||
this.productId = productId;
|
||||
this.productName = loanProductName;
|
||||
this.accountStatusId = loanStatusId;
|
||||
this.status = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rather than use id, just be consistent and use EnumOptionData for the
|
||||
* status of an account.
|
||||
*/
|
||||
public ClientAccountSummaryData(final Long id, final String externalId, final Long productId, final String loanProductName,
|
||||
final EnumOptionData loanStatus) {
|
||||
this.id = id;
|
||||
this.externalId = externalId;
|
||||
this.productId = productId;
|
||||
this.productName = loanProductName;
|
||||
this.accountStatusId = null;
|
||||
this.status = loanStatus;
|
||||
}
|
||||
|
||||
public Integer accountStatusId() {
|
||||
return accountStatusId;
|
||||
Integer accountStatus = this.accountStatusId;
|
||||
if (accountStatus == null && this.status != null) {
|
||||
accountStatus = this.status.getId().intValue();
|
||||
}
|
||||
return accountStatus;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -103,7 +103,7 @@ final public class ClientData {
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.id = id;
|
||||
this.firstname = firstname;
|
||||
this.firstname = StringUtils.defaultIfEmpty(firstname, null);
|
||||
|
||||
/*** unset last name for business name **/
|
||||
if (StringUtils.isBlank(firstname)) {
|
||||
@@ -114,7 +114,7 @@ final public class ClientData {
|
||||
this.clientOrBusinessName = null;
|
||||
}
|
||||
this.displayName = displayName;
|
||||
this.externalId = externalId;
|
||||
this.externalId = StringUtils.defaultIfEmpty(externalId, null);
|
||||
this.joinedDate = joinedDate;
|
||||
this.imageKey = imageKey;
|
||||
if (imageKey != null) {
|
||||
|
||||
+8
-6
@@ -25,6 +25,7 @@ import org.mifosplatform.portfolio.client.domain.NoteEnumerations;
|
||||
import org.mifosplatform.portfolio.client.exception.ClientIdentifierNotFoundException;
|
||||
import org.mifosplatform.portfolio.client.exception.ClientNotFoundException;
|
||||
import org.mifosplatform.portfolio.client.exception.NoteNotFoundException;
|
||||
import org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations;
|
||||
import org.mifosplatform.useradministration.data.AppUserData;
|
||||
import org.mifosplatform.useradministration.domain.AppUser;
|
||||
import org.mifosplatform.useradministration.service.AppUserReadPlatformService;
|
||||
@@ -314,13 +315,14 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
@Override
|
||||
public ClientAccountSummaryData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
Long id = JdbcSupport.getLong(rs, "id");
|
||||
String externalId = rs.getString("externalId");
|
||||
Long productId = JdbcSupport.getLong(rs, "productId");
|
||||
String loanProductName = rs.getString("productName");
|
||||
Integer loanStatusId = JdbcSupport.getInteger(rs, "statusId");
|
||||
final Long id = JdbcSupport.getLong(rs, "id");
|
||||
final String externalId = rs.getString("externalId");
|
||||
final Long productId = JdbcSupport.getLong(rs, "productId");
|
||||
final String loanProductName = rs.getString("productName");
|
||||
final Integer loanStatusId = JdbcSupport.getInteger(rs, "statusId");
|
||||
final EnumOptionData loanStatus = LoanEnumerations.status(loanStatusId);
|
||||
|
||||
return new ClientAccountSummaryData(id, externalId, productId, loanProductName, loanStatusId);
|
||||
return new ClientAccountSummaryData(id, externalId, productId, loanProductName, loanStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user