remove unused warnings from savings code.

This commit is contained in:
Keith Woodlock
2012-11-01 16:30:57 +00:00
parent 75b8a0801d
commit ee63559abd
13 changed files with 78 additions and 186 deletions
@@ -26,7 +26,6 @@ import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.saving.service.SavingAccountReadPlatformService;
import org.mifosng.platform.saving.service.SavingAccountWritePlatformService;
import org.mifosng.platform.savingproduct.service.SavingProductReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -42,9 +41,6 @@ public class SavingsAccountApiResource {
@Autowired
private SavingAccountReadPlatformService savingAccountReadPlatformService;
@Autowired
private SavingProductReadPlatformService savingProductReadPlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@@ -116,6 +112,7 @@ public class SavingsAccountApiResource {
return this.apiJsonSerializerService.serializeSavingAccountsDataToJson(prettyPrint, responseParameters, account);
}
@SuppressWarnings("unused")
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@@ -131,9 +128,9 @@ public class SavingsAccountApiResource {
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
SavingAccountData account = this.savingAccountReadPlatformService.retrieveNewSavingsAccountDetails(clientId, productId);
SavingAccountData account = null;
// this.savingAccountReadPlatformService.retrieveNewSavingsAccountDetails(clientId, productId);
return this.apiJsonSerializerService.serializeSavingAccountsDataToJson(prettyPrint, responseParameters, account);
}
}
}
@@ -4,40 +4,76 @@ import java.math.BigDecimal;
import org.joda.time.LocalDate;
/**
* Immutable data object reprsenting a savings account.
*/
public class SavingAccountData {
@SuppressWarnings("unused")
private final Long id;
@SuppressWarnings("unused")
private final EnumOptionData status;
@SuppressWarnings("unused")
private final String externalId;
@SuppressWarnings("unused")
private final Long clientId;
@SuppressWarnings("unused")
private final String clientName;
@SuppressWarnings("unused")
private final Long productId;
@SuppressWarnings("unused")
private final String productName;
@SuppressWarnings("unused")
private final EnumOptionData productType;
@SuppressWarnings("unused")
private final CurrencyData currencyData;
@SuppressWarnings("unused")
private final BigDecimal savingsDepostiAmountPerPeriod;
@SuppressWarnings("unused")
private final EnumOptionData savingsFrequencyType;
@SuppressWarnings("unused")
private final BigDecimal totalDepositAmount;
@SuppressWarnings("unused")
private final BigDecimal reccuringInterestRate;
@SuppressWarnings("unused")
private final BigDecimal savingInterestRate;
@SuppressWarnings("unused")
private final EnumOptionData interestType;
@SuppressWarnings("unused")
private final EnumOptionData interestCalculationMethod;
@SuppressWarnings("unused")
private final Integer tenure;
@SuppressWarnings("unused")
private final EnumOptionData tenureType;
@SuppressWarnings("unused")
private final LocalDate projectedCommencementDate;
@SuppressWarnings("unused")
private final LocalDate actualCommencementDate;
@SuppressWarnings("unused")
private final LocalDate maturesOnDate;
@SuppressWarnings("unused")
private final BigDecimal projectedInterestAccuredOnMaturity;
@SuppressWarnings("unused")
private final BigDecimal actualInterestAccured;
@SuppressWarnings("unused")
private final BigDecimal projectedMaturityAmount;
@SuppressWarnings("unused")
private final BigDecimal actualMaturityAmount;
@SuppressWarnings("unused")
private final boolean preClosureAllowed;
private final BigDecimal preClosureInterestRate;
@SuppressWarnings("unused")
private final BigDecimal preClosureInterestRate;
@SuppressWarnings("unused")
private final LocalDate withdrawnonDate;
@SuppressWarnings("unused")
private final LocalDate rejectedonDate;
@SuppressWarnings("unused")
private final LocalDate closedonDate;
@SuppressWarnings("unused")
private final boolean isLockinPeriodAllowed;
@SuppressWarnings("unused")
private final Integer lockinPeriod;
@SuppressWarnings("unused")
private final EnumOptionData lockinPeriodType;
public SavingAccountData(Long id, EnumOptionData status, String externalId,
@@ -59,7 +95,6 @@ public class SavingAccountData {
LocalDate rejectedonDate, LocalDate closedonDate,
boolean isLockinPeriodAllowed, Integer lockinPeriod,
EnumOptionData lockinPeriodType) {
this.id = id;
this.status = status;
this.externalId = externalId;
@@ -93,139 +128,5 @@ public class SavingAccountData {
this.isLockinPeriodAllowed = isLockinPeriodAllowed;
this.lockinPeriod = lockinPeriod;
this.lockinPeriodType = lockinPeriodType;
}
public Long getId() {
return id;
}
public EnumOptionData getStatus() {
return status;
}
public String getExternalId() {
return externalId;
}
public Long getClientId() {
return clientId;
}
public String getClientName() {
return clientName;
}
public Long getProductId() {
return productId;
}
public String getProductName() {
return productName;
}
public EnumOptionData getProductType() {
return productType;
}
public CurrencyData getCurrencyData() {
return currencyData;
}
public BigDecimal getSavingsDepostiAmountPerPeriod() {
return savingsDepostiAmountPerPeriod;
}
public EnumOptionData getSavingsFrequencyType() {
return savingsFrequencyType;
}
public BigDecimal getTotalDepositAmount() {
return totalDepositAmount;
}
public BigDecimal getReccuringInterestRate() {
return reccuringInterestRate;
}
public BigDecimal getSavingInterestRate() {
return savingInterestRate;
}
public EnumOptionData getInterestType() {
return interestType;
}
public EnumOptionData getInterestCalculationMethod() {
return interestCalculationMethod;
}
public Integer getTenure() {
return tenure;
}
public EnumOptionData getTenureType() {
return tenureType;
}
public LocalDate getProjectedCommencementDate() {
return projectedCommencementDate;
}
public LocalDate getActualCommencementDate() {
return actualCommencementDate;
}
public LocalDate getMaturesOnDate() {
return maturesOnDate;
}
public BigDecimal getProjectedInterestAccuredOnMaturity() {
return projectedInterestAccuredOnMaturity;
}
public BigDecimal getActualInterestAccured() {
return actualInterestAccured;
}
public BigDecimal getProjectedMaturityAmount() {
return projectedMaturityAmount;
}
public BigDecimal getActualMaturityAmount() {
return actualMaturityAmount;
}
public boolean isPreClosureAllowed() {
return preClosureAllowed;
}
public BigDecimal getPreClosureInterestRate() {
return preClosureInterestRate;
}
public LocalDate getWithdrawnonDate() {
return withdrawnonDate;
}
public LocalDate getRejectedonDate() {
return rejectedonDate;
}
public LocalDate getClosedonDate() {
return closedonDate;
}
public boolean isLockinPeriodAllowed() {
return isLockinPeriodAllowed;
}
public Integer getLockinPeriod() {
return lockinPeriod;
}
public EnumOptionData getLockinPeriodType() {
return lockinPeriodType;
}
}
}
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
@Service
public class FixedTermDepositInterestCalculator {
// FIXME - MADHUKAR - Are the unused field here needed?
public Money calculateInterestOnMaturityFor(
final Money deposit,
final Integer tenureInMonths,
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
@Service
public class ReccuringDepositInterestCalculator {
// FIXME - MADHUKAR - Are the unused field here needed?
public Money calculateInterestOnMaturityFor(Money savingsDepositPerPeriod,
Integer tenure, BigDecimal reccuringInterestRate,
LocalDate commencementDate, TenureTypeEnum tenureTypeEnum,
@@ -72,5 +73,4 @@ public class ReccuringDepositInterestCalculator {
return Money.of(savingsDepositPerPeriod.getCurrency(), finalAmount);
}
}
}
@@ -39,18 +39,21 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
@JoinColumn(name = "product_id")
private SavingProduct product;
// FIXME - MADHUKAR - Do not use the actual enum type here but instead use Integer e.g. private Integer savingProductType;
@Column(name = "savings_product_type", nullable=false)
private SavingProductType savingProductType;
@Column(name = "external_id")
private String externalId;
@SuppressWarnings("unused")
@Embedded
private MonetaryCurrency currency;
@Column(name = "deposit_amount_per_period", scale = 6, precision = 19, nullable = false)
private BigDecimal savingsDepositAmountPerPeriod;
@SuppressWarnings("unused")
@Column(name = "total_deposit_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal totalSavingsAmount;
@@ -66,12 +69,15 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "tenure_type", nullable=false)
private TenureTypeEnum tenureType;
// FIXME - MADHUKAR - Do not use the actual enum type here but instead use Integer e.g. private Integer savingProductType;
@Column(name = "frequency", nullable=false)
private SavingFrequencyType frequency;
// FIXME - MADHUKAR - Do not use the actual enum type here but instead use Integer e.g. private Integer savingProductType;
@Column(name = "interest_type", nullable=false)
private SavingsInterestType interestType;
// FIXME - MADHUKAR - Do not use the actual enum type here but instead use Integer e.g. private Integer savingProductType;
@Column(name = "interest_calculation_method")
private SavingInterestCalculationMethod interestCalculationMethod;
@@ -79,23 +85,29 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "projected_commencement_date")
private Date projectedCommencementDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "actual_commencement_date")
private Date actualCommencementDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "matures_on_date")
private Date maturesOnDate;
@SuppressWarnings("unused")
@Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false)
private BigDecimal projectedInterestAccruedOnMaturity;
@SuppressWarnings("unused")
@Column(name = "actual_interest_accrued", scale = 6, precision = 19, nullable = false)
private BigDecimal interestAccrued;
@SuppressWarnings("unused")
@Column(name = "projected_total_maturity_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal projectedTotalOnMaturity;
@SuppressWarnings("unused")
@Column(name = "actual_total_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal total;
@@ -111,10 +123,12 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "status_enum", nullable = false)
private Integer accountStatus;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "closedon_date")
private Date closedOnDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "rejectedon_date")
private Date rejectedOnDate;
@@ -253,11 +267,12 @@ public class SavingAccount extends AbstractAuditableCustom<AppUser, Long> {
this.isLockinPeriodAllowed = isLockinPeriodAllowed;
this.lockinPeriod = lockinPeriod;
this.lockinPeriodType = lockinPeriodType;
// FIXME - MADHUKAR - futureValueOnMaturity is possibly null
this.projectedTotalOnMaturity = futureValueOnMaturity.getAmount();
this.projectedInterestAccruedOnMaturity =futureValueOnMaturity.getAmount().subtract(BigDecimal.valueOf(savingsDeposit.getAmount().doubleValue()*tenure.doubleValue()));
}
public boolean isDeleted() {
return this.deleted;
}
@@ -204,6 +204,4 @@ public class SavingAccountAssembler {
List<DepositAccountStatus> allowedDepositStatuses = Arrays.asList(DepositAccountStatus.values());
return new DepositLifecycleStateMachineImpl(allowedDepositStatuses);
}
}
}
@@ -9,7 +9,4 @@ public interface SavingAccountReadPlatformService {
Collection<SavingAccountData> retrieveAllSavingsAccounts();
SavingAccountData retrieveSavingsAccount(Long accountId);
SavingAccountData retrieveNewSavingsAccountDetails(Long clientId, Long productId);
}
@@ -9,11 +9,9 @@ import org.joda.time.LocalDate;
import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.data.SavingAccountData;
import org.mifosng.platform.client.service.ClientReadPlatformService;
import org.mifosng.platform.infrastructure.JdbcSupport;
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
import org.mifosng.platform.savingproduct.service.SavingProductEnumerations;
import org.mifosng.platform.savingproduct.service.SavingProductReadPlatformService;
import org.mifosng.platform.security.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -26,19 +24,20 @@ public class SavingAccountReadPlatformServiceImpl implements
private final PlatformSecurityContext context;
private final JdbcTemplate jdbcTemplate;
private final SavingProductReadPlatformService savingProductReadPlatformService;
private final ClientReadPlatformService clientReadPlatformService;
// private final SavingProductReadPlatformService savingProductReadPlatformService;
// private final ClientReadPlatformService clientReadPlatformService;
@Autowired
public SavingAccountReadPlatformServiceImpl(
final PlatformSecurityContext context,
final TenantAwareRoutingDataSource dataSource,
SavingProductReadPlatformService savingProductReadPlatformService,
final ClientReadPlatformService clientReadPlatformService ) {
final TenantAwareRoutingDataSource dataSource
// final SavingProductReadPlatformService savingProductReadPlatformService,
// final ClientReadPlatformService clientReadPlatformService
) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.savingProductReadPlatformService = savingProductReadPlatformService;
this.clientReadPlatformService = clientReadPlatformService;
// this.savingProductReadPlatformService = savingProductReadPlatformService;
// this.clientReadPlatformService = clientReadPlatformService;
}
@Override
@@ -61,13 +60,6 @@ public class SavingAccountReadPlatformServiceImpl implements
return savingAccountData;
}
@Override
public SavingAccountData retrieveNewSavingsAccountDetails(Long clientId,
Long productId) {
// TODO Auto-generated method stub
return null;
}
private static final class SavingAccountMapper implements RowMapper<SavingAccountData> {
public String schema() {
@@ -93,7 +85,7 @@ public class SavingAccountReadPlatformServiceImpl implements
}
@Override
public SavingAccountData mapRow(ResultSet rs, int rowNum) throws SQLException {
public SavingAccountData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Long id = rs.getLong("id");
String externalId = rs.getString("externalId");
@@ -153,8 +145,6 @@ public class SavingAccountReadPlatformServiceImpl implements
maturesOnDate,projectedInterestAccuredOnMaturity, actualInterestAccured,
projectedMaturityAmount, actualMaturityAmount, preClosureAllowed, preClosureInterestRate, withdrawnonDate,
rejectedonDate, closedonDate, isLockinPeriodAllowed, lockinPeriod, lockinPeriodType);
}
}
}
}
}
@@ -9,10 +9,6 @@ public interface SavingAccountWritePlatformService {
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
EntityIdentifier createSavingAccount(SavingAccountCommand command);
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
EntityIdentifier deleteSavingAccount(SavingAccountCommand command);
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
EntityIdentifier updateSavingAccount(SavingAccountCommand command);
}
}
@@ -55,12 +55,6 @@ public class SavingAccountWritePlatformServiceJpaRepositoryImpl implements Savin
}
@Override
public EntityIdentifier deleteSavingAccount(SavingAccountCommand command) {
return null;
}
@Override
public EntityIdentifier updateSavingAccount(SavingAccountCommand command) {
try {
@@ -29,6 +29,7 @@ public class DepositProduct extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "external_id", length=100)
private String externalId;
@SuppressWarnings("unused")
@Column(name = "description")
private String description;
@@ -19,9 +19,11 @@ public class SavingProductRelatedDetail {
@Column(name = "interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal interestRate;
@SuppressWarnings("unused")
@Column(name = "min_interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal minInterestRate;
@SuppressWarnings("unused")
@Column(name = "max_interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal maxInterestRate;
@@ -155,7 +155,7 @@ public class SavingProductReadPlatformServiceImpl implements
}
@Override
public SavingProductLookup mapRow(final ResultSet rs, final int rowNum)
public SavingProductLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
throws SQLException {
Long id = rs.getLong("id");