FIXING RETRIEVAL OF DELETED DEPOSIT PRODUCT
Remove per row audit for deposit product
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE `m_product_deposit`
|
||||||
|
DROP FOREIGN KEY FKJPX0000000000003,
|
||||||
|
DROP FOREIGN KEY FKJPX0000000000004,
|
||||||
|
DROP KEY FKJPW0000000000003,
|
||||||
|
DROP KEY FKJPW0000000000004,
|
||||||
|
DROP COLUMN createdby_id,
|
||||||
|
DROP COLUMN created_date,
|
||||||
|
DROP COLUMN lastmodified_date,
|
||||||
|
DROP COLUMN lastmodifiedby_id;
|
||||||
+5
-1
@@ -37,6 +37,7 @@ import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformServi
|
|||||||
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
||||||
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingsDepositEnumerations;
|
import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingsDepositEnumerations;
|
||||||
import org.mifosplatform.portfolio.savingsdepositproduct.data.DepositProductData;
|
import org.mifosplatform.portfolio.savingsdepositproduct.data.DepositProductData;
|
||||||
|
import org.mifosplatform.portfolio.savingsdepositproduct.exception.DepositProductNotFoundException;
|
||||||
import org.mifosplatform.portfolio.savingsdepositproduct.service.DepositProductReadPlatformService;
|
import org.mifosplatform.portfolio.savingsdepositproduct.service.DepositProductReadPlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -47,7 +48,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class DepositProductsApiResource {
|
public class DepositProductsApiResource {
|
||||||
|
|
||||||
private final Set<String> DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "externalId", "name", "description", "createdOn", "lastModifedOn",
|
private final Set<String> DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "externalId", "name", "description",
|
||||||
"currencyCode", "digitsAfterDecimal", "minimumBalance", "maximumBalance", "tenureInMonths", "maturityDefaultInterestRate", "maturityMinInterestRate",
|
"currencyCode", "digitsAfterDecimal", "minimumBalance", "maximumBalance", "tenureInMonths", "maturityDefaultInterestRate", "maturityMinInterestRate",
|
||||||
"maturityMaxInterestRate", "interestCompoundedEvery", "interestCompoundedEveryPeriodType", "renewalAllowed", "preClosureAllowed", "preClosureInterestRate",
|
"maturityMaxInterestRate", "interestCompoundedEvery", "interestCompoundedEveryPeriodType", "renewalAllowed", "preClosureAllowed", "preClosureInterestRate",
|
||||||
"interestCompoundingAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currency","currencyOptions", "interestCompoundedEveryPeriodTypeOptions"));
|
"interestCompoundingAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currency","currencyOptions", "interestCompoundedEveryPeriodTypeOptions"));
|
||||||
@@ -132,6 +133,9 @@ public class DepositProductsApiResource {
|
|||||||
|
|
||||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
DepositProductData productData = this.depositProductReadPlatformService.retrieveDepositProductData(productId);
|
DepositProductData productData = this.depositProductReadPlatformService.retrieveDepositProductData(productId);
|
||||||
|
if (productData.isDeleted()) {
|
||||||
|
throw new DepositProductNotFoundException(productId);
|
||||||
|
}
|
||||||
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
if (settings.isTemplate()) {
|
if (settings.isTemplate()) {
|
||||||
|
|||||||
+11
-20
@@ -10,7 +10,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
|
|
||||||
@@ -44,23 +43,19 @@ public class DepositProductData {
|
|||||||
private final Integer lockinPeriod;
|
private final Integer lockinPeriod;
|
||||||
private final EnumOptionData lockinPeriodType;
|
private final EnumOptionData lockinPeriodType;
|
||||||
|
|
||||||
private final DateTime createdOn;
|
|
||||||
private final DateTime lastModifedOn;
|
|
||||||
|
|
||||||
private final Collection<CurrencyData> currencyOptions;
|
private final Collection<CurrencyData> currencyOptions;
|
||||||
private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions;
|
private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions;
|
||||||
|
private final Boolean isDeleted;
|
||||||
|
|
||||||
public DepositProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String externalId,
|
public DepositProductData(final Long id, final String externalId,
|
||||||
final String name, final String description, final String currencyCode, final Integer digitsAfterDecimal,
|
final String name, final String description, final String currencyCode, final Integer digitsAfterDecimal,
|
||||||
final BigDecimal minimumBalance, final BigDecimal maximumBalance, final Integer tenureMonths,
|
final BigDecimal minimumBalance, final BigDecimal maximumBalance, final Integer tenureMonths,
|
||||||
final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate,
|
final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate,
|
||||||
final BigDecimal maturityMaxInterestRate, final Integer interestCompoundedEvery,
|
final BigDecimal maturityMaxInterestRate, final Integer interestCompoundedEvery,
|
||||||
final EnumOptionData interestCompoundedEveryPeriodType, final boolean renewalAllowed, final boolean preClosureAllowed,
|
final EnumOptionData interestCompoundedEveryPeriodType, final boolean renewalAllowed, final boolean preClosureAllowed,
|
||||||
final BigDecimal preClosureInterestRate, final boolean interestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
final BigDecimal preClosureInterestRate, final boolean interestCompoundingAllowed, final boolean isLockinPeriodAllowed,
|
||||||
final Integer lockinPeriod, final EnumOptionData lockinPeriodType,final CurrencyData currencyData) {
|
final Integer lockinPeriod, final EnumOptionData lockinPeriodType,final CurrencyData currencyData, final Boolean isDeleted) {
|
||||||
|
|
||||||
this.createdOn = createdOn;
|
|
||||||
this.lastModifedOn = lastModifedOn;
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -87,13 +82,12 @@ public class DepositProductData {
|
|||||||
this.currency = currencyData;
|
this.currency = currencyData;
|
||||||
this.currencyOptions = null;
|
this.currencyOptions = null;
|
||||||
this.interestCompoundedEveryPeriodTypeOptions = null;
|
this.interestCompoundedEveryPeriodTypeOptions = null;
|
||||||
|
this.isDeleted = isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DepositProductData(final Collection<CurrencyData> currencyOptions,
|
public DepositProductData(final Collection<CurrencyData> currencyOptions,
|
||||||
final EnumOptionData defaultInterestCompoundedEveryPeriodType,
|
final EnumOptionData defaultInterestCompoundedEveryPeriodType,
|
||||||
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
||||||
this.createdOn = null;
|
|
||||||
this.lastModifedOn = null;
|
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.externalId = null;
|
this.externalId = null;
|
||||||
this.name = null;
|
this.name = null;
|
||||||
@@ -123,12 +117,11 @@ public class DepositProductData {
|
|||||||
|
|
||||||
this.currencyOptions = currencyOptions;
|
this.currencyOptions = currencyOptions;
|
||||||
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
|
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
|
||||||
|
this.isDeleted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
|
public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
|
||||||
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
|
||||||
this.createdOn = product.getCreatedOn();
|
|
||||||
this.lastModifedOn = product.getLastModifedOn();
|
|
||||||
this.id = product.getId();
|
this.id = product.getId();
|
||||||
this.externalId = product.getExternalId();
|
this.externalId = product.getExternalId();
|
||||||
this.name = product.getName();
|
this.name = product.getName();
|
||||||
@@ -162,6 +155,8 @@ public class DepositProductData {
|
|||||||
} else {
|
} else {
|
||||||
this.currency = product.currency;
|
this.currency = product.currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isDeleted = product.isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
@@ -232,14 +227,6 @@ public class DepositProductData {
|
|||||||
return preClosureInterestRate;
|
return preClosureInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getCreatedOn() {
|
|
||||||
return createdOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime getLastModifedOn() {
|
|
||||||
return lastModifedOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<CurrencyData> getCurrencyOptions() {
|
public Collection<CurrencyData> getCurrencyOptions() {
|
||||||
return currencyOptions;
|
return currencyOptions;
|
||||||
}
|
}
|
||||||
@@ -264,4 +251,8 @@ public class DepositProductData {
|
|||||||
return lockinPeriodType;
|
return lockinPeriodType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isDeleted() {
|
||||||
|
return this.isDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-3
@@ -17,16 +17,15 @@ import javax.persistence.UniqueConstraint;
|
|||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
||||||
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
|
|
||||||
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
||||||
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
||||||
import org.mifosplatform.portfolio.savingsdepositproduct.exception.DepositProductValueOutsideRangeException;
|
import org.mifosplatform.portfolio.savingsdepositproduct.exception.DepositProductValueOutsideRangeException;
|
||||||
import org.mifosplatform.useradministration.domain.AppUser;
|
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "m_product_deposit", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "name_deposit_product"),
|
@Table(name = "m_product_deposit", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "name_deposit_product"),
|
||||||
@UniqueConstraint(columnNames = { "external_id" }, name = "externalid_deposit_product") })
|
@UniqueConstraint(columnNames = { "external_id" }, name = "externalid_deposit_product") })
|
||||||
public class DepositProduct extends AbstractAuditableCustom<AppUser, Long> {
|
public class DepositProduct extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@Column(name = "name", nullable = false)
|
@Column(name = "name", nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
+8
-10
@@ -11,7 +11,6 @@ import java.sql.SQLException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||||
@@ -78,13 +77,14 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
private static final class DepositProductMapper implements RowMapper<DepositProductData> {
|
private static final class DepositProductMapper implements RowMapper<DepositProductData> {
|
||||||
|
|
||||||
public String depositProductSchema() {
|
public String depositProductSchema() {
|
||||||
return " dp.id as id, dp.external_id as exernalId, dp.name as name, dp.description as description,dp.currency_code as currencyCode, dp.currency_digits as currencyDigits,dp.minimum_balance as minimumBalance,dp.maximum_balance as maximumBalance,"
|
return " dp.id as id, dp.external_id as exernalId, dp.name as name, dp.description as description,dp.currency_code as currencyCode, dp.currency_digits as currencyDigits, "
|
||||||
+ "dp.created_date as createdon, dp.lastmodified_date as modifiedon,dp.tenure_months as tenureMonths, "
|
+ "dp.minimum_balance as minimumBalance,dp.maximum_balance as maximumBalance, dp.tenure_months as tenureMonths, "
|
||||||
+ "dp.interest_compounded_every as interestCompoundedEvery, dp.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
|
+ "dp.interest_compounded_every as interestCompoundedEvery, dp.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
|
||||||
+ "dp.maturity_default_interest_rate as maturityDefaultInterestRate, dp.is_compounding_interest_allowed as interestCompoundingAllowed, "
|
+ "dp.maturity_default_interest_rate as maturityDefaultInterestRate, dp.is_compounding_interest_allowed as interestCompoundingAllowed, "
|
||||||
+ "dp.maturity_min_interest_rate as maturityMinInterestRate, dp.maturity_max_interest_rate as maturityMaxInterestRate, dp.is_renewal_allowed as canRenew, dp.is_preclosure_allowed as canPreClose, dp.pre_closure_interest_rate as preClosureInterestRate, "
|
+ "dp.maturity_min_interest_rate as maturityMinInterestRate, dp.maturity_max_interest_rate as maturityMaxInterestRate, "
|
||||||
|
+ "dp.is_renewal_allowed as canRenew, dp.is_preclosure_allowed as canPreClose, dp.pre_closure_interest_rate as preClosureInterestRate, "
|
||||||
+ "dp.is_lock_in_period_allowed as isLockinPeriodAllowed, dp.lock_in_period as lockinPeriod, dp.lock_in_period_type as lockinPeriodType, "
|
+ "dp.is_lock_in_period_allowed as isLockinPeriodAllowed, dp.lock_in_period as lockinPeriod, dp.lock_in_period_type as lockinPeriodType, "
|
||||||
+ "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol "
|
+ "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol, dp.is_deleted as isDeleted "
|
||||||
+ "from m_product_deposit dp join m_currency curr on curr.code = dp.currency_code ";
|
+ "from m_product_deposit dp join m_currency curr on curr.code = dp.currency_code ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,9 +103,6 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||||
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol, currencyNameCode);
|
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol, currencyNameCode);
|
||||||
|
|
||||||
DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
|
||||||
DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
|
||||||
|
|
||||||
BigDecimal minimumBalance = rs.getBigDecimal("minimumBalance");
|
BigDecimal minimumBalance = rs.getBigDecimal("minimumBalance");
|
||||||
BigDecimal maximumBalance = rs.getBigDecimal("maximumBalance");
|
BigDecimal maximumBalance = rs.getBigDecimal("maximumBalance");
|
||||||
|
|
||||||
@@ -129,11 +126,12 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead
|
|||||||
Integer lockinPeriod = JdbcSupport.getInteger(rs, "lockinPeriod");
|
Integer lockinPeriod = JdbcSupport.getInteger(rs, "lockinPeriod");
|
||||||
Integer lockinPeriodTypeValue = JdbcSupport.getInteger(rs, "lockinPeriodType");
|
Integer lockinPeriodTypeValue = JdbcSupport.getInteger(rs, "lockinPeriodType");
|
||||||
EnumOptionData lockinPeriodType = SavingsDepositEnumerations.interestCompoundingPeriodType(lockinPeriodTypeValue);
|
EnumOptionData lockinPeriodType = SavingsDepositEnumerations.interestCompoundingPeriodType(lockinPeriodTypeValue);
|
||||||
|
Boolean isDeleted = rs.getBoolean("isDeleted");
|
||||||
|
|
||||||
return new DepositProductData(createdOn, lastModifedOn, id, exernalId, name, description, currencyCode, currencyDigits,
|
return new DepositProductData(id, exernalId, name, description, currencyCode, currencyDigits,
|
||||||
minimumBalance, maximumBalance, tenureMonths, maturityDefaultInterestRate, maturityMinInterestRate,
|
minimumBalance, maximumBalance, tenureMonths, maturityDefaultInterestRate, maturityMinInterestRate,
|
||||||
maturityMaxInterestRate, interestCompoundedEvery, interestCompoundedEveryPeriodType, canRenew, canPreClose,
|
maturityMaxInterestRate, interestCompoundedEvery, interestCompoundedEveryPeriodType, canRenew, canPreClose,
|
||||||
preClosureInterestRate, interestCompoundingAllowed, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, currencyData);
|
preClosureInterestRate, interestCompoundingAllowed, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, currencyData,isDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user