increase auto formatting comment line length from 80 to 120

This commit is contained in:
Michael Vorburger
2020-06-23 10:01:12 +02:00
committed by Michael Vorburger ⛑️
parent 9542e35702
commit c529fdf58c
541 changed files with 1995 additions and 3177 deletions
@@ -29,16 +29,13 @@ import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
/**
* Fineract main() application which launches Fineract in an embedded Tomcat
* HTTP (using Spring Boot).
* Fineract main() application which launches Fineract in an embedded Tomcat HTTP (using Spring Boot).
*
* The DataSource used is a to a "normal" external database (not use MariaDB4j).
* This DataSource can be configured with parameters, see
* {@link DataSourceProperties}.
* The DataSource used is a to a "normal" external database (not use MariaDB4j). This DataSource can be configured with
* parameters, see {@link DataSourceProperties}.
*
* You can easily launch this via Debug as Java Application in your IDE -
* without needing command line Gradle stuff, no need to build and deploy a WAR,
* remote attachment etc.
* You can easily launch this via Debug as Java Application in your IDE - without needing command line Gradle stuff, no
* need to build and deploy a WAR, remote attachment etc.
*
* It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Fineract! ;-)
*
@@ -45,8 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link FromApiJsonDeserializer} for
* {@link GuarantorCommand}'s.
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
*/
@Component
public final class AccrualAccountingDataValidator {
@@ -29,8 +29,7 @@ final class GLClosuresApiResourceSwagger {
}
/**
* TODO: describe where this belongs: {@link GLClosuresApiResource }
* {@Link GLClosuresApiResource}
* TODO: describe where this belongs: {@link GLClosuresApiResource } {@Link GLClosuresApiResource}
*/
// Check !!
@@ -26,8 +26,7 @@ import org.joda.time.LocalDate;
/**
* Immutable object representing a General Ledger Account
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
* Note: no getter/setters required as google-gson will produce json from fields of object.
*/
public class GLClosureData {
@@ -22,8 +22,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
import org.joda.time.LocalDate;
/**
* A {@link RuntimeException} thrown when a GL Closure for a given date and
* Office combination is already present
* A {@link RuntimeException} thrown when a GL Closure for a given date and Office combination is already present
*/
public class GLClosureDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.closure.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when GL account closure resources are not
* found.
* A {@link RuntimeException} thrown when GL account closure resources are not found.
*/
public class GLClosureNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -36,8 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link FromApiJsonDeserializer} for
* {@link GuarantorCommand}'s.
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
*/
@Component
public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLClosureCommand> {
@@ -124,8 +124,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
.orElseThrow(() -> new GLClosureNotFoundException(glClosureId));
/**
* check if any closures are present for this branch at a later date
* than this closure date
* check if any closures are present for this branch at a later date than this closure date
**/
final Date closureDate = glClosure.getClosingDate();
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(glClosure.getOffice().getId());
@@ -102,8 +102,7 @@ public class AccountingConstants {
}
/***
* Enum of all accounting related input parameter names used while
* creating/updating a loan product
* Enum of all accounting related input parameter names used while creating/updating a loan product
***/
public static enum LoanProductAccountingParams {
@@ -201,8 +200,7 @@ public class AccountingConstants {
}
/***
* Enum of all accounting related input parameter names used while
* creating/updating a savings product
* Enum of all accounting related input parameter names used while creating/updating a savings product
***/
public static enum SavingProductAccountingParams {
@@ -374,8 +372,7 @@ public class AccountingConstants {
}
/***
* Enum of all accounting related input parameter names used while
* creating/updating a savings product
* Enum of all accounting related input parameter names used while creating/updating a savings product
***/
public static enum SharesProductAccountingParams {
@@ -25,8 +25,7 @@ import org.springframework.stereotype.Service;
/**
* <p>
* Wrapper for {@link FinancialActivityAccountRepository} that adds NULL
* checking and Error handling capabilities
* Wrapper for {@link FinancialActivityAccountRepository} that adds NULL checking and Error handling capabilities
* </p>
*/
@Service
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.financialactivityaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
*/
public class DuplicateFinancialActivityAccountFoundException extends AbstractPlatformDomainRuleException {
@@ -23,8 +23,7 @@ import org.apache.fineract.accounting.glaccount.domain.GLAccount;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
*/
public class FinancialActivityAccountInvalidException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.financialactivityaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
*/
public class FinancialActivityAccountNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -89,8 +89,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
}
/**
* Validate that the GL Account is appropriate for the particular Financial
* Activity Type
* Validate that the GL Account is appropriate for the particular Financial Activity Type
**/
private void validateFinancialActivityAndAccountMapping(FinancialActivityAccount financialActivityAccount) {
FinancialActivity financialActivity = FinancialActivity.fromInt(financialActivityAccount.getFinancialActivityType());
@@ -30,8 +30,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
/**
* Immutable object representing a General Ledger Account
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
* Note: no getter/setters required as google-gson will produce json from fields of object.
*/
public class GLAccountData implements Serializable {
@@ -22,8 +22,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
/**
*
* when gl account is attached with any product(loan/saving) then we can not
* disable the gl account
* when gl account is attached with any product(loan/saving) then we can not disable the gl account
*/
public class GLAccountDisableException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of
* the particular type is already present
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of the particular type is already present
*/
public class GLAccountDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to
* an Invalid Usage Type
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to an Invalid Usage Type
*/
public class GLAccountInvalidClassificationException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of
* the particular type is already present
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of the particular type is already present
*/
public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when trying to map invalid parents to a GL
* account
* A {@link RuntimeException} thrown when trying to map invalid parents to a GL account
*/
public class GLAccountInvalidParentException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when an error is encountered during
* updating a GL Account
* A {@link RuntimeException} thrown when an error is encountered during updating a GL Account
*/
public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to
* an Invalid Type
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to an Invalid Type
*/
public class GLAccountInvalidUsageException extends AbstractPlatformDomainRuleException {
@@ -35,8 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link FromApiJsonDeserializer} for
* {@link GuarantorCommand}'s.
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
*/
@Component
public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLAccountCommand> {
@@ -151,8 +151,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
}
/**
* a detail account cannot be changed to a header account if
* transactions are already logged against it
* a detail account cannot be changed to a header account if transactions are already logged against it
**/
if (changesOnly.containsKey(GLAccountJsonInputParams.USAGE.getValue())) {
if (glAccount.isHeaderAccount()) {
@@ -28,8 +28,7 @@ import org.joda.time.LocalDate;
/**
* Immutable object representing a General Ledger Account
*
* Note: no getter/setters required as google will produce json from fields of
* object.
* Note: no getter/setters required as google will produce json from fields of object.
*/
public class JournalEntryData {
@@ -46,13 +46,11 @@ public interface JournalEntryRepository
* @Query("select journalEntry from JournalEntry journalEntry where glAccount.id= :accountId and transactionId= :transactionId and transactionDate= :transactionDate"
* +
* " and type= :journalEntryType and entityType=1 and entityId= :loanId and loanTransaction.id= :loanTransactionId"
* ) JournalEntry findLOANJournalEntryWith(@Param("accountId") Long
* accountId, @Param("transactionId") String transactionId,
* ) JournalEntry findLOANJournalEntryWith(@Param("accountId") Long accountId, @Param("transactionId") String
* transactionId,
*
* @Param("transactionDate") Date
* transactionDate, @Param("journalEntryType") Integer journalEntryType,
* @Param("transactionDate") Date transactionDate, @Param("journalEntryType") Integer journalEntryType,
*
* @Param("loanId") Long loanId, @Param("loanTransactionId") Long
* loanTransactionId);
* @Param("loanId") Long loanId, @Param("loanTransactionId") Long loanTransactionId);
*/
}
@@ -41,8 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link FromApiJsonDeserializer} for
* {@link JournalEntryCommand}'s.
* Implementation of {@link FromApiJsonDeserializer} for {@link JournalEntryCommand}'s.
*/
@Component
public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<JournalEntryCommand> {
@@ -34,9 +34,8 @@ public class AccountingProcessorForSavingsFactory {
}
/***
* Looks like overkill for now, but wanted to keep the savings side of
* accounting identical to that of Loans (would we need an Accrual based
* accounting in the future?)
* Looks like overkill for now, but wanted to keep the savings side of accounting identical to that of Loans (would
* we need an Accrual based accounting in the future?)
***/
public AccountingProcessorForSavings determineProcessor(final SavingsDTO savingsDTO) {
@@ -338,11 +338,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Accrual Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Accrual Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* @param accountTypeToBeDebited
@@ -372,11 +370,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Accrual Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Accrual Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* office
@@ -445,11 +441,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* @param accountTypeToBeDebited
@@ -480,11 +474,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* @param accountTypeToBeDebited
@@ -535,8 +527,7 @@ public class AccountingProcessorHelper {
*/
public void checkForBranchClosures(final GLClosure latestGLClosure, final Date transactionDate) {
/**
* check if an accounting closure has happened for this branch after the
* transaction Date
* check if an accounting closure has happened for this branch after the transaction Date
**/
if (latestGLClosure != null) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) {
@@ -573,11 +564,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* @param currencyCode
@@ -695,8 +684,7 @@ public class AccountingProcessorHelper {
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
final List<ChargePaymentDTO> chargePaymentDTOs) {
/***
* Map to track each account and the net credit to be made for a
* particular account
* Map to track each account and the net credit to be made for a particular account
***/
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) {
@@ -736,11 +724,9 @@ public class AccountingProcessorHelper {
}
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
* Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
*
* The target accounts for debits and credits are switched in case of a
* reversal
* The target accounts for debits and credits are switched in case of a reversal
*
* @param office
* office
@@ -775,10 +761,9 @@ public class AccountingProcessorHelper {
// TODO Vishwas: Remove this validation, as and when appropriate Junit
// tests are written for accounting
/**
* Accounting module currently supports a single charge per transaction,
* throw an error if this is not the case here so any developers
* changing the expected portfolio behavior would also take care of
* modifying the accounting code appropriately
* Accounting module currently supports a single charge per transaction, throw an error if this is not the case
* here so any developers changing the expected portfolio behavior would also take care of modifying the
* accounting code appropriately
**/
if (chargePaymentDTOs.size() != 1) {
throw new PlatformDataIntegrityException("Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code",
@@ -1124,9 +1109,8 @@ public class AccountingProcessorHelper {
PortfolioProductType.LOAN.getValue(), accountMappingTypeId);
/****
* Get more specific mapping for FUND source accounts (based on
* payment channels). Note that fund source placeholder ID would be
* same for both cash and accrual accounts
* Get more specific mapping for FUND source accounts (based on payment channels). Note that fund source
* placeholder ID would be same for both cash and accrual accounts
***/
if (accountMappingTypeId == CashAccountsForLoan.FUND_SOURCE.getValue()) {
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
@@ -1150,10 +1134,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(loanProductId,
PortfolioProductType.LOAN.getValue(), accountMappingTypeId);
/*****
* Get more specific mappings for Charges and penalties (based on the
* actual charge /penalty coupled with the loan product). Note the
* income from fees and income from penalties placeholder ID would be
* the same for both cash and accrual based accounts
* Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* cash and accrual based accounts
*****/
// Vishwas TODO: remove this condition as it should always be true
@@ -1174,10 +1157,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId,
PortfolioProductType.SAVING.getValue(), accountMappingTypeId);
/*****
* Get more specific mappings for Charges and penalties (based on the
* actual charge /penalty coupled with the loan product). Note the
* income from fees and income from penalties placeholder ID would be
* the same for both cash and accrual based accounts
* Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* cash and accrual based accounts
*****/
// Vishwas TODO: remove this condition as it should always be true
@@ -1204,9 +1186,8 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId,
PortfolioProductType.SAVING.getValue(), accountMappingTypeId);
/****
* Get more specific mapping for FUND source accounts (based on
* payment channels). Note that fund source placeholder ID would be
* same for both cash and accrual accounts
* Get more specific mapping for FUND source accounts (based on payment channels). Note that fund source
* placeholder ID would be same for both cash and accrual accounts
***/
if (accountMappingTypeId == CashAccountsForSavings.SAVINGS_REFERENCE.getValue()) {
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
@@ -1249,10 +1230,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(shareProductId,
PortfolioProductType.SHARES.getValue(), accountMappingTypeId);
/*****
* Get more specific mappings for Charges and penalties (based on the
* actual charge /penalty coupled with the loan product). Note the
* income from fees and income from penalties placeholder ID would be
* the same for both cash and accrual based accounts
* Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* cash and accrual based accounts
*****/
final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository
@@ -1276,8 +1256,7 @@ public class AccountingProcessorHelper {
final Long clientId, final Long transactionId, final Date transactionDate, final Boolean isReversal,
final List<ClientChargePaymentDTO> clientChargePaymentDTOs) {
/***
* Map to track each account affected and the net credit to be made for
* a particular account
* Map to track each account affected and the net credit to be made for a particular account
***/
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
for (final ClientChargePaymentDTO clientChargePaymentDTO : clientChargePaymentDTOs) {
@@ -65,8 +65,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
}
/***
* Handle repayments, repayments at disbursement and reversal of
* Repayments and Repayments at disbursement
* Handle repayments, repayments at disbursement and reversal of Repayments and Repayments at disbursement
***/
else if (loanTransactionDTO.getTransactionType().isRepayment()
|| loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement()
@@ -144,35 +143,27 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* <br/>
* <br/>
*
* <b>Principal Repayment</b>: Debits "Fund Source" and Credits "Loan
* Portfolio"<br/>
* <b>Principal Repayment</b>: Debits "Fund Source" and Credits "Loan Portfolio"<br/>
*
* <b>Interest Repayment</b>:Debits "Fund Source" and and Credits
* "Receivable Interest" <br/>
* <b>Interest Repayment</b>:Debits "Fund Source" and and Credits "Receivable Interest" <br/>
*
* <b>Fee Repayment</b>:Debits "Fund Source" (or "Interest on Loans" in case
* of repayment at disbursement) and and Credits "Receivable Fees" <br/>
* <b>Fee Repayment</b>:Debits "Fund Source" (or "Interest on Loans" in case of repayment at disbursement) and and
* Credits "Receivable Fees" <br/>
*
* <b>Penalty Repayment</b>: Debits "Fund Source" and and Credits
* "Receivable Penalties" <br/>
* <b>Penalty Repayment</b>: Debits "Fund Source" and and Credits "Receivable Penalties" <br/>
* <br/>
* Handles write offs using the following posting rules <br/>
* <br/>
* <b>Principal Write off</b>: Debits "Losses Written Off" and Credits "Loan
* Portfolio"<br/>
* <b>Principal Write off</b>: Debits "Losses Written Off" and Credits "Loan Portfolio"<br/>
*
* <b>Interest Write off</b>:Debits "Losses Written off" and and Credits
* "Receivable Interest" <br/>
* <b>Interest Write off</b>:Debits "Losses Written off" and and Credits "Receivable Interest" <br/>
*
* <b>Fee Write off</b>:Debits "Losses Written off" and and Credits
* "Receivable Fees" <br/>
* <b>Fee Write off</b>:Debits "Losses Written off" and and Credits "Receivable Fees" <br/>
*
* <b>Penalty Write off</b>: Debits "Losses Written off" and and Credits
* "Receivable Penalties" <br/>
* <b>Penalty Write off</b>: Debits "Losses Written off" and and Credits "Receivable Penalties" <br/>
* <br/>
* <br/>
* In case the loan transaction has been reversed, all debits are turned
* into credits and vice versa
* In case the loan transaction has been reversed, all debits are turned into credits and vice versa
*
* @param loanTransactionDTO
* @param loanDTO
@@ -289,8 +280,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
}
/**
* Single DEBIT transaction for write-offs or Repayments (and their
* reversals)
* Single DEBIT transaction for write-offs or Repayments (and their reversals)
***/
if (!(totalDebitAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (writeOff) {
@@ -315,11 +305,9 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
}
/**
* Create a single Debit to fund source and a single credit to "Income from
* Recovery"
* Create a single Debit to fund source and a single credit to "Income from Recovery"
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
* In case the loan transaction is a reversal, all debits are turned into credits and vice versa
*/
private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) {
@@ -345,11 +333,9 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* Recognize the receivable interest <br/>
* Debit "Interest Receivable" and Credit "Income from Interest"
*
* <b>Fees:</b> Debit <i>Fees Receivable</i> and credit <i>Income from
* Fees</i> <br/>
* <b>Fees:</b> Debit <i>Fees Receivable</i> and credit <i>Income from Fees</i> <br/>
*
* <b>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income
* from Penalties</i>
* <b>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income from Penalties</i>
*
* Also handles reversals for both fees and payment applications
*
@@ -52,11 +52,10 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
}
/**
* Create a single debit to fund source and multiple credits for the income
* account mapped with each charge this payment pays off
* Create a single debit to fund source and multiple credits for the income account mapped with each charge this
* payment pays off
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
* In case the loan transaction is a reversal, all debits are turned into credits and vice versa
*/
private void createJournalEntriesForChargePayments(final ClientTransactionDTO clientTransactionDTO, final Office office) {
// client properties
@@ -74,9 +73,8 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
transactionId, transactionDate, isReversal, clientTransactionDTO.getChargePayments());
/***
* create a single Debit entry (or reversal) for the entire amount
* that was credited (accounting is turned on at the level of for
* each charge that has been paid by this transaction)
* create a single Debit entry (or reversal) for the entire amount that was credited (accounting is turned
* on at the level of for each charge that has been paid by this transaction)
**/
this.helper.createDebitJournalEntryOrReversalForClientChargePayments(office, currencyCode, clientId, transactionId,
transactionDate, totalCreditedAmount, isReversal);
@@ -63,8 +63,8 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
createJournalEntriesForDisbursements(loanDTO, loanTransactionDTO, office);
}
/***
* Logic for repayments, repayments at disbursement and reversal of
* Repayments and Repayments at disbursement
* Logic for repayments, repayments at disbursement and reversal of Repayments and Repayments at
* disbursement
***/
else if (loanTransactionDTO.getTransactionType().isRepayment()
|| loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement()
@@ -82,9 +82,8 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
createJournalEntriesForRefund(loanDTO, loanTransactionDTO, office);
}
/***
* Only principal write off affects cash based accounting (interest
* and fee write off need not be considered). Debit losses written
* off and credit Loan Portfolio
* Only principal write off affects cash based accounting (interest and fee write off need not be
* considered). Debit losses written off and credit Loan Portfolio
**/
else if (loanTransactionDTO.getTransactionType().isWriteOff()) {
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
@@ -109,8 +108,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/>
*
* All debits are turned into credits and vice versa in case of disbursement
* reversals
* All debits are turned into credits and vice versa in case of disbursement reversals
*
*
* @param loanDTO
@@ -149,8 +147,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/>
*
* All debits are turned into credits and vice versa in case of disbursement
* reversals
* All debits are turned into credits and vice versa in case of disbursement reversals
*
*
* @param loanDTO
@@ -182,13 +179,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
}
/**
* Create a single Debit to fund source and multiple credits if applicable
* (loan portfolio for principal repayments, Interest on loans for interest
* repayments, Income from fees for fees payment and Income from penalties
* for penalty payment)
* Create a single Debit to fund source and multiple credits if applicable (loan portfolio for principal repayments,
* Interest on loans for interest repayments, Income from fees for fees payment and Income from penalties for
* penalty payment)
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
* In case the loan transaction is a reversal, all debits are turned into credits and vice versa
*/
private void createJournalEntriesForRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) {
@@ -256,11 +251,9 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
}
/**
* Create a single Debit to fund source and a single credit to "Income from
* Recovery"
* Create a single Debit to fund source and a single credit to "Income from Recovery"
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
* In case the loan transaction is a reversal, all debits are turned into credits and vice versa
*/
private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) {
@@ -283,12 +276,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
}
/**
* Credit loan Portfolio and Debit Suspense Account for a Transfer
* Initiation. A Transfer acceptance would be treated the opposite i.e Debit
* Loan Portfolio and Credit Suspense Account <br/>
* Credit loan Portfolio and Debit Suspense Account for a Transfer Initiation. A Transfer acceptance would be
* treated the opposite i.e Debit Loan Portfolio and Credit Suspense Account <br/>
*
* All debits are turned into credits and vice versa in case of Transfer
* Initiation disbursals
* All debits are turned into credits and vice versa in case of Transfer Initiation disbursals
*
*
* @param loanDTO
@@ -146,8 +146,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
}
/**
* Handle Interest Applications and reversals of Interest
* Applications
* Handle Interest Applications and reversals of Interest Applications
**/
else if (savingsTransactionDTO.getTransactionType().isInterestPosting() && savingsTransactionDTO.isOverdraftTransaction()) {
// Post journal entry if earned interest amount is greater than
@@ -226,8 +226,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
private void validateDebitOrCreditArrayForExistingGLAccount(final GLAccount glaccount,
final SingleDebitOrCreditEntryCommand[] creditOrDebits) {
/**
* If a glaccount is assigned for a rule the credits or debits array
* should have only one entry and it must be same as existing account
* If a glaccount is assigned for a rule the credits or debits array should have only one entry and it must be
* same as existing account
*/
if (creditOrDebits.length != 1) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null);
@@ -305,8 +305,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
private void validateGLAccountForTransaction(final GLAccount creditOrDebitAccountHead) {
/***
* validate that the account allows manual adjustments and is not
* disabled
* validate that the account allows manual adjustments and is not disabled
**/
if (creditOrDebitAccountHead.isDisabled()) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_DISABLED, null,
@@ -644,8 +643,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
}
/**
* TODO: Need a better implementation with guaranteed uniqueness (but not a
* long UUID)...maybe something tied to system clock..
* TODO: Need a better implementation with guaranteed uniqueness (but not a long UUID)...maybe something tied to
* system clock..
*/
private String generateTransactionId(final Long officeId) {
final AppUser user = this.context.authenticatedUser();
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.producttoaccountmapping.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
*/
public class ProductToGLAccountMappingInvalidException extends AbstractPlatformDomainRuleException {
@@ -22,8 +22,7 @@ import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioPr
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not
* found.
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
*/
public class ProductToGLAccountMappingNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -47,25 +47,21 @@ import org.springframework.stereotype.Component;
/**
* TODO Vishwas find a better approach for validation
*
* Currently, validation of the passed in JSON is done before calling save or
* update method on the target resource (in our case the loan Product)
* Currently, validation of the passed in JSON is done before calling save or update method on the target resource (in
* our case the loan Product)
*
* However, in the case of a loan product it would be difficult to validate the
* passed in JSON for valid {@link LoanProduct} to {@link GLAccount} mappings
* during update because of the following scenario
* However, in the case of a loan product it would be difficult to validate the passed in JSON for valid
* {@link LoanProduct} to {@link GLAccount} mappings during update because of the following scenario
*
* The accounting rule type may be changed in the update command, so we would
* have to validate if all required account heads for a particular account type
* have been passed in (would be different for CASH and Accrual based). However,
* till we have access to the domain object it would not be possible to detect
* if an accounting rule has actually been changed
* The accounting rule type may be changed in the update command, so we would have to validate if all required account
* heads for a particular account type have been passed in (would be different for CASH and Accrual based). However,
* till we have access to the domain object it would not be possible to detect if an accounting rule has actually been
* changed
*
* Hence, method {@link #validateForLoanProductCreate(String)} from this class
* is called separately for validation only if an accounting rule change is
* detected by {@link ProductToGLAccountMappingWritePlatformService}
* Hence, method {@link #validateForLoanProductCreate(String)} from this class is called separately for validation only
* if an accounting rule change is detected by {@link ProductToGLAccountMappingWritePlatformService}
*
* Also, the class is probably named wrong (*FromApiJsonDeserializer) should
* probably be named as (*Validator) instead
* Also, the class is probably named wrong (*FromApiJsonDeserializer) should probably be named as (*Validator) instead
*
*/
@Component
@@ -212,8 +212,7 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
}
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
* Examines and updates each account mapping for given loan product with changes passed in from the Json element
*
* @param loanProductId
* @param changes
@@ -127,8 +127,8 @@ public class ProductToGLAccountMappingHelper {
}
/**
* Saves the payment type to Fund source mappings for a particular
* product/product type (also populates the changes array if passed in)
* Saves the payment type to Fund source mappings for a particular product/product type (also populates the changes
* array if passed in)
*
* @param command
* @param element
@@ -154,8 +154,8 @@ public class ProductToGLAccountMappingHelper {
}
/**
* Saves the Charge to Income / Liability account mappings for a particular
* product/product type (also populates the changes array if passed in)
* Saves the Charge to Income / Liability account mappings for a particular product/product type (also populates the
* changes array if passed in)
*
* @param command
* @param element
@@ -210,14 +210,12 @@ public class ProductToGLAccountMappingHelper {
final JsonArray chargeToIncomeAccountMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(arrayFragmentName, element);
/**
* Variable stores a map representation of charges (key) and their
* associated income Id's (value) extracted from the passed in
* Jsoncommand
* Variable stores a map representation of charges (key) and their associated income Id's (value) extracted from
* the passed in Jsoncommand
**/
final Map<Long, Long> inputChargeToIncomeAccountMap = new HashMap<>();
/***
* Variable stores all charges which have already been mapped to Income
* Accounts in the system
* Variable stores all charges which have already been mapped to Income Accounts in the system
**/
final Set<Long> existingCharges = new HashSet<>();
if (chargeToIncomeAccountMappingArray != null) {
@@ -238,10 +236,8 @@ public class ProductToGLAccountMappingHelper {
} /**
* Else, <br/>
* update existing mappings OR <br/>
* delete old mappings (which are already present, but not passed
* in as a part of Jsoncommand)<br/>
* Create new mappings for charges that are passed in as a part of
* the Jsoncommand but not already present
* delete old mappings (which are already present, but not passed in as a part of Jsoncommand)<br/>
* Create new mappings for charges that are passed in as a part of the Jsoncommand but not already present
*
**/
else {
@@ -296,13 +292,12 @@ public class ProductToGLAccountMappingHelper {
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper
.extractJsonArrayNamed(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
/**
* Variable stores a map representation of Payment channels (key) and
* their fund sources (value) extracted from the passed in Jsoncommand
* Variable stores a map representation of Payment channels (key) and their fund sources (value) extracted from
* the passed in Jsoncommand
**/
final Map<Long, Long> inputPaymentChannelFundSourceMap = new HashMap<>();
/***
* Variable stores all payment types which have already been mapped to
* Fund Sources in the system
* Variable stores all payment types which have already been mapped to Fund Sources in the system
**/
final Set<Long> existingPaymentTypes = new HashSet<>();
if (paymentChannelMappingArray != null) {
@@ -324,10 +319,9 @@ public class ProductToGLAccountMappingHelper {
} /**
* Else, <br/>
* update existing mappings OR <br/>
* delete old mappings (which re already present, but not passed
* in as a part of Jsoncommand)<br/>
* Create new mappings for payment types that are passed in as a
* part of the Jsoncommand but not already present
* delete old mappings (which re already present, but not passed in as a part of Jsoncommand)<br/>
* Create new mappings for payment types that are passed in as a part of the Jsoncommand but not already
* present
*
**/
else {
@@ -388,8 +382,7 @@ public class ProductToGLAccountMappingHelper {
GLAccount glAccount;
/**
* Both CASH and Accrual placeholders have the same value for income
* from Interest and penalties
* Both CASH and Accrual placeholders have the same value for income from Interest and penalties
**/
CashAccountsForLoan placeHolderAccountType;
if (isPenalty) {
@@ -415,8 +408,8 @@ public class ProductToGLAccountMappingHelper {
}
/**
* Fetches account with a particular Id and throws and Exception it is not
* of the expected Account Category ('ASSET','liability' etc)
* Fetches account with a particular Id and throws and Exception it is not of the expected Account Category
* ('ASSET','liability' etc)
*
* @param paramName
* @param expectedAccountType
@@ -288,16 +288,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId) {
/***
* Variable tracks all accounting mapping properties that have been
* updated
* Variable tracks all accounting mapping properties that have been updated
***/
Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/***
* If the accounting rule has been changed, delete all existing mapping
* for the product and recreate a new set of mappings
* If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* of mappings
***/
if (accountingRuleChanged) {
this.deserializer.validateForLoanProductCreate(command.json());
@@ -319,16 +318,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) {
/***
* Variable tracks all accounting mapping properties that have been
* updated
* Variable tracks all accounting mapping properties that have been updated
***/
Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/***
* If the accounting rule has been changed, delete all existing mapping
* for the product and recreate a new set of mappings
* If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* of mappings
***/
if (accountingRuleChanged) {
this.deserializer.validateForSavingsProductCreate(command.json(), accountType);
@@ -351,16 +349,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateShareProductToGLAccountMapping(final Long shareProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId) {
/***
* Variable tracks all accounting mapping properties that have been
* updated
* Variable tracks all accounting mapping properties that have been updated
***/
Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/***
* If the accounting rule has been changed, delete all existing mapping
* for the product and recreate a new set of mappings
* If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* of mappings
***/
if (accountingRuleChanged) {
this.shareProductToGLAccountMappingHelper.deleteSharesProductToGLAccountMapping(shareProductId);
@@ -177,8 +177,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
}
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
* Examines and updates each account mapping for given loan product with changes passed in from the Json element
*
* @param savingsProductId
* @param changes
@@ -154,8 +154,7 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
}
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
* Examines and updates each account mapping for given loan product with changes passed in from the Json element
*
* @param sharesProductId
* @param changes
@@ -29,8 +29,7 @@ import org.apache.fineract.organisation.office.data.OfficeData;
/**
* Immutable object representing a General Ledger Account
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
* Note: no getter/setters required as google-gson will produce json from fields of object.
*/
public class AccountingRuleData {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.rule.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link RuntimeException} thrown when an Accounting rule with a given name
* already exists
* A {@link RuntimeException} thrown when an Accounting rule with a given name already exists
*/
public class AccountingRuleDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.rule.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when Accounting rule resources are not
* found.
* A {@link RuntimeException} thrown when Accounting rule resources are not found.
*/
public class AccountingRuleNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -59,8 +59,7 @@ import org.springframework.stereotype.Component;
public class AdHocApiResource {
/**
* The set of parameters that are supported in response for
* {@link AdhocData}
* The set of parameters that are supported in response for {@link AdhocData}
*/
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "query", "tableName", "tableField",
"isActive", "createdBy", "createdOn", "createdById", "updatedById", "updatedOn", "email"));
@@ -139,12 +139,9 @@ public final class AdHocDataValidator {
baseDataValidator.reset().parameter("reportRunEvery").value(reportRunEvery).integerGreaterThanZero();
}
/*
* if (this.fromApiJsonHelper.parameterExists("isActive", element)) {
* final Integer isActive =
* this.fromApiJsonHelper.extractIntegerNamed("isActive", element,
* Locale.getDefault());
* baseDataValidator.reset().parameter("isActive").value(isActive).
* notNull().inMinMaxRange(1, 2); }
* if (this.fromApiJsonHelper.parameterExists("isActive", element)) { final Integer isActive =
* this.fromApiJsonHelper.extractIntegerNamed("isActive", element, Locale.getDefault());
* baseDataValidator.reset().parameter("isActive").value(isActive). notNull().inMinMaxRange(1, 2); }
*/
throwExceptionIfValidationWarningsExist(dataValidationErrors);
@@ -73,8 +73,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
private void handleDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException dve) {
@@ -50,12 +50,10 @@ import org.springframework.stereotype.Component;
/**
* Provides a REST resource for Batch Requests. This class acts as a proxy to
* {@link org.apache.fineract.batch.service.BatchApiService} and de-serializes
* the incoming JSON string to a list of
* {@link org.apache.fineract.batch.domain .BatchRequest} type. This list is
* forwarded to BatchApiService which finally returns a list of
* {@link org.apache.fineract.batch.domain.BatchResponse} type which is then
* serialized into JSON response by this Resource class.
* {@link org.apache.fineract.batch.service.BatchApiService} and de-serializes the incoming JSON string to a list of
* {@link org.apache.fineract.batch.domain .BatchRequest} type. This list is forwarded to BatchApiService which finally
* returns a list of {@link org.apache.fineract.batch.domain.BatchResponse} type which is then serialized into JSON
* response by this Resource class.
*
* @author Rishabh Shukla
*
@@ -83,8 +81,7 @@ public class BatchApiResource {
private final BatchRequestJsonHelper batchRequestJsonHelper;
/**
* Constructs a 'BatchApiService' with context, toApiJsonSerializer, service
* and batchRequestJsonHelper.
* Constructs a 'BatchApiService' with context, toApiJsonSerializer, service and batchRequestJsonHelper.
*
* @param context
* @param toApiJsonSerializer
@@ -102,8 +99,7 @@ public class BatchApiResource {
}
/**
* Rest assured POST method to get {@link BatchRequest} and returns back the
* consolidated {@link BatchResponse}
* Rest assured POST method to get {@link BatchRequest} and returns back the consolidated {@link BatchResponse}
*
* @param jsonRequestString
* @param enclosingTransaction
@@ -19,10 +19,8 @@
package org.apache.fineract.batch.command;
/**
* Provides an object to
* {@link org.apache.fineract.batch.service.BatchApiService} to get the proper
* commandStrategy for each request in BatchRequest. It uses Builder pattern to
* create object of this type.
* Provides an object to {@link org.apache.fineract.batch.service.BatchApiService} to get the proper commandStrategy for
* each request in BatchRequest. It uses Builder pattern to create object of this type.
*
* @author Rishabh Shukla
*
@@ -69,9 +67,8 @@ public final class CommandContext {
}
/**
* Returns a boolean value if the relativeUrl 'matches' one of the regex
* keys in the available commandStrategies. It take CommandContext object as
* parameter which contains a 'resource' member as a regex key for available
* Returns a boolean value if the relativeUrl 'matches' one of the regex keys in the available commandStrategies. It
* take CommandContext object as parameter which contains a 'resource' member as a regex key for available
* commandStrategies.
*
* @param other
@@ -23,8 +23,8 @@ import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse;
/**
* An interface for various Command Strategies. It contains a single function
* which returns appropriate response from a particular command strategy.
* An interface for various Command Strategies. It contains a single function which returns appropriate response from a
* particular command strategy.
*
* @author Rishabh Shukla
*
@@ -33,10 +33,8 @@ import org.apache.fineract.batch.domain.BatchResponse;
public interface CommandStrategy {
/**
* Returns an object of type
* {@link org.apache.fineract.batch.domain.BatchResponse}. This takes
* {@link org.apache.fineract.batch.domain.BatchRequest} as it's single
* argument and provides appropriate response.
* Returns an object of type {@link org.apache.fineract.batch.domain.BatchResponse}. This takes
* {@link org.apache.fineract.batch.domain.BatchRequest} as it's single argument and provides appropriate response.
*
* @param batchRequest
* @param uriInfo
@@ -25,8 +25,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
/**
* Provides an appropriate CommandStrategy using the 'method' and 'resourceUrl'.
* CommandStrategy bean is created using Spring Application Context.
* Provides an appropriate CommandStrategy using the 'method' and 'resourceUrl'. CommandStrategy bean is created using
* Spring Application Context.
*
* @author Rishabh Shukla
*
@@ -39,9 +39,8 @@ public class CommandStrategyProvider {
private final ConcurrentHashMap<CommandContext, String> commandStrategies = new ConcurrentHashMap<>();
/**
* Constructs a CommandStrategyProvider with argument of ApplicationContext
* type. It also initialize commandStrategies using init() function by
* filling it with available CommandStrategies in
* Constructs a CommandStrategyProvider with argument of ApplicationContext type. It also initialize
* commandStrategies using init() function by filling it with available CommandStrategies in
* {@link org.apache.fineract.batch.command.internal}.
*
* @param applicationContext
@@ -56,9 +55,8 @@ public class CommandStrategyProvider {
}
/**
* Returns an appropriate commandStrategy after determining it using the
* CommandContext of the request. If no such Strategy is found then a
* default strategy is returned back.
* Returns an appropriate commandStrategy after determining it using the CommandContext of the request. If no such
* Strategy is found then a default strategy is returned back.
*
* @param commandContext
* @return CommandStrategy
@@ -80,10 +78,8 @@ public class CommandStrategyProvider {
}
/**
* Contains various available command strategies in
* {@link org.apache.fineract.batch.command.internal}. Any new command
* Strategy will have to be added within this function in order to initiate
* it within the constructor.
* Contains various available command strategies in {@link org.apache.fineract.batch.command.internal}. Any new
* command Strategy will have to be added within this function in order to initiate it within the constructor.
*/
private void init() {
this.commandStrategies.put(CommandContext.resource("clients").method("POST").build(), "createClientCommandStrategy");
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to
* handle activation of a pending client. It passes the contents of the body
* from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets
* back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle activation of a pending client. It
* passes the contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets back the response. This class will also
* catch any errors raised by {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors
* to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* applies a new loan on an existing client. It passes the contents of the body
* from the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and applies a new loan on an existing client. It
* passes the contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets back the response. This class will
* also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those
* errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* applies a new savings on an existing client. It passes the contents of the
* body from the BatchRequest to
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource}
* and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and applies a new savings on an existing client.
* It passes the contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and gets back the response. This class
* will also catch any errors raised by {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and
* map those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to
* handle approval of a pending loan. It passes the contents of the body from
* the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle approval of a pending loan. It passes
* the contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets back the response. This class will
* also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those
* errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* Collect Charges for a Loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and Collect Charges for a Loan. It passes the
* contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and gets back the response. This class
* will also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* map those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* Create Charge for a Loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and Create Charge for a Loan. It passes the
* contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and gets back the response. This class
* will also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* map those errors to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to
* handle creation of a new client. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets
* back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle creation of a new client. It passes
* the contents of the body from the BatchRequest to {@link org.apache.fineract.portfolio.client.api.ClientsApiResource}
* and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors to appropriate status codes
* in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to
* handle disburse of a loan. It passes the contents of the body from the
* BatchRequest to
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle disburse of a loan. It passes the
* contents of the body from the BatchRequest to {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource}
* and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those errors to appropriate status
* codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -31,11 +31,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link CommandStrategy} and handles repayment for a Loan. It
* passes the contents of the body from the BatchRequest to
* {@link LoanTransactionsApiResource} and gets back the response. This class
* will also catch any errors raised by {@link LoanTransactionsApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* Implements {@link CommandStrategy} and handles repayment for a Loan. It passes the contents of the body from the
* BatchRequest to {@link LoanTransactionsApiResource} and gets back the response. This class will also catch any errors
* raised by {@link LoanTransactionsApiResource} and map those errors to appropriate status codes in BatchResponse.
*
* @author Mohit Sinha
*
@@ -25,9 +25,8 @@ import org.apache.fineract.batch.domain.BatchResponse;
import org.springframework.stereotype.Component;
/**
* Provides a default CommandStrategy by implementing
* {@link org.apache.fineract.batch.command.CommandStrategy} in case there is no
* appropriate command strategy with requested 'method' and 'resoureUrl'.
* Provides a default CommandStrategy by implementing {@link org.apache.fineract.batch.command.CommandStrategy} in case
* there is no appropriate command strategy with requested 'method' and 'resoureUrl'.
*
* @author Rishabh Shukla
*/
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and
* updates the information of an existing client. It passes the contents of the
* body from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets
* back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and updates the information of an existing
* client. It passes the contents of the body from the BatchRequest to
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets back the response. This class will also
* catch any errors raised by {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors
* to appropriate status codes in BatchResponse.
*
* @author Rishabh Shukla
*
@@ -21,10 +21,9 @@ package org.apache.fineract.batch.domain;
import java.util.Set;
/**
* Provides an object for separate HTTP requests in the Batch Request for Batch
* API. A requestId is also included as data field which takes care of
* dependency issues among various requests. This class also provides getter and
* setter functions to access Batch Request data fields.
* Provides an object for separate HTTP requests in the Batch Request for Batch API. A requestId is also included as
* data field which takes care of dependency issues among various requests. This class also provides getter and setter
* functions to access Batch Request data fields.
*
* @author Rishabh Shukla
*
@@ -41,8 +40,8 @@ public class BatchRequest {
private String body;
/**
* Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers,
* reference and body of the incoming request.
* Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers, reference and body of the incoming
* request.
*
* @param requestId
* of HTTP request.
@@ -131,8 +130,7 @@ public class BatchRequest {
}
/**
* Returns the values of 'headers' of {@link Header} type of an object of
* this class.
* Returns the values of 'headers' of {@link Header} type of an object of this class.
*
* @return headers of the HTTP request.
* @see Header
@@ -142,8 +140,7 @@ public class BatchRequest {
}
/**
* Sets the values of 'headers' of {@link Header} type of an object of this
* class.
* Sets the values of 'headers' of {@link Header} type of an object of this class.
*
* @param headers
* @see Header
@@ -21,10 +21,9 @@ package org.apache.fineract.batch.domain;
import java.util.Set;
/**
* Provides an object for separate HTTP responses in the Batch Response for
* Batch API. It contains all the information about a particular HTTP response
* in the Batch Response. Getter and Setter functions are also included to
* access response data fields.
* Provides an object for separate HTTP responses in the Batch Response for Batch API. It contains all the information
* about a particular HTTP response in the Batch Response. Getter and Setter functions are also included to access
* response data fields.
*
* @author Rishabh Shukla
*
@@ -40,8 +39,7 @@ public class BatchResponse {
private String body;
/**
* Constructs a 'BatchResponse' with requestId, statusCode, headers and body
* of the HTTP requests.
* Constructs a 'BatchResponse' with requestId, statusCode, headers and body of the HTTP requests.
*
* @param requestId
* @param statusCode
@@ -110,8 +108,7 @@ public class BatchResponse {
}
/**
* Sets the value of 'headers' of {@link Header} type of an object of this
* class.
* Sets the value of 'headers' of {@link Header} type of an object of this class.
*
* @param headers
* of {@link Header} Type
@@ -19,9 +19,8 @@
package org.apache.fineract.batch.domain;
/**
* Provides an object to handle HTTP headers as name and value pairs for Batch
* API. It is used in {@link BatchRequest} and {@link BatchResponse} to store
* the information regarding the headers in incoming and outgoing JSON Strings.
* Provides an object to handle HTTP headers as name and value pairs for Batch API. It is used in {@link BatchRequest}
* and {@link BatchResponse} to store the information regarding the headers in incoming and outgoing JSON Strings.
*
* @author Rishabh Shukla
*
@@ -38,11 +38,9 @@ import org.springframework.dao.NonTransientDataAccessException;
import org.springframework.transaction.TransactionException;
/**
* Provides an Error Handler method that returns an object of type
* {@link ErrorInfo} to the CommandStrategy which raised the exception. This
* class uses various subclasses of RuntimeException to check the kind of
* exception raised and provide appropriate status and error codes for each one
* of the raised exception.
* Provides an Error Handler method that returns an object of type {@link ErrorInfo} to the CommandStrategy which raised
* the exception. This class uses various subclasses of RuntimeException to check the kind of exception raised and
* provide appropriate status and error codes for each one of the raised exception.
*
* @author Rishabh Shukla
*
@@ -61,8 +59,7 @@ public class ErrorHandler extends RuntimeException {
}
/**
* Returns an object of ErrorInfo type containing the information regarding
* the raised error.
* Returns an object of ErrorInfo type containing the information regarding the raised error.
*
* @param exception
* @return ErrorInfo
@@ -19,8 +19,7 @@
package org.apache.fineract.batch.exception;
/**
* Provides members to hold the basic information about the exceptions raised in
* commandStrategy classes.
* Provides members to hold the basic information about the exceptions raised in commandStrategy classes.
*
* @author Rishabh Shukla
*
@@ -90,8 +89,7 @@ public final class ErrorInfo {
}
/**
* Getter method to provide the message of the error for an object of this
* type.
* Getter method to provide the message of the error for an object of this type.
*
* @return String
*/
@@ -26,10 +26,8 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.springframework.stereotype.Component;
/**
* Extends
* {@link org.apache.fineract.infrastructure.core.serialization.FromJsonHelper}
* to de-serialize the incoming String into a JSON List of type
* {@link org.apache.fineract.batch.domain.BatchRequest}
* Extends {@link org.apache.fineract.infrastructure.core.serialization.FromJsonHelper} to de-serialize the incoming
* String into a JSON List of type {@link org.apache.fineract.batch.domain.BatchRequest}
*
* @author Rishabh Shukla
*
@@ -40,8 +38,7 @@ import org.springframework.stereotype.Component;
public class BatchRequestJsonHelper extends FromJsonHelper {
/**
* Returns a list of batchRequests after de-serializing it from the input
* JSON string.
* Returns a list of batchRequests after de-serializing it from the input JSON string.
*
* @param json
* @return List&lt;BatchRequest&gt;
@@ -24,8 +24,7 @@ import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse;
/**
* Provides an interface for service class, that implements the method to handle
* separate Batch Requests.
* Provides an interface for service class, that implements the method to handle separate Batch Requests.
*
* @author Rishabh Shukla
*
@@ -36,10 +35,9 @@ import org.apache.fineract.batch.domain.BatchResponse;
public interface BatchApiService {
/**
* Returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s
* by getting the appropriate CommandStrategy for every
* {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used
* when the Query Parameter "enclosingTransaction "is set to 'false'.
* Returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s by getting the appropriate
* CommandStrategy for every {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used when the Query
* Parameter "enclosingTransaction "is set to 'false'.
*
* @param requestList
* @param uriInfo
@@ -48,12 +46,10 @@ public interface BatchApiService {
List<BatchResponse> handleBatchRequestsWithoutEnclosingTransaction(List<BatchRequest> requestList, UriInfo uriInfo);
/**
* returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s
* by getting the appropriate CommandStrategy for every
* {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used
* when the Query Parameter "enclosingTransaction "is set to 'true'. If one
* or more of the requests are not completed properly then whole of the
* transaction will be rolled back properly.
* returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s by getting the appropriate
* CommandStrategy for every {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used when the Query
* Parameter "enclosingTransaction "is set to 'true'. If one or more of the requests are not completed properly then
* whole of the transaction will be rolled back properly.
*
* @param requestList
* @param uriInfo
@@ -44,9 +44,8 @@ import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
/**
* Implementation for {@link BatchApiService} to iterate through all the
* incoming requests and obtain the appropriate CommandStrategy from
* CommandStrategyProvider.
* Implementation for {@link BatchApiService} to iterate through all the incoming requests and obtain the appropriate
* CommandStrategy from CommandStrategyProvider.
*
* @author Rishabh Shukla
*
@@ -78,10 +77,8 @@ public class BatchApiServiceImpl implements BatchApiService {
}
/**
* Returns the response list by getting a proper
* {@link org.apache.fineract.batch.command.CommandStrategy}. execute()
* method of acquired commandStrategy is then provided with the separate
* Request.
* Returns the response list by getting a proper {@link org.apache.fineract.batch.command.CommandStrategy}.
* execute() method of acquired commandStrategy is then provided with the separate Request.
*
* @param requestList
* @param uriInfo
@@ -34,9 +34,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Provides methods to create dependency map among the various batchRequests. It
* also provides method that takes care of dependency resolution among related
* requests.
* Provides methods to create dependency map among the various batchRequests. It also provides method that takes care of
* dependency resolution among related requests.
*
* @author Rishabh Shukla
* @see BatchApiServiceImpl
@@ -85,10 +84,9 @@ public class ResolutionHelper {
}
/**
* Returns a map containing requests that are divided in accordance of
* dependency relations among them. Each different list is identified with a
* "Key" which is the "requestId" of the request at topmost level in
* dependency hierarchy of that particular list.
* Returns a map containing requests that are divided in accordance of dependency relations among them. Each
* different list is identified with a "Key" which is the "requestId" of the request at topmost level in dependency
* hierarchy of that particular list.
*
* @param batchRequests
* @return List&lt;ArrayList&lt;BatchRequestNode&gt;&gt;
@@ -122,10 +120,8 @@ public class ResolutionHelper {
}
/**
* Returns a BatchRequest after dependency resolution. It takes a request
* and the response of the request it is dependent upon as its arguments and
* change the body or relativeUrl of the request according to parent
* Request.
* Returns a BatchRequest after dependency resolution. It takes a request and the response of the request it is
* dependent upon as its arguments and change the body or relativeUrl of the request according to parent Request.
*
* @param request
* @param parentResponse
@@ -27,8 +27,7 @@ import java.lang.annotation.Target;
/**
* Specifies the command type for the annotated class.<br>
* <br>
* The entity name (e.g. CLIENT, SAVINGSACCOUNT, LOANPRODUCT) and the action
* (e.g. CREATE, DELETE) must be given.
* The entity name (e.g. CLIENT, SAVINGSACCOUNT, LOANPRODUCT) and the action (e.g. CREATE, DELETE) must be given.
*
* @author Markus Geiss
* @version 1.0
@@ -23,15 +23,12 @@ import org.apache.fineract.commands.domain.CommandSource;
public class RollbackTransactionAsCommandIsNotApprovedByCheckerException extends RuntimeException {
/**
* When maker-checker is configured globally and also for the current
* transaction.
* When maker-checker is configured globally and also for the current transaction.
*
* An initial save determines if there are any integrity rule or data
* problems.
* An initial save determines if there are any integrity rule or data problems.
*
* If there isn't... and the transaction is from a maker... then this roll
* back is issued and the commandSourceResult is used to write the audit
* entry.
* If there isn't... and the transaction is from a maker... then this roll back is issued and the
* commandSourceResult is used to write the audit entry.
*/
private final CommandSource commandSourceResult;
@@ -19,8 +19,8 @@
package org.apache.fineract.commands.exception;
/**
* A {@link RuntimeException} that is thrown in the case where an invalid or
* unknown command is attempted to be processed by platform.
* A {@link RuntimeException} that is thrown in the case where an invalid or unknown command is attempted to be
* processed by platform.
*/
public class UnsupportedCommandException extends RuntimeException {
@@ -34,12 +34,10 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* {@link CommandHandlerProvider} provides {@link NewCommandSourceHandler}s for
* a given entity and action. <br>
* {@link CommandHandlerProvider} provides {@link NewCommandSourceHandler}s for a given entity and action. <br>
* <br>
* A {@link NewCommandSourceHandler} can be registered and the annotation
* {@link CommandType} is used to determine the entity and the action the
* handler is capable to process.
* A {@link NewCommandSourceHandler} can be registered and the annotation {@link CommandType} is used to determine the
* entity and the action the handler is capable to process.
*
* @author Markus Geiss
* @version 1.0
@@ -63,8 +61,8 @@ public class CommandHandlerProvider implements ApplicationContextAware {
/**
* Returns a handler for the given entity and action.<br>
* <br>
* Throws an {@link UnsupportedCommandException} if no handler for the given
* entity, action combination can be found.
* Throws an {@link UnsupportedCommandException} if no handler for the given entity, action combination can be
* found.
*
* @param entity
* the entity to lookup the handler, must be given.
@@ -99,8 +99,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
} catch (CannotAcquireLockException | ObjectOptimisticLockingFailureException exception) {
LOG.info("The following command {} has been retried {} time(s)", command.json(), numberOfRetries);
/***
* Fail if the transaction has been retired for
* maxNumberOfRetries
* Fail if the transaction has been retired for maxNumberOfRetries
**/
if (numberOfRetries >= maxNumberOfRetries) {
LOG.warn("The following command {} has been retried for the max allowed attempts of {} and will be rolled back",
@@ -108,8 +107,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
throw (exception);
}
/***
* Else sleep for a random time (between 1 to 10 seconds) and
* continue
* Else sleep for a random time (between 1 to 10 seconds) and continue
**/
try {
Random random = new Random();
@@ -111,15 +111,13 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
if ((rollbackTransaction || result.isRollbackTransaction()) && !isApprovedByChecker) {
/*
* JournalEntry will generate a new transactionId every time.
* Updating the transactionId with old transactionId, because as
* there are no entries are created with new transactionId, will
* throw an error when checker approves the transaction
* JournalEntry will generate a new transactionId every time. Updating the transactionId with old
* transactionId, because as there are no entries are created with new transactionId, will throw an error
* when checker approves the transaction
*/
commandSourceResult.updateTransaction(command.getTransactionId());
/*
* Update CommandSource json data with JsonCommand json data, line
* 77 and 81 may update the json data
* Update CommandSource json data with JsonCommand json data, line 77 and 81 may update the json data
*/
commandSourceResult.updateJsonTo(command.json());
throw new RollbackTransactionAsCommandIsNotApprovedByCheckerException(commandSourceResult);
@@ -80,10 +80,8 @@ public class AccountNumberFormatDataValidator {
.parameter(AccountNumberFormatConstants.prefixTypeParamName).value(prefixType).notNull().integerGreaterThanZero();
/**
* Permitted values for prefix type vary based on the actual
* selected accountType, carry out this validation only if data
* validation errors do not exist for both entity type and prefix
* type
* Permitted values for prefix type vary based on the actual selected accountType, carry out this validation
* only if data validation errors do not exist for both entity type and prefix type
**/
boolean areAccountTypeAndPrefixTypeValid = true;
for (ApiParameterError apiParameterError : dataValidationErrors) {
@@ -46,9 +46,8 @@ public class AccountNumberFormatConstants {
public static final String prefixTypeOptionsParamName = "prefixTypeOptions";
/**
* These parameters will match the class level parameters of
* {@link AccountNumberFormatData}. Where possible, we try to get response
* parameters to match those of request parameters.
* These parameters will match the class level parameters of {@link AccountNumberFormatData}. Where possible, we try
* to get response parameters to match those of request parameters.
*/
// Error messages codes
@@ -111,9 +111,8 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
Map<String, List<EnumOptionData>> accountNumberPrefixTypeOptions = new HashMap<>();
/***
* If an Account type is passed in, return prefixes only for the passed
* in account type, else return all allowed prefixes keyed by all
* possible entity type
* If an Account type is passed in, return prefixes only for the passed in account type, else return all allowed
* prefixes keyed by all possible entity type
**/
if (entityAccountTypeForTemplate != null) {
determinePrefixTypesForAccounts(accountNumberPrefixTypeOptions, entityAccountTypeForTemplate);
@@ -136,8 +136,7 @@ public class AccountNumberFormatWritePlatformServiceJpaRepositoryImpl implements
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dve) {
if (realCause.getMessage().contains(AccountNumberFormatConstants.ACCOUNT_TYPE_UNIQUE_CONSTRAINT_NAME)) {
@@ -40,9 +40,8 @@ public class PersonnelSheetPopulator extends AbstractWorkbookPopulator {
private Map<String, List<StaffData>> officeToPersonnel;
/*
* Guava Multimap would make this more readable. The value Integer[]
* contains the beginIndex and endIndex for the staff list of each office.
* Required for applying names in excel.
* Guava Multimap would make this more readable. The value Integer[] contains the beginIndex and endIndex for the
* staff list of each office. Required for applying names in excel.
*/
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfStaff;
@@ -61,9 +60,8 @@ public class PersonnelSheetPopulator extends AbstractWorkbookPopulator {
setLayout(staffSheet);
/*
* This piece of code could have been avoided by making multiple trips
* to the database for the staff of each office but this is more
* performance efficient
* This piece of code could have been avoided by making multiple trips to the database for the staff of each
* office but this is more performance efficient
*/
setOfficeToPersonnelMap();
@@ -35,12 +35,10 @@ import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.stereotype.Component;
/**
* At present this implementation of {@link CacheManager} just delegates to the
* real {@link CacheManager} to use.
* At present this implementation of {@link CacheManager} just delegates to the real {@link CacheManager} to use.
*
* By default it is {@link NoOpCacheManager} but we can change that by checking
* some persisted configuration in the database on startup and allow user to
* switch implementation through UI/API
* By default it is {@link NoOpCacheManager} but we can change that by checking some persisted configuration in the
* database on startup and allow user to switch implementation through UI/API
*/
@Component(value = "runtimeDelegatingCacheManager")
public class RuntimeDelegatingCacheManager implements CacheManager {
@@ -54,8 +54,8 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created with IntelliJ IDEA. User: andrew Date: 19-5-14 Time: 15:17 To change
* this template use File | Settings | File Templates.
* Created with IntelliJ IDEA. User: andrew Date: 19-5-14 Time: 15:17 To change this template use File | Settings | File
* Templates.
*/
@Path("/email/campaign")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -132,9 +132,8 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final boolean useReport = rs.getBoolean("useReport");
/*
* final ReportData stretchyReport = new ReportData(reportId,
* reportName, reportType, reportSubType, reportCategory,
* reportDescription, reportSql, coreReport, useReport, null);
* final ReportData stretchyReport = new ReportData(reportId, reportName, reportType, reportSubType,
* reportCategory, reportDescription, reportSql, coreReport, useReport, null);
*/
final Integer statusId = JdbcSupport.getInteger(rs, "statusEnum");
@@ -313,8 +313,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
// calculate new trigger date and insert into next trigger date
/**
* next run time has to be in the future if not calculate a new future
* date
* next run time has to be in the future if not calculate a new future date
*/
LocalDate nextRuntime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
emailCampaign.getNextTriggerDate().toLocalDate(), nextTriggerDate.toLocalDate());
@@ -366,9 +365,8 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
if (emailCampaign.isSchedule()) {
/**
* if recurrence start date is in the future calculate next
* trigger date if not use recurrence start date us next trigger
* date when activating
* if recurrence start date is in the future calculate next trigger date if not use recurrence start
* date us next trigger date when activating
*/
LocalDate nextTriggerDate = null;
if (emailCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
@@ -391,8 +389,8 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
}
/*
* if campaign is direct insert campaign message into email outbound
* table else if its a schedule create a job process for it
* if campaign is direct insert campaign message into email outbound table else if its a schedule create a job
* process for it
*/
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
@@ -515,9 +513,8 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
if (emailCampaign.isSchedule()) {
/**
* if recurrence start date is in the future calculate next trigger
* date if not use recurrence start date us next trigger date when
* activating
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
* next trigger date when activating
*/
LocalDate nextTriggerDate = null;
if (emailCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
@@ -718,8 +715,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
}
/**
* This generates the the report and converts it to a file by passing the
* parameters below
* This generates the the report and converts it to a file by passing the parameters below
*
* @param emailCampaign
* @param emailAttachmentFileFormat
@@ -763,8 +759,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
}
/**
* This matches the the actual values to the key in the report stretchy
* parameters map
* This matches the the actual values to the key in the report stretchy parameters map
*
* @param stretchyParams
* @param client
@@ -117,8 +117,7 @@ public class EmailWritePlatformServiceJpaRepositoryImpl implements EmailWritePla
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
private void handleDataIntegrityIssues(@SuppressWarnings("unused") final JsonCommand command,
final DataIntegrityViolationException dve) {
@@ -500,8 +500,7 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
*
* private final Object entity ;
*
* public Task(final FineractPlatformTenant tenant, final String reportName,
* final Object entity) { this.tenant = tenant; this.reportName = reportName
* ; this.entity = entity ; } }
* public Task(final FineractPlatformTenant tenant, final String reportName, final Object entity) { this.tenant =
* tenant; this.reportName = reportName ; this.entity = entity ; } }
*/
}
@@ -409,8 +409,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
// calculate new trigger date and insert into next trigger date
/**
* next run time has to be in the future if not calculate a new future
* date
* next run time has to be in the future if not calculate a new future date
*/
LocalDate nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
smsCampaign.getNextTriggerDate().toLocalDate(), nextTriggerDate.toLocalDate());
@@ -460,9 +459,8 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} else if (smsCampaign.isSchedule()) {
/**
* if recurrence start date is in the future calculate next trigger
* date if not use recurrence start date us next trigger date when
* activating
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
* next trigger date when activating
*/
LocalDate nextTriggerDate = null;
if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
@@ -484,8 +482,8 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
}
/*
* if campaign is direct insert campaign message into sms outbound table
* else if its a schedule create a job process for it
* if campaign is direct insert campaign message into sms outbound table else if its a schedule create a job
* process for it
*/
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
@@ -621,9 +619,8 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} else if (smsCampaign.isSchedule()) {
/**
* if recurrence start date is in the future calculate next trigger
* date if not use recurrence start date us next trigger date when
* activating
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
* next trigger date when activating
*/
LocalDate nextTriggerDate = null;
if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
@@ -24,8 +24,7 @@ import java.util.Set;
public class CodeConstants {
/***
* Enum of all parameters passed in while creating/updating a code and code
* value
* Enum of all parameters passed in while creating/updating a code and code value
***/
public static enum CodevalueJSONinputParams {
@@ -24,15 +24,14 @@ import org.springframework.stereotype.Service;
/**
* <p>
* Wrapper for {@link CodeValueRepository} that is responsible for checking if
* {@link CodeValue} is returned when using <code>findOne</code> and
* <code>findByCodeNameAndId</code> repository methods and throwing an
* appropriate not found exception.
* Wrapper for {@link CodeValueRepository} that is responsible for checking if {@link CodeValue} is returned when using
* <code>findOne</code> and <code>findByCodeNameAndId</code> repository methods and throwing an appropriate not found
* exception.
* </p>
*
* <p>
* This is to avoid need for checking and throwing in multiple areas of code
* base where {@link CodeValueRepository} is required.
* This is to avoid need for checking and throwing in multiple areas of code base where {@link CodeValueRepository} is
* required.
* </p>
*/
@Service
@@ -21,8 +21,7 @@ package org.apache.fineract.infrastructure.codes.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* A {@link AbstractPlatformDomainRuleException} thrown when someone attempts to
* update or delete a system defined code.
* A {@link AbstractPlatformDomainRuleException} thrown when someone attempts to update or delete a system defined code.
*/
public class SystemDefinedCodeCannotBeChangedException extends AbstractPlatformDomainRuleException {
@@ -31,13 +31,11 @@ import org.apache.fineract.infrastructure.codes.data.CodeValueData;
* </ol>
*
* <p>
* System defined codes cannot be altered or removed but their code values may
* be allowed to be added to or removed.
* System defined codes cannot be altered or removed but their code values may be allowed to be added to or removed.
* </p>
*
* <p>
* User defined codes can be changed in any way by application users with system
* permissions.
* User defined codes can be changed in any way by application users with system permissions.
* </p>
*/
public interface CodeValueReadPlatformService {
@@ -90,8 +90,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
private void handleCodeValueDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause();
@@ -139,8 +139,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
private void handleCodeDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dve) {
if (realCause.getMessage().contains("code_name")) {
@@ -82,8 +82,7 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
/*
* (non-Javadoc)
*
* @see org.apache.fineract.infrastructure.configuration.domain.
* ConfigurationDomainService#isHolidaysEnabled()
* @see org.apache.fineract.infrastructure.configuration.domain. ConfigurationDomainService#isHolidaysEnabled()
*/
@Override
public boolean isRescheduleRepaymentsOnHolidaysEnabled() {
@@ -24,8 +24,7 @@ import org.springframework.stereotype.Service;
/**
* <p>
* Wrapper for {@link GlobalConfigurationRepository} that adds NULL checking and
* Error handling capabilities
* Wrapper for {@link GlobalConfigurationRepository} that adds NULL checking and Error handling capabilities
* </p>
*/
@Service
@@ -21,8 +21,7 @@ package org.apache.fineract.infrastructure.configuration.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when global configuration properties are
* not found.
* A {@link RuntimeException} thrown when global configuration properties are not found.
*/
public class GlobalConfigurationPropertyNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -34,8 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link FromApiJsonDeserializer} for
* {@link UpdateGlobalConfigurationCommand}'s.
* Implementation of {@link FromApiJsonDeserializer} for {@link UpdateGlobalConfigurationCommand}'s.
*/
@Component
public final class GlobalConfigurationCommandFromApiJsonDeserializer

Some files were not shown because too many files have changed in this diff Show More