From 80dfd752d751e66aee212c215f8a77fe01d3512d Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Tue, 4 Nov 2014 16:03:21 +0530 Subject: [PATCH] issues with latest sql patch name, removing few deprecated statement calls and other warnings --- .../portfolio/loanaccount/domain/Loan.java | 2 +- .../domain/LoanDisbursementDetails.java | 5 +- .../LoanInterestRecalculationDetails.java | 1 - .../domain/LoanRepaymentScheduleHistory.java | 14 -- ...heduleRequestWritePlatformServiceImpl.java | 2 +- .../service/LoanReadPlatformService.java | 1 - ...WritePlatformServiceJpaRepositoryImpl.java | 208 ++++++++---------- ...ll_report_names_in_m_permission_table.sql} | 0 8 files changed, 95 insertions(+), 138 deletions(-) rename mifosng-provider/src/main/resources/sql/migrations/core_db/{V209_add_all_report_names_in_m_permission_table.sql => V209__add_all_report_names_in_m_permission_table.sql} (100%) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java index dfb64d2e4..3a04c88b0 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java @@ -4599,7 +4599,7 @@ public class Loan extends AbstractPersistable { **/ public List getDisbursmentData() { Iterator iterator = this.getDisbursementDetails().iterator(); - List disbursementData = new ArrayList(); + List disbursementData = new ArrayList<>(); while (iterator.hasNext()) { LoanDisbursementDetails loanDisbursementDetails = iterator.next(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanDisbursementDetails.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanDisbursementDetails.java index 10d5e6d7e..697dea93b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanDisbursementDetails.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanDisbursementDetails.java @@ -24,7 +24,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_loan_disbursement_detail") public class LoanDisbursementDetails extends AbstractPersistable { - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "loan_id", nullable = false) private Loan loan; @@ -93,9 +92,9 @@ public class LoanDisbursementDetails extends AbstractPersistable { public BigDecimal principal() { return this.principal; } - + public BigDecimal approvedPrincipal() { - return this.approvedPrincipal; + return this.approvedPrincipal; } public void updatePrincipal(BigDecimal principal) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanInterestRecalculationDetails.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanInterestRecalculationDetails.java index 23df5b6ea..b69da3a4f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanInterestRecalculationDetails.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanInterestRecalculationDetails.java @@ -35,7 +35,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_loan_recalculation_details") public class LoanInterestRecalculationDetails extends AbstractPersistable { - @SuppressWarnings("unused") @OneToOne @JoinColumn(name = "loan_id", nullable = false) private Loan loan; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanRepaymentScheduleHistory.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanRepaymentScheduleHistory.java index 5feb68751..41e64f5bb 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanRepaymentScheduleHistory.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanRepaymentScheduleHistory.java @@ -26,68 +26,54 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_loan_repayment_schedule_history") public class LoanRepaymentScheduleHistory extends AbstractPersistable { - @SuppressWarnings("unused") @ManyToOne(optional = false) @JoinColumn(name = "loan_id") private Loan loan; - @SuppressWarnings("unused") @OneToOne(optional = true) @JoinColumn(name = "loan_reschedule_request_id") private LoanRescheduleRequest loanRescheduleRequest; - @SuppressWarnings("unused") @Column(name = "installment", nullable = false) private Integer installmentNumber; - @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "fromdate", nullable = true) private Date fromDate; - @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "duedate", nullable = false) private Date dueDate; - @SuppressWarnings("unused") @Column(name = "principal_amount", scale = 6, precision = 19, nullable = true) private BigDecimal principal; - @SuppressWarnings("unused") @Column(name = "interest_amount", scale = 6, precision = 19, nullable = true) private BigDecimal interestCharged; - @SuppressWarnings("unused") @Column(name = "fee_charges_amount", scale = 6, precision = 19, nullable = true) private BigDecimal feeChargesCharged; - @SuppressWarnings("unused") @Column(name = "penalty_charges_amount", scale = 6, precision = 19, nullable = true) private BigDecimal penaltyCharges; - @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "created_date") private Date createdOnDate; - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "createdby_id") private AppUser createdByUser; - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "lastmodifiedby_id") private AppUser lastModifiedByUser; - @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "lastmodified_date") private Date lastModifiedOnDate; @Column(name = "version") - @SuppressWarnings("unused") private Integer version; /** diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java index 7daa37b11..2fa8cfe53 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java @@ -250,7 +250,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche this.loanRescheduleRequestDataValidator.validateForApproveAction(jsonCommand, loanRescheduleRequest); final AppUser appUser = this.platformSecurityContext.authenticatedUser(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); LocalDate approvedOnDate = jsonCommand.localDateValueOfParameterNamed("approvedOnDate"); final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat()).withLocale( diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformService.java index 31a70dcb7..b05c03e1c 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformService.java @@ -18,7 +18,6 @@ import org.mifosplatform.portfolio.loanaccount.data.LoanScheduleAccrualData; import org.mifosplatform.portfolio.loanaccount.data.LoanTermVariationsData; import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData; import org.mifosplatform.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData; -import org.mifosplatform.portfolio.loanaccount.domain.LoanTransactionType; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanScheduleData; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java index 3b81af00a..f1a4d8072 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java @@ -55,7 +55,6 @@ import org.mifosplatform.portfolio.account.service.AccountTransfersReadPlatformS import org.mifosplatform.portfolio.charge.domain.Charge; import org.mifosplatform.portfolio.charge.domain.ChargeRepositoryWrapper; import org.mifosplatform.portfolio.client.domain.Client; -import org.mifosplatform.portfolio.client.exception.ClientHasNoStaffException; import org.mifosplatform.portfolio.client.exception.ClientNotActiveException; import org.mifosplatform.portfolio.group.domain.Group; import org.mifosplatform.portfolio.group.exception.GroupNotActiveException; @@ -133,8 +132,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final HolidayWritePlatformService holidayWritePlatformService, final WorkingDaysWritePlatformService workingDaysWritePlatformService, final SavingsAccountDataValidator fromApiJsonDeserializer, final SavingsAccountRepositoryWrapper savingsRepository, - final StaffRepositoryWrapper staffRepository, - final ConfigurationDomainService configurationDomainService) { + final StaffRepositoryWrapper staffRepository, final ConfigurationDomainService configurationDomainService) { this.context = context; this.savingAccountRepository = savingAccountRepository; this.savingsAccountTransactionRepository = savingsAccountTransactionRepository; @@ -196,12 +194,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public void processPostActiveActions(final SavingsAccount account, final DateTimeFormatter fmt, final Set existingTransactionIds, final Set existingReversedTransactionIds) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + Money amountForDeposit = account.activateWithBalance(); boolean isRegularTransaction = false; if (amountForDeposit.isGreaterThanZero()) { @@ -210,8 +207,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi null, isAccountTransfer, isRegularTransaction); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); } - account.processAccountUponActivation(isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.processAccountUponActivation(isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); account.validateAccountBalanceDoesNotBecomeNegative(SavingsAccountTransactionType.PAY_CHARGE.name()); } @@ -315,11 +311,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Transactional @Override public CommandProcessingResult calculateInterest(final Long savingsId) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); checkClientOrGroupActive(account); @@ -327,9 +322,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final LocalDate today = DateUtils.getLocalDateOfTenant(); final MathContext mc = new MathContext(15, RoundingMode.HALF_EVEN); boolean isInterestTransfer = false; - account.calculateInterestUsing(mc, today, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); this.savingAccountRepository.save(account); @@ -360,11 +354,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Transactional private void postInterest(final SavingsAccount account) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); if (account.getNominalAnnualInterestRate().compareTo(BigDecimal.ZERO) == 1) { final Set existingTransactionIds = new HashSet<>(); @@ -373,8 +366,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final LocalDate today = DateUtils.getLocalDateOfTenant(); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); boolean isInterestTransfer = false; - account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); // for generating transaction id's List transactions = account.getTransactions(); @@ -404,12 +396,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public CommandProcessingResult undoTransaction(final Long savingsId, final Long transactionId, final boolean allowAccountTransferModification) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); final Set existingTransactionIds = new HashSet<>(); final Set existingReversedTransactionIds = new HashSet<>(); @@ -449,12 +440,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi checkClientOrGroupActive(account); if (savingsAccountTransaction.isPostInterestCalculationRequired() && account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) { - account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); } else { - account.calculateInterestUsing(mc, today, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); } account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.undoTransactionAction); account.activateAccountBasedOnBalance(); @@ -471,11 +460,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public CommandProcessingResult adjustSavingsTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(transactionId, savingsId); @@ -533,12 +521,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi if (account.isBeforeLastPostingPeriod(transactionDate) || account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) { - account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); } else { - account.calculateInterestUsing(mc, today, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); } account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.adjustTransactionAction); account.activateAccountBasedOnBalance(); @@ -638,12 +624,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final Set existingTransactionIds = new HashSet<>(); @@ -656,9 +641,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi savingsAccount.setStatus(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue()); final MathContext mc = MathContext.DECIMAL64; boolean isInterestTransfer = false; - savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); this.savingsAccountTransactionRepository.save(newTransferTransaction); this.savingAccountRepository.save(savingsAccount); @@ -670,12 +654,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final Set existingTransactionIds = new HashSet<>(); @@ -688,9 +671,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi savingsAccount.setStatus(SavingsAccountStatusType.ACTIVE.getValue()); final MathContext mc = MathContext.DECIMAL64; boolean isInterestTransfer = false; - savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); this.savingsAccountTransactionRepository.save(withdrawtransferTransaction); this.savingAccountRepository.save(savingsAccount); @@ -710,12 +692,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Override public SavingsAccountTransaction acceptSavingsTransfer(final Long accountId, final LocalDate transferDate, final Office acceptedInOffice, final Staff fieldOfficer) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final Set existingTransactionIds = new HashSet<>(); @@ -731,9 +712,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } boolean isInterestTransfer = false; final MathContext mc = MathContext.DECIMAL64; - savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); this.savingsAccountTransactionRepository.save(acceptTransferTransaction); this.savingAccountRepository.save(savingsAccount); @@ -857,11 +837,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId) { this.context.authenticatedUser(); - + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection( savingsAccountChargeId, savingsAccountId); @@ -879,13 +858,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final MathContext mc = MathContext.DECIMAL64; if (account.isBeforeLastPostingPeriod(savingsAccountCharge.getDueLocalDate())) { final LocalDate today = DateUtils.getLocalDateOfTenant(); - account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); } else { final LocalDate today = DateUtils.getLocalDateOfTenant(); - account.calculateInterestUsing(mc, today, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); } account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.waiveChargeTransactionAction); @@ -987,12 +964,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Transactional private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid, final DateTimeFormatter formatter) { - - final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService - .isSavingsInterestPostingAtCurrentPeriodEnd(); - final Integer financialYearBeginningMonth = this.configurationDomainService - .retrieveFinancialYearBeginningMonth(); - + + final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService + .isSavingsInterestPostingAtCurrentPeriodEnd(); + final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth(); + // Get Savings account from savings charge final SavingsAccount account = savingsAccountCharge.savingsAccount(); this.savingAccountAssembler.assignSavingAccountHelpers(account); @@ -1004,13 +980,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final MathContext mc = MathContext.DECIMAL64; if (account.isBeforeLastPostingPeriod(transactionDate)) { final LocalDate today = DateUtils.getLocalDateOfTenant(); - account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth); } else { final LocalDate today = DateUtils.getLocalDateOfTenant(); - account.calculateInterestUsing(mc, today, isInterestTransfer, - isSavingsInterestPostingAtCurrentPeriodEnd, - financialYearBeginningMonth); + account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, + financialYearBeginningMonth); } account.validateAccountBalanceDoesNotBecomeNegative("." + SavingsAccountTransactionType.PAY_CHARGE.getCode()); @@ -1119,23 +1093,23 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final Long fromSavingsOfficerId = command.longValueOfParameterNamed("fromSavingsOfficerId"); final Long toSavingsOfficerId = command.longValueOfParameterNamed("toSavingsOfficerId"); final LocalDate dateOfSavingsOfficerAssignment = command.localDateValueOfParameterNamed("assignmentDate"); - - if(fromSavingsOfficerId != null) - { - fromSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(fromSavingsOfficerId, savingsForUpdate.office().getHierarchy()); - } - if(toSavingsOfficerId != null) - { - toSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(toSavingsOfficerId, savingsForUpdate.office().getHierarchy()); - } - if (!savingsForUpdate.hasSavingsOfficer(fromSavingsOfficer)) { throw new SavingsOfficerAssignmentException(savingsAccountId, fromSavingsOfficerId); } - savingsForUpdate.reassignSavingsOfficer(toSavingsOfficer,dateOfSavingsOfficerAssignment); + if (fromSavingsOfficerId != null) { + fromSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(fromSavingsOfficerId, savingsForUpdate + .office().getHierarchy()); + } + if (toSavingsOfficerId != null) { + toSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(toSavingsOfficerId, savingsForUpdate + .office().getHierarchy()); + actualChanges.put("toSavingsOfficerId", toSavingsOfficer.getId()); + } + if (!savingsForUpdate.hasSavingsOfficer(fromSavingsOfficer)) { throw new SavingsOfficerAssignmentException(savingsAccountId, + fromSavingsOfficerId); } + + savingsForUpdate.reassignSavingsOfficer(toSavingsOfficer, dateOfSavingsOfficerAssignment); this.savingsRepository.saveAndFlush(savingsForUpdate); - actualChanges.put("toSavingsOfficerId", toSavingsOfficer.getId()); - return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withOfficeId(savingsForUpdate.officeId()) // @@ -1148,29 +1122,29 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Transactional @Override public CommandProcessingResult unassignFieldOfficer(Long savingsAccountId, JsonCommand command) { - - this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap<>(5); - this.fromApiJsonDeserializer.validateForUnAssignSavingsOfficer(command.json()); - - final SavingsAccount savingsForUpdate = this.savingsRepository.findOneWithNotFoundDetection(savingsAccountId); + this.context.authenticatedUser(); + + final Map actualChanges = new LinkedHashMap<>(5); + this.fromApiJsonDeserializer.validateForUnAssignSavingsOfficer(command.json()); + + final SavingsAccount savingsForUpdate = this.savingsRepository.findOneWithNotFoundDetection(savingsAccountId); if (savingsForUpdate.getSavingsOfficer() == null) { throw new SavingsOfficerUnassignmentException(savingsAccountId); } final LocalDate dateOfSavingsOfficerUnassigned = command.localDateValueOfParameterNamed("unassignedDate"); - + savingsForUpdate.removeSavingsOfficer(dateOfSavingsOfficerUnassigned); this.savingsRepository.saveAndFlush(savingsForUpdate); actualChanges.put("toSavingsOfficerId", null); - + return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withOfficeId(savingsForUpdate.officeId()) // .withEntityId(savingsForUpdate.getId()) // .withSavingsId(savingsAccountId) // .with(actualChanges) // - .build(); - } + .build(); + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/resources/sql/migrations/core_db/V209_add_all_report_names_in_m_permission_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V209__add_all_report_names_in_m_permission_table.sql similarity index 100% rename from mifosng-provider/src/main/resources/sql/migrations/core_db/V209_add_all_report_names_in_m_permission_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V209__add_all_report_names_in_m_permission_table.sql