MIFOSX-97: organise classes into new package structure.
This commit is contained in:
@@ -22,14 +22,11 @@ sourceCompatibility = JavaVersion.VERSION_1_6
|
||||
/* define binary compatiblity version */
|
||||
targetCompatibility = JavaVersion.VERSION_1_6
|
||||
|
||||
// targetCompatibility = 1.6
|
||||
// sourceCompatibility = 1.6
|
||||
|
||||
project.ext.springVersion = '3.1.1.RELEASE'
|
||||
project.ext.springSecurityVersion = '3.1.0.RELEASE'
|
||||
project.ext.hibernateValidatorVersion = '4.3.0.Final'
|
||||
project.ext.hibernateCoreVersion = '4.1.3.Final'
|
||||
project.ext.jerseyVersion = '1.13'
|
||||
project.ext.springVersion = '3.1.3.RELEASE'
|
||||
project.ext.springSecurityVersion = '3.1.3.RELEASE'
|
||||
project.ext.hibernateValidatorVersion = '4.3.1.Final'
|
||||
project.ext.hibernateCoreVersion = '4.1.8.Final'
|
||||
project.ext.jerseyVersion = '1.16'
|
||||
project.ext.springDataJpaVersion = '1.0.3.RELEASE'
|
||||
|
||||
repositories {
|
||||
@@ -63,7 +60,7 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def tomcatVersion = '7.0.29'
|
||||
def tomcatVersion = '7.0.33'
|
||||
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
|
||||
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
|
||||
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
|
||||
@@ -111,8 +108,8 @@ dependencies {
|
||||
[group: 'ch.qos.logback', name: 'logback-core', version: '1.0.6'],
|
||||
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.6'],
|
||||
|
||||
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.21'],
|
||||
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.29'],
|
||||
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.22'],
|
||||
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.33'],
|
||||
|
||||
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '3.8.3-GA'],
|
||||
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '3.8.3-GA'],
|
||||
|
||||
+1
-3
@@ -1,12 +1,10 @@
|
||||
package org.mifosplatform.infrastructure.configuration.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class MonetaryCurrency implements Serializable {
|
||||
public class MonetaryCurrency {
|
||||
|
||||
@Column(name = "currency_code", length = 3, nullable = false)
|
||||
private final String code;
|
||||
|
||||
+31
-39
@@ -1,6 +1,5 @@
|
||||
package org.mifosplatform.infrastructure.configuration.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Iterator;
|
||||
@@ -9,15 +8,15 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class Money implements Comparable<Money>, Serializable {
|
||||
public class Money implements Comparable<Money> {
|
||||
|
||||
@Column(name = "currency_code", length=3)
|
||||
private final String currencyCode;
|
||||
@Column(name = "currency_code", length = 3)
|
||||
private final String currencyCode;
|
||||
|
||||
@Column(name = "currency_digits")
|
||||
private final int currencyDigitsAfterDecimal;
|
||||
private final int currencyDigitsAfterDecimal;
|
||||
|
||||
@Column(name = "amount", scale=6, precision=19)
|
||||
@Column(name = "amount", scale = 6, precision = 19)
|
||||
private final BigDecimal amount;
|
||||
|
||||
public static Money total(final Money... monies) {
|
||||
@@ -38,13 +37,13 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public static Money of(final MonetaryCurrency currency, final BigDecimal newAmount) {
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), defaultToZeroIfNull(newAmount));
|
||||
}
|
||||
|
||||
|
||||
public static Money of(final MonetaryCurrency currency, final BigDecimal newAmount) {
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), defaultToZeroIfNull(newAmount));
|
||||
}
|
||||
|
||||
public static Money zero(final MonetaryCurrency currency) {
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), BigDecimal.ZERO);
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
protected Money() {
|
||||
@@ -56,19 +55,19 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
private Money(final String currencyCode, final int digitsAfterDecimal, final BigDecimal amount) {
|
||||
this.currencyCode = currencyCode;
|
||||
this.currencyDigitsAfterDecimal = digitsAfterDecimal;
|
||||
|
||||
|
||||
final BigDecimal amountZeroed = defaultToZeroIfNull(amount);
|
||||
BigDecimal amountStripped = amountZeroed.stripTrailingZeros();
|
||||
this.amount = amountStripped.setScale(this.currencyDigitsAfterDecimal, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
|
||||
private static BigDecimal defaultToZeroIfNull(final BigDecimal value) {
|
||||
BigDecimal result = BigDecimal.ZERO;
|
||||
if (value != null) {
|
||||
result = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
BigDecimal result = BigDecimal.ZERO;
|
||||
if (value != null) {
|
||||
result = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Money copy() {
|
||||
return new Money(this.currencyCode, this.currencyDigitsAfterDecimal, this.amount.stripTrailingZeros());
|
||||
@@ -83,7 +82,7 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
return Money.of(monetaryCurrency(), total);
|
||||
}
|
||||
|
||||
public Money plus(final Money moneyToAdd) {
|
||||
public Money plus(final Money moneyToAdd) {
|
||||
Money toAdd = this.checkCurrencyEqual(moneyToAdd);
|
||||
return this.plus(toAdd.getAmount());
|
||||
}
|
||||
@@ -170,9 +169,8 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
@Override
|
||||
public int compareTo(final Money other) {
|
||||
Money otherMoney = other;
|
||||
if (this.currencyCode.equals(otherMoney.currencyCode) == false) {
|
||||
throw new UnsupportedOperationException("currencies arent different");
|
||||
}
|
||||
if (this.currencyCode.equals(otherMoney.currencyCode) == false) { throw new UnsupportedOperationException(
|
||||
"currencies arent different"); }
|
||||
return this.amount.compareTo(otherMoney.amount);
|
||||
}
|
||||
|
||||
@@ -183,7 +181,7 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
public boolean isEqualTo(final Money other) {
|
||||
return this.compareTo(other) == 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isNotEqualTo(final Money other) {
|
||||
return !isEqualTo(other);
|
||||
}
|
||||
@@ -222,17 +220,11 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()
|
||||
.append(this.currencyCode)
|
||||
.append(' ')
|
||||
.append(this.amount.toPlainString())
|
||||
.toString();
|
||||
return new StringBuilder().append(this.currencyCode).append(' ').append(this.amount.toPlainString()).toString();
|
||||
}
|
||||
|
||||
public Money negated() {
|
||||
if (this.isZero()) {
|
||||
return this;
|
||||
}
|
||||
if (this.isZero()) { return this; }
|
||||
return Money.of(monetaryCurrency(), this.amount.negate());
|
||||
}
|
||||
|
||||
@@ -240,11 +232,11 @@ public class Money implements Comparable<Money>, Serializable {
|
||||
return this.isLessThanZero() ? this.negated() : this;
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
return monetaryCurrency();
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
return monetaryCurrency();
|
||||
}
|
||||
|
||||
private MonetaryCurrency monetaryCurrency() {
|
||||
return new MonetaryCurrency(this.currencyCode, this.currencyDigitsAfterDecimal);
|
||||
}
|
||||
return new MonetaryCurrency(this.currencyCode, this.currencyDigitsAfterDecimal);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -7,8 +7,6 @@ import java.util.Set;
|
||||
|
||||
import org.mifosng.platform.api.data.DepositAccountData;
|
||||
import org.mifosng.platform.api.data.DepositProductData;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosng.platform.api.data.SavingAccountData;
|
||||
import org.mifosng.platform.api.data.SavingProductData;
|
||||
import org.mifosplatform.commands.api.data.CommandSourceData;
|
||||
@@ -33,6 +31,8 @@ import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.client.data.ClientIdentifierData;
|
||||
import org.mifosplatform.portfolio.client.data.NoteData;
|
||||
import org.mifosplatform.portfolio.fund.data.FundData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanAccountData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanChargeData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData;
|
||||
|
||||
+1
-1
@@ -6,7 +6,6 @@ import org.mifosng.platform.api.commands.DepositAccountWithdrawalCommand;
|
||||
import org.mifosng.platform.api.commands.DepositProductCommand;
|
||||
import org.mifosng.platform.api.commands.DepositStateTransitionApprovalCommand;
|
||||
import org.mifosng.platform.api.commands.DepositStateTransitionCommand;
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosng.platform.api.commands.SavingAccountCommand;
|
||||
import org.mifosng.platform.api.commands.SavingProductCommand;
|
||||
import org.mifosplatform.infrastructure.codes.command.CodeCommand;
|
||||
@@ -25,6 +24,7 @@ import org.mifosplatform.portfolio.client.command.ClientIdentifierCommand;
|
||||
import org.mifosplatform.portfolio.client.command.NoteCommand;
|
||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.fund.command.FundCommand;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.AdjustLoanTransactionCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanApplicationCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanChargeCommand;
|
||||
|
||||
+1
-1
@@ -23,7 +23,6 @@ import org.mifosng.platform.api.commands.DepositAccountWithdrawalCommand;
|
||||
import org.mifosng.platform.api.commands.DepositProductCommand;
|
||||
import org.mifosng.platform.api.commands.DepositStateTransitionApprovalCommand;
|
||||
import org.mifosng.platform.api.commands.DepositStateTransitionCommand;
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosng.platform.api.commands.SavingAccountCommand;
|
||||
import org.mifosng.platform.api.commands.SavingProductCommand;
|
||||
import org.mifosplatform.infrastructure.codes.command.CodeCommand;
|
||||
@@ -46,6 +45,7 @@ import org.mifosplatform.portfolio.client.command.ClientIdentifierCommand;
|
||||
import org.mifosplatform.portfolio.client.command.NoteCommand;
|
||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.fund.command.FundCommand;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.AdjustLoanTransactionCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanApplicationCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanChargeCommand;
|
||||
|
||||
+2
-2
@@ -5,8 +5,6 @@ import java.util.Set;
|
||||
|
||||
import org.mifosng.platform.api.data.DepositAccountData;
|
||||
import org.mifosng.platform.api.data.DepositProductData;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosng.platform.api.data.SavingAccountData;
|
||||
import org.mifosng.platform.api.data.SavingProductData;
|
||||
import org.mifosplatform.commands.api.data.CommandSourceData;
|
||||
@@ -31,6 +29,8 @@ import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.client.data.ClientIdentifierData;
|
||||
import org.mifosplatform.portfolio.client.data.NoteData;
|
||||
import org.mifosplatform.portfolio.fund.data.FundData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanAccountData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanChargeData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData;
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package org.mifosplatform.infrastructure.staff.data;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.client.data.ClientAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
+2
-2
@@ -6,8 +6,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryData;
|
||||
import org.mifosng.platform.group.service.GroupReadPlatformService;
|
||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -16,6 +14,8 @@ import org.mifosplatform.infrastructure.staff.data.StaffData;
|
||||
import org.mifosplatform.infrastructure.staff.exception.StaffNotFoundException;
|
||||
import org.mifosplatform.portfolio.client.data.ClientAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.group.service.GroupReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
-3
@@ -56,9 +56,6 @@ import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
/**
|
||||
* test commit. again.
|
||||
*/
|
||||
@Path("/clients")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api;
|
||||
package org.mifosplatform.portfolio.group.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -20,11 +20,6 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosng.platform.group.service.GroupReadPlatformService;
|
||||
import org.mifosng.platform.group.service.GroupWritePlatformService;
|
||||
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
|
||||
import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService;
|
||||
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
|
||||
@@ -34,6 +29,11 @@ import org.mifosplatform.infrastructure.office.service.OfficeReadPlatformService
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.portfolio.client.data.ClientLookup;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
import org.mifosplatform.portfolio.group.service.GroupReadPlatformService;
|
||||
import org.mifosplatform.portfolio.group.service.GroupWritePlatformService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api.commands;
|
||||
package org.mifosplatform.portfolio.group.command;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
package org.mifosng.platform.group.service;
|
||||
package org.mifosplatform.portfolio.group.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosplatform.infrastructure.core.data.ApiParameterError;
|
||||
import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
package org.mifosplatform.portfolio.group.data;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
package org.mifosplatform.portfolio.group.data;
|
||||
|
||||
/**
|
||||
* Immutable data object for group loan accounts.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
package org.mifosplatform.portfolio.group.data;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.group.domain;
|
||||
package org.mifosplatform.portfolio.group.domain;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -12,11 +12,11 @@ import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.mifosplatform.infrastructure.office.domain.Office;
|
||||
import org.mifosplatform.infrastructure.user.domain.AppUser;
|
||||
import org.mifosplatform.portfolio.client.domain.Client;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_group")
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.group.domain;
|
||||
package org.mifosplatform.portfolio.group.domain;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.exceptions;
|
||||
package org.mifosplatform.portfolio.group.exception;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
package org.mifosng.platform.group.service;
|
||||
package org.mifosplatform.portfolio.group.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryData;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosplatform.portfolio.client.data.ClientLookup;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
|
||||
public interface GroupReadPlatformService {
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.group.service;
|
||||
package org.mifosplatform.portfolio.group.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -7,10 +7,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.GroupAccountSummaryData;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosng.platform.exceptions.GroupNotFoundException;
|
||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||
import org.mifosplatform.infrastructure.office.data.OfficeLookup;
|
||||
@@ -19,6 +15,10 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.mifosplatform.portfolio.client.data.ClientLookup;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.client.service.LoanStatusMapper;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
import org.mifosplatform.portfolio.group.exception.GroupNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package org.mifosng.platform.group.service;
|
||||
package org.mifosplatform.portfolio.group.service;
|
||||
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface GroupWritePlatformService {
|
||||
+6
-5
@@ -1,12 +1,8 @@
|
||||
package org.mifosng.platform.group.service;
|
||||
package org.mifosplatform.portfolio.group.service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.mifosng.platform.api.commands.GroupCommand;
|
||||
import org.mifosng.platform.exceptions.GroupNotFoundException;
|
||||
import org.mifosng.platform.group.domain.Group;
|
||||
import org.mifosng.platform.group.domain.GroupRepository;
|
||||
import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
|
||||
import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.mifosplatform.infrastructure.office.domain.Office;
|
||||
@@ -17,6 +13,11 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.mifosplatform.portfolio.client.domain.Client;
|
||||
import org.mifosplatform.portfolio.client.domain.ClientRepository;
|
||||
import org.mifosplatform.portfolio.client.exception.ClientNotFoundException;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||
import org.mifosplatform.portfolio.group.command.GroupCommandValidator;
|
||||
import org.mifosplatform.portfolio.group.domain.Group;
|
||||
import org.mifosplatform.portfolio.group.domain.GroupRepository;
|
||||
import org.mifosplatform.portfolio.group.exception.GroupNotFoundException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
+1
-1
@@ -26,7 +26,6 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.platform.group.domain.Group;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.MonetaryCurrency;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.Money;
|
||||
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
@@ -35,6 +34,7 @@ import org.mifosplatform.infrastructure.user.domain.AppUser;
|
||||
import org.mifosplatform.portfolio.charge.exception.LoanChargeCannotBeAddedException;
|
||||
import org.mifosplatform.portfolio.client.domain.Client;
|
||||
import org.mifosplatform.portfolio.fund.domain.Fund;
|
||||
import org.mifosplatform.portfolio.group.domain.Group;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanApplicationCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanChargeCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.exception.InvalidLoanStateTransitionException;
|
||||
|
||||
+210
-208
@@ -6,8 +6,6 @@ import java.util.Date;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
@@ -35,247 +33,251 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
public class LoanTransaction extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "loan_id", nullable=false)
|
||||
private Loan loan;
|
||||
@JoinColumn(name = "loan_id", nullable = false)
|
||||
private Loan loan;
|
||||
|
||||
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "principal_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal principalPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "interest_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal interestPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "fee_charges_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal feeChargesPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "penalty_charges_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal penaltyChargesPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "principal_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal principalPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "interest_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal interestPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "fee_charges_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal feeChargesPortion = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "penalty_charges_portion_derived", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal penaltyChargesPortion = BigDecimal.ZERO;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "transaction_date", nullable=false)
|
||||
private final Date dateOf;
|
||||
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
@Column(name = "transaction_type_enum", nullable = false)
|
||||
private Integer typeOf;
|
||||
|
||||
@OneToOne(optional=true, cascade={CascadeType.PERSIST})
|
||||
@JoinColumn(name="contra_id")
|
||||
@Column(name = "transaction_date", nullable = false)
|
||||
private final Date dateOf;
|
||||
|
||||
@Column(name = "transaction_type_enum", nullable = false)
|
||||
private Integer typeOf;
|
||||
|
||||
@OneToOne(optional = true, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumn(name = "contra_id")
|
||||
private LoanTransaction contra;
|
||||
|
||||
|
||||
protected LoanTransaction() {
|
||||
this.loan = null;
|
||||
this.dateOf = null;
|
||||
this.typeOf = null;
|
||||
}
|
||||
|
||||
|
||||
public static LoanTransaction disbursement(final Money amount, final LocalDate disbursementDate) {
|
||||
return new LoanTransaction(null, LoanTransactionType.DISBURSEMENT, amount.getAmount(), disbursementDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction repayment(final Money amount, final LocalDate paymentDate) {
|
||||
return new LoanTransaction(null, LoanTransactionType.REPAYMENT, amount.getAmount(), paymentDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction repaymentAtDisbursement(final Money amount, final LocalDate paymentDate) {
|
||||
return new LoanTransaction(null, LoanTransactionType.REPAYMENT_AT_DISBURSEMENT, amount.getAmount(), paymentDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction waiver(final Loan loan, final Money waived, final LocalDate waiveDate) {
|
||||
return new LoanTransaction(loan, LoanTransactionType.WAIVE_INTEREST, waived.getAmount(), waiveDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction waiveLoanCharge(final Loan loan, final Money waived, final LocalDate waiveDate, final Money feeChargesWaived, final Money penaltyChargesWaived) {
|
||||
LoanTransaction waiver = new LoanTransaction(loan, LoanTransactionType.WAIVE_CHARGES, waived.getAmount(), waiveDate);
|
||||
waiver.updateChargesComponents(feeChargesWaived, penaltyChargesWaived);
|
||||
|
||||
return waiver;
|
||||
}
|
||||
return new LoanTransaction(null, LoanTransactionType.DISBURSEMENT, amount.getAmount(), disbursementDate);
|
||||
}
|
||||
|
||||
private static LoanTransaction contra(final LoanTransaction originalTransaction) {
|
||||
LoanTransaction contra = new LoanTransaction(null, LoanTransactionType.CONTRA, originalTransaction.getAmount().negate(), new LocalDate(originalTransaction.getDateOf()));
|
||||
contra.updateContra(originalTransaction);
|
||||
return contra;
|
||||
}
|
||||
|
||||
public static LoanTransaction writeoff(final Loan loan, final LocalDate writeOffDate) {
|
||||
return new LoanTransaction(loan, LoanTransactionType.WRITEOFF, null, writeOffDate);
|
||||
}
|
||||
|
||||
public void updateContra(final LoanTransaction transaction) {
|
||||
this.contra = transaction;
|
||||
}
|
||||
public static LoanTransaction repayment(final Money amount, final LocalDate paymentDate) {
|
||||
return new LoanTransaction(null, LoanTransactionType.REPAYMENT, amount.getAmount(), paymentDate);
|
||||
}
|
||||
|
||||
private LoanTransaction(final Loan loan, final LoanTransactionType type, final BigDecimal amount, final LocalDate date) {
|
||||
this.loan = loan;
|
||||
this.typeOf = type.getValue();
|
||||
public static LoanTransaction repaymentAtDisbursement(final Money amount, final LocalDate paymentDate) {
|
||||
return new LoanTransaction(null, LoanTransactionType.REPAYMENT_AT_DISBURSEMENT, amount.getAmount(), paymentDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction waiver(final Loan loan, final Money waived, final LocalDate waiveDate) {
|
||||
return new LoanTransaction(loan, LoanTransactionType.WAIVE_INTEREST, waived.getAmount(), waiveDate);
|
||||
}
|
||||
|
||||
public static LoanTransaction waiveLoanCharge(final Loan loan, final Money waived, final LocalDate waiveDate,
|
||||
final Money feeChargesWaived, final Money penaltyChargesWaived) {
|
||||
LoanTransaction waiver = new LoanTransaction(loan, LoanTransactionType.WAIVE_CHARGES, waived.getAmount(), waiveDate);
|
||||
waiver.updateChargesComponents(feeChargesWaived, penaltyChargesWaived);
|
||||
|
||||
return waiver;
|
||||
}
|
||||
|
||||
private static LoanTransaction contra(final LoanTransaction originalTransaction) {
|
||||
LoanTransaction contra = new LoanTransaction(null, LoanTransactionType.CONTRA, originalTransaction.getAmount().negate(),
|
||||
new LocalDate(originalTransaction.getDateOf()));
|
||||
contra.updateContra(originalTransaction);
|
||||
return contra;
|
||||
}
|
||||
|
||||
public static LoanTransaction writeoff(final Loan loan, final LocalDate writeOffDate) {
|
||||
return new LoanTransaction(loan, LoanTransactionType.WRITEOFF, null, writeOffDate);
|
||||
}
|
||||
|
||||
public void updateContra(final LoanTransaction transaction) {
|
||||
this.contra = transaction;
|
||||
}
|
||||
|
||||
private LoanTransaction(final Loan loan, final LoanTransactionType type, final BigDecimal amount, final LocalDate date) {
|
||||
this.loan = loan;
|
||||
this.typeOf = type.getValue();
|
||||
this.amount = amount;
|
||||
this.dateOf = date.toDateMidnight().toDate();
|
||||
this.dateOf = date.toDateMidnight().toDate();
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public Money getAmount(MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.amount);
|
||||
}
|
||||
|
||||
@DateTimeFormat(style="-M")
|
||||
public Money getAmount(MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.amount);
|
||||
}
|
||||
|
||||
@DateTimeFormat(style = "-M")
|
||||
public LocalDate getTransactionDate() {
|
||||
return new LocalDate(this.dateOf);
|
||||
}
|
||||
|
||||
public Date getDateOf() {
|
||||
return dateOf;
|
||||
}
|
||||
public Date getDateOf() {
|
||||
return dateOf;
|
||||
}
|
||||
|
||||
public LoanTransactionType getTypeOf() {
|
||||
return LoanTransactionType.fromInt(this.typeOf);
|
||||
}
|
||||
public LoanTransactionType getTypeOf() {
|
||||
return LoanTransactionType.fromInt(this.typeOf);
|
||||
}
|
||||
|
||||
public boolean isRepayment() {
|
||||
return LoanTransactionType.REPAYMENT.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isNotRepayment() {
|
||||
return !isRepayment();
|
||||
}
|
||||
|
||||
public boolean isNotContra() {
|
||||
return this.contra == null;
|
||||
}
|
||||
public boolean isRepayment() {
|
||||
return LoanTransactionType.REPAYMENT.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isDisbursement() {
|
||||
return LoanTransactionType.DISBURSEMENT.equals(getTypeOf());
|
||||
}
|
||||
|
||||
public boolean isRepaymentAtDisbursement() {
|
||||
return LoanTransactionType.REPAYMENT_AT_DISBURSEMENT.equals(getTypeOf());
|
||||
}
|
||||
|
||||
public boolean isInterestWaiver() {
|
||||
return LoanTransactionType.WAIVE_INTEREST.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isChargesWaiver() {
|
||||
return LoanTransactionType.WAIVE_CHARGES.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isNotInterestWaiver() {
|
||||
return !isInterestWaiver();
|
||||
}
|
||||
|
||||
public boolean isWaiver() {
|
||||
return isInterestWaiver() || isChargesWaiver();
|
||||
}
|
||||
|
||||
public boolean isNotWaiver() {
|
||||
return !isInterestWaiver() && !isChargesWaiver();
|
||||
}
|
||||
|
||||
public boolean isWriteOff() {
|
||||
return getTypeOf().isWriteOff() && isNotContra();
|
||||
}
|
||||
public boolean isNotRepayment() {
|
||||
return !isRepayment();
|
||||
}
|
||||
|
||||
public boolean isIdentifiedBy(final Long identifier) {
|
||||
return this.getId().equals(identifier);
|
||||
}
|
||||
|
||||
public boolean isBelongingToLoanOf(final Loan check) {
|
||||
return this.loan.getId().equals(check.getId());
|
||||
}
|
||||
|
||||
public boolean isNotBelongingToLoanOf(final Loan check) {
|
||||
return !isBelongingToLoanOf(check);
|
||||
}
|
||||
public boolean isNotContra() {
|
||||
return this.contra == null;
|
||||
}
|
||||
|
||||
public void contra() {
|
||||
this.contra = LoanTransaction.contra(this);
|
||||
contra.updateLoan(this.loan);
|
||||
}
|
||||
public boolean isDisbursement() {
|
||||
return LoanTransactionType.DISBURSEMENT.equals(getTypeOf());
|
||||
}
|
||||
|
||||
public boolean isRepaymentAtDisbursement() {
|
||||
return LoanTransactionType.REPAYMENT_AT_DISBURSEMENT.equals(getTypeOf());
|
||||
}
|
||||
|
||||
public boolean isInterestWaiver() {
|
||||
return LoanTransactionType.WAIVE_INTEREST.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isChargesWaiver() {
|
||||
return LoanTransactionType.WAIVE_CHARGES.equals(getTypeOf()) && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isNotInterestWaiver() {
|
||||
return !isInterestWaiver();
|
||||
}
|
||||
|
||||
public boolean isWaiver() {
|
||||
return isInterestWaiver() || isChargesWaiver();
|
||||
}
|
||||
|
||||
public boolean isNotWaiver() {
|
||||
return !isInterestWaiver() && !isChargesWaiver();
|
||||
}
|
||||
|
||||
public boolean isWriteOff() {
|
||||
return getTypeOf().isWriteOff() && isNotContra();
|
||||
}
|
||||
|
||||
public boolean isIdentifiedBy(final Long identifier) {
|
||||
return this.getId().equals(identifier);
|
||||
}
|
||||
|
||||
public boolean isBelongingToLoanOf(final Loan check) {
|
||||
return this.loan.getId().equals(check.getId());
|
||||
}
|
||||
|
||||
public boolean isNotBelongingToLoanOf(final Loan check) {
|
||||
return !isBelongingToLoanOf(check);
|
||||
}
|
||||
|
||||
public void contra() {
|
||||
this.contra = LoanTransaction.contra(this);
|
||||
contra.updateLoan(this.loan);
|
||||
}
|
||||
|
||||
public void updateLoan(final Loan loan) {
|
||||
this.loan = loan;
|
||||
}
|
||||
|
||||
public boolean isNonZero() {
|
||||
return this.amount.subtract(BigDecimal.ZERO).doubleValue() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This updates the derived fields of a loan transaction for the principal, interest and interest waived portions.
|
||||
*
|
||||
* This accumulates the values passed to the already existent values for each of the portions.
|
||||
*/
|
||||
public void updateComponents(final Money principal, final Money interest, final Money feeCharges, final Money penaltyCharges) {
|
||||
final MonetaryCurrency currency = principal.getCurrency();
|
||||
this.principalPortion = defaultToNullIfZero(getPrincipalPortion(currency).plus(principal).getAmount());
|
||||
this.interestPortion = defaultToNullIfZero(getInterestPortion(currency).plus(interest).getAmount());
|
||||
updateChargesComponents(feeCharges, penaltyCharges);
|
||||
}
|
||||
|
||||
private void updateChargesComponents(final Money feeCharges, final Money penaltyCharges) {
|
||||
final MonetaryCurrency currency = feeCharges.getCurrency();
|
||||
this.feeChargesPortion = defaultToNullIfZero(getFeeChargesPortion(currency).plus(feeCharges).getAmount());
|
||||
this.penaltyChargesPortion = defaultToNullIfZero(getPenaltyChargesPortion(currency).plus(penaltyCharges).getAmount());
|
||||
}
|
||||
|
||||
public void updateComponentsAndTotal(final Money principal, final Money interest, final Money feeCharges, final Money penaltyCharges) {
|
||||
updateComponents(principal, interest, feeCharges, penaltyCharges);
|
||||
|
||||
final MonetaryCurrency currency = principal.getCurrency();
|
||||
this.amount = getPrincipalPortion(currency).plus(getInterestPortion(currency)).plus(getFeeChargesPortion(currency)).plus(getPenaltyChargesPortion(currency)).getAmount();
|
||||
}
|
||||
|
||||
public Money getPrincipalPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.principalPortion);
|
||||
}
|
||||
public boolean isNonZero() {
|
||||
return this.amount.subtract(BigDecimal.ZERO).doubleValue() > 0;
|
||||
}
|
||||
|
||||
public Money getInterestPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.interestPortion);
|
||||
}
|
||||
|
||||
public Money getFeeChargesPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.feeChargesPortion);
|
||||
}
|
||||
|
||||
public Money getPenaltyChargesPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.penaltyChargesPortion);
|
||||
}
|
||||
/**
|
||||
* This updates the derived fields of a loan transaction for the principal,
|
||||
* interest and interest waived portions.
|
||||
*
|
||||
* This accumulates the values passed to the already existent values for
|
||||
* each of the portions.
|
||||
*/
|
||||
public void updateComponents(final Money principal, final Money interest, final Money feeCharges, final Money penaltyCharges) {
|
||||
final MonetaryCurrency currency = principal.getCurrency();
|
||||
this.principalPortion = defaultToNullIfZero(getPrincipalPortion(currency).plus(principal).getAmount());
|
||||
this.interestPortion = defaultToNullIfZero(getInterestPortion(currency).plus(interest).getAmount());
|
||||
updateChargesComponents(feeCharges, penaltyCharges);
|
||||
}
|
||||
|
||||
public void resetDerivedComponents() {
|
||||
this.principalPortion = null;
|
||||
this.interestPortion = null;
|
||||
this.feeChargesPortion = null;
|
||||
this.penaltyChargesPortion = null;
|
||||
}
|
||||
private void updateChargesComponents(final Money feeCharges, final Money penaltyCharges) {
|
||||
final MonetaryCurrency currency = feeCharges.getCurrency();
|
||||
this.feeChargesPortion = defaultToNullIfZero(getFeeChargesPortion(currency).plus(feeCharges).getAmount());
|
||||
this.penaltyChargesPortion = defaultToNullIfZero(getPenaltyChargesPortion(currency).plus(penaltyCharges).getAmount());
|
||||
}
|
||||
|
||||
public boolean isGreaterThan(final Money monetaryAmount) {
|
||||
return getAmount(monetaryAmount.getCurrency()).isGreaterThan(monetaryAmount);
|
||||
}
|
||||
|
||||
public boolean isGreaterThanZero(final MonetaryCurrency currency) {
|
||||
return getAmount(currency).isGreaterThanZero();
|
||||
}
|
||||
public void updateComponentsAndTotal(final Money principal, final Money interest, final Money feeCharges, final Money penaltyCharges) {
|
||||
updateComponents(principal, interest, feeCharges, penaltyCharges);
|
||||
|
||||
public boolean isNotZero(final MonetaryCurrency currency) {
|
||||
return !getAmount(currency).isZero();
|
||||
}
|
||||
|
||||
private BigDecimal defaultToNullIfZero(final BigDecimal value) {
|
||||
BigDecimal result = value;
|
||||
if (BigDecimal.ZERO.compareTo(value) == 0) {
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
final MonetaryCurrency currency = principal.getCurrency();
|
||||
this.amount = getPrincipalPortion(currency).plus(getInterestPortion(currency)).plus(getFeeChargesPortion(currency))
|
||||
.plus(getPenaltyChargesPortion(currency)).getAmount();
|
||||
}
|
||||
|
||||
public LoanTransactionData toData(final CurrencyData currencyData) {
|
||||
final EnumOptionData transactionType = LoanEnumerations.transactionType(this.typeOf);
|
||||
return new LoanTransactionData(this.getId(), transactionType, currencyData, getTransactionDate(),
|
||||
this.amount, this.principalPortion, this.interestPortion, this.feeChargesPortion, this.penaltyChargesPortion);
|
||||
}
|
||||
public Money getPrincipalPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.principalPortion);
|
||||
}
|
||||
|
||||
public Money getInterestPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.interestPortion);
|
||||
}
|
||||
|
||||
public Money getFeeChargesPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.feeChargesPortion);
|
||||
}
|
||||
|
||||
public Money getPenaltyChargesPortion(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.penaltyChargesPortion);
|
||||
}
|
||||
|
||||
public void resetDerivedComponents() {
|
||||
this.principalPortion = null;
|
||||
this.interestPortion = null;
|
||||
this.feeChargesPortion = null;
|
||||
this.penaltyChargesPortion = null;
|
||||
}
|
||||
|
||||
public boolean isGreaterThan(final Money monetaryAmount) {
|
||||
return getAmount(monetaryAmount.getCurrency()).isGreaterThan(monetaryAmount);
|
||||
}
|
||||
|
||||
public boolean isGreaterThanZero(final MonetaryCurrency currency) {
|
||||
return getAmount(currency).isGreaterThanZero();
|
||||
}
|
||||
|
||||
public boolean isNotZero(final MonetaryCurrency currency) {
|
||||
return !getAmount(currency).isZero();
|
||||
}
|
||||
|
||||
private BigDecimal defaultToNullIfZero(final BigDecimal value) {
|
||||
BigDecimal result = value;
|
||||
if (BigDecimal.ZERO.compareTo(value) == 0) {
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public LoanTransactionData toData(final CurrencyData currencyData) {
|
||||
final EnumOptionData transactionType = LoanEnumerations.transactionType(this.typeOf);
|
||||
return new LoanTransactionData(this.getId(), transactionType, currencyData, getTransactionDate(), this.amount,
|
||||
this.principalPortion, this.interestPortion, this.feeChargesPortion, this.penaltyChargesPortion);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.platform.api;
|
||||
package org.mifosplatform.portfolio.loanaccount.gaurantor.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
+3
-3
@@ -5,9 +5,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.mifosng.platform.exceptions.GroupNotFoundException;
|
||||
import org.mifosng.platform.group.domain.Group;
|
||||
import org.mifosng.platform.group.domain.GroupRepository;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.MonetaryCurrency;
|
||||
import org.mifosplatform.infrastructure.staff.domain.Staff;
|
||||
import org.mifosplatform.infrastructure.staff.domain.StaffRepository;
|
||||
@@ -19,6 +16,9 @@ import org.mifosplatform.portfolio.client.exception.ClientNotFoundException;
|
||||
import org.mifosplatform.portfolio.fund.domain.Fund;
|
||||
import org.mifosplatform.portfolio.fund.domain.FundRepository;
|
||||
import org.mifosplatform.portfolio.fund.exception.FundNotFoundException;
|
||||
import org.mifosplatform.portfolio.group.domain.Group;
|
||||
import org.mifosplatform.portfolio.group.domain.GroupRepository;
|
||||
import org.mifosplatform.portfolio.group.exception.GroupNotFoundException;
|
||||
import org.mifosplatform.portfolio.loanaccount.command.LoanApplicationCommand;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.DefaultLoanLifecycleStateMachine;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
||||
|
||||
+2
-2
@@ -7,8 +7,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.platform.api.data.GroupData;
|
||||
import org.mifosng.platform.group.service.GroupReadPlatformService;
|
||||
import org.mifosplatform.infrastructure.configuration.data.CurrencyData;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.ApplicationCurrency;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.ApplicationCurrencyRepository;
|
||||
@@ -21,6 +19,8 @@ import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSourc
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.group.data.GroupData;
|
||||
import org.mifosplatform.portfolio.group.service.GroupReadPlatformService;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.DisbursementData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanBasicDetailsData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanChargeData;
|
||||
|
||||
+1
-4
@@ -1,13 +1,10 @@
|
||||
package org.mifosplatform.portfolio.loanproduct.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the bare minimum repayment details needed for activities related
|
||||
* to generating repayment schedules.
|
||||
*/
|
||||
public interface LoanProductMinimumRepaymentScheduleRelatedDetail extends Serializable {
|
||||
public interface LoanProductMinimumRepaymentScheduleRelatedDetail {
|
||||
|
||||
Integer getRepayEvery();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user