remove all trailing spaces in Java files (FINERACT-821)

find . -type f -name "*.java" -exec sed -i 's/ *$//' '{}' ';'
This commit is contained in:
Michael Vorburger
2020-01-19 19:58:21 +01:00
committed by Michael Vorburger ⛑️
parent b0196049f1
commit dd7503f296
862 changed files with 4984 additions and 4984 deletions
@@ -82,14 +82,14 @@ public class ServerWithMariaDB4jApplication {
if (distResource.exists()) {
openWebBrowser(distURI);
} else if (devResource.exists()) {
openWebBrowser(devURI);
openWebBrowser(devURI);
} else {
logger.error("Cannot open Fineract UI in browser; not found: " + distResource.toString());
}
}
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
@@ -27,7 +27,7 @@ public class AccrualAccountingConstants {
public static final String accrueTillParamName = "tillDate";
public static final String localeParamName = "locale";
public static final String dateFormatParamName = "dateFormat";
public static final String PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME = "periodicaccrual";
public static final String PERIODIC_ACCRUAL_ACCOUNTING_EXECUTION_ERROR_CODE = "execution.failed";
}
@@ -26,7 +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.
*/
@@ -41,7 +41,7 @@ public interface AccountingDropdownReadPlatformService {
public Map<String, List<GLAccountData>> retrieveAccountMappingOptionsForCharges();
public Map<String, List<GLAccountData>> retrieveAccountMappingOptions();
public Map<String, List<GLAccountData>> retrieveAccountMappingOptionsForShareProducts();
}
@@ -30,7 +30,7 @@ import java.util.List;
/**
* Immutable object representing a General Ledger Account
*
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
*/
@@ -21,7 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
*
*
* when gl account is attached with any product(loan/saving) then we can not
* disable the gl account
*/
@@ -28,7 +28,7 @@ import org.joda.time.LocalDate;
/**
* Class for parsing dates sent as query parameters
*
*
* TODO: Vishwas Should move this class to a more generic package
*/
public class DateParam {
@@ -221,7 +221,7 @@ public class JournalEntriesApiResource {
return this.apiJsonSerializerService.serialize(settings, entries, RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("openingbalance")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -29,7 +29,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.
*/
@@ -220,7 +220,7 @@ public class JournalEntry extends AbstractAuditableCustom<AppUser, Long> {
return this.entityType;
}
public Long getShareTransactionId() {
return this.shareTransactionId;
}
@@ -37,8 +37,8 @@ public interface JournalEntryRepository extends JpaRepository<JournalEntry, Long
@Query("select DISTINCT j.transactionId from JournalEntry j where j.office.id = :officeId and j.glAccount.id = :contraId and j.reversed=false and j.transactionId not in (select DISTINCT je.reversalJournalEntry.transactionId from JournalEntry je where je.reversed=true)")
List<String> findNonReversedContraTansactionIds(@Param("contraId") Long contraId, @Param("officeId") Long officeId);
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.entityId= :entityId and journalEntry.entityType = :entityType")
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.entityId= :entityId and journalEntry.entityType = :entityType")
List<JournalEntry> findProvisioningJournalEntriesByEntityId(@Param("entityId") Long entityId, @Param("entityType") Integer entityType) ;
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.transactionId= :transactionId and journalEntry.reversed=false and journalEntry.entityType = :entityType")
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Service;
@Service
@CommandType(entity = "JOURNALENTRY", action = "DEFINEOPENINGBALANCE")
public class DefineOpeningBalanceCommandHandler implements NewCommandSourceHandler {
private final JournalEntryWritePlatformService writePlatformService;
@Autowired
@@ -340,10 +340,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -375,10 +375,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -435,10 +435,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -470,10 +470,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -562,10 +562,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office
* @param currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -721,10 +721,10 @@ public class AccountingProcessorHelper {
/**
* 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
*
*
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -1041,7 +1041,7 @@ public class AccountingProcessorHelper {
"Recent Portfolio changes w.r.t Charges for shares have Broken the accounting code",
"Recent Portfolio changes w.r.t Charges for shares have Broken the accounting code"); }
}
private void createDebitJournalEntryForShares(final Office office, final String currencyCode, final GLAccount account,
final Long shareAccountId, final String transactionId, final Date transactionDate, final BigDecimal amount) {
final boolean manualEntry = false;
@@ -102,7 +102,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
/**
* Debit loan Portfolio and credit Fund source for Disbursement.
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -141,20 +141,20 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
}
/**
*
*
* Handles repayments using the following posting rules <br/>
* <br/>
* <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>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/>
* <br/>
@@ -162,24 +162,24 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* <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>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/>
* <br/>
* <br/>
* In case the loan transaction has been reversed, all debits are turned
* into credits and vice versa
*
*
* @param loanTransactionDTO
* @param loanDTO
* @param office
*
*
*/
private void createJournalEntriesForRepaymentsAndWriteOffs(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office, final boolean writeOff, final boolean isIncomeFromFee) {
@@ -320,7 +320,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
/**
* 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
*/
@@ -347,15 +347,15 @@ 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>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income
* from Penalties</i>
*
*
* Also handles reversals for both fees and payment applications
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -55,7 +55,7 @@ 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
*
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
*/
@@ -110,11 +110,11 @@ 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
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -150,11 +150,11 @@ 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
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -188,7 +188,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
* (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
*/
@@ -259,7 +259,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* 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
*/
@@ -287,11 +287,11 @@ 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/>
*
*
* All debits are turned into credits and vice versa in case of Transfer
* Initiation disbursals
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -320,7 +320,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
null, loanId, transactionId, transactionDate, principalAmount, isReversal);
}
}
private void createJournalEntriesForRefundForActiveLoan(LoanDTO loanDTO, LoanTransactionDTO loanTransactionDTO, Office office) {
// loan properties
final Long loanProductId = loanDTO.getLoanProductId();
@@ -354,11 +354,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
if (feesAmount != null && !(feesAmount.compareTo(BigDecimal.ZERO) == 0)) {
totalDebitAmount = totalDebitAmount.add(feesAmount);
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
for(ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) {
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)):chargePaymentDTO.getAmount() ));
}
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
@@ -369,12 +369,12 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) {
totalDebitAmount = totalDebitAmount.add(penaltiesAmount);
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
for(ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) {
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)):chargePaymentDTO.getAmount() ));
}
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
penaltiesAmount, !isReversal, chargePaymentDTOs);
@@ -389,6 +389,6 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/*** create a single debit entry (or reversal) for the entire amount **/
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, !isReversal);
}
}
@@ -123,13 +123,13 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
transactionId, transactionDate, amount.subtract(chargeAmount));
this.helper.createCreditJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId,
transactionId, transactionDate, amount);
}else{
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
transactionDate, amount);
}
}
}
@@ -362,7 +362,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
if (searchParameters.isOrderByRequested()) {
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), searchParameters.getOrderBy());
if (searchParameters.isSortOrderProvided()) {
sqlBuilder.append(' ').append(searchParameters.getSortOrder());
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), searchParameters.getOrderBy());
@@ -65,11 +65,11 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
private final FromJsonHelper fromApiJsonHelper;
private final GLJournalEntryMapper entryMapper = new GLJournalEntryMapper();
// if a limit is not added to the running balance select statements below and the resultset is more than 400,000,
// if a limit is not added to the running balance select statements below and the resultset is more than 400,000,
// the script will eat up all of the server memory
private final String selectRunningBalanceSqlLimit = "limit 0, 10000";
private final String officeRunningBalanceSql = "select je.office_running_balance as runningBalance,je.account_id as accountId from acc_gl_journal_entry je "
+ "inner join (select max(id) as id from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id,entry_date) je2 "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id) je3 "
@@ -39,12 +39,12 @@ public interface JournalEntryWritePlatformService {
void createJournalEntriesForClientTransactions(Map<String, Object> accountingBridgeData);
CommandProcessingResult defineOpeningBalance(JsonCommand command);
public String revertProvisioningJournalEntries(final Date reversalTransactionDate, final Long entityId, final Integer entityType) ;
public String createProvisioningJournalEntries(ProvisioningEntry entry) ;
void createJournalEntriesForShares(Map<String, Object> accountingBridgeData);
void revertShareAccountJournalEntries(final ArrayList<Long> transactionId, final Date transactionDate);
}
@@ -323,7 +323,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
final boolean useDefaultComment = StringUtils.isBlank(reversalComment);
validateCommentForReversal(reversalComment);
//Before reversal validate accounting closure is done for that branch or not.
final Date journalEntriesTransactionDate = journalEntries.get(0).getTransactionDate();
final GLClosure latestGLClosureByBranch = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
@@ -563,7 +563,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
}
}
}
private void validateBusinessRulesForJournalEntries(final JournalEntryCommand command) {
/** check if date of Journal entry is valid ***/
final LocalDate entryLocalDate = command.getTransactionDate();
@@ -48,27 +48,27 @@ import com.google.gson.JsonElement;
/**
* 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)
*
*
* 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
*
*
* 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
*
*
*/
@Component
public final class ProductToGLAccountMappingFromApiJsonDeserializer {
@@ -207,7 +207,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue())
.value(incomeFromPenaltyId).notNull().integerGreaterThanZero();
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
final Long escheatLiabilityId = this.fromApiJsonHelper.extractLongNamed(
@@ -258,17 +258,17 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue())
.value(shareReferenceId).notNull().integerGreaterThanZero();
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue())
.value(shareSuspenseId).notNull().integerGreaterThanZero();
final Long incomeFromFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue())
.value(incomeFromFeeAccountId).notNull().integerGreaterThanZero();
final Long shareEquityId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue())
@@ -212,7 +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
*
*
* @param loanProductId
* @param changes
* @param element
@@ -129,7 +129,7 @@ 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)
*
*
* @param command
* @param element
* @param productId
@@ -156,7 +156,7 @@ 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)
*
*
* @param command
* @param element
* @param productId
@@ -242,7 +242,7 @@ public class ProductToGLAccountMappingHelper {
* 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 {
for (final ProductToGLAccountMapping chargeToIncomeAccountMapping : existingChargeToIncomeAccountMappings) {
@@ -328,7 +328,7 @@ public class ProductToGLAccountMappingHelper {
* 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 {
for (final ProductToGLAccountMapping existingPaymentChannelToFundSourceMapping : existingPaymentChannelToFundSourceMappings) {
@@ -417,7 +417,7 @@ public class ProductToGLAccountMappingHelper {
/**
* 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
* @param accountId
@@ -41,7 +41,7 @@ public interface ProductToGLAccountMappingReadPlatformService {
public List<ChargeToGLAccountMapper> fetchFeeToIncomeAccountMappingsForSavingsProduct(final Long savingsProductId);
public List<ChargeToGLAccountMapper> fetchPenaltyToIncomeAccountMappingsForSavingsProduct(final Long savingsProductId);
public Map<String, Object> fetchAccountMappingDetailsForShareProduct(final Long productId, final Integer accountingType);
public List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForShareProduct(final Long productId);
@@ -225,7 +225,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue());
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
@@ -103,7 +103,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
createOrmergeProductToAccountMappingChanges(element, paramName, productId, accountTypeId, changes,
GLAccountType.LIABILITY, PortfolioProductType.SAVING);
}
/*** Abstractions for payments channel related to savings products ***/
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
@@ -179,7 +179,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
*
*
* @param savingsProductId
* @param changes
* @param element
@@ -157,7 +157,7 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
*
*
* @param sharesProductId
* @param changes
* @param element
@@ -25,11 +25,11 @@ import java.util.Set;
public interface ProvisioningEntriesApiConstants {
public final static String JSON_DATE_PARAM = "date" ;
public final static String JSON_DATEFORMAT_PARAM = "dateFormat" ;
public final static String JSON_LOCALE_PARAM = "locale" ;
public final static String JSON_CREATEJOURNALENTRIES_PARAM = "createjournalentries" ;
public final static String PROVISIONINGENTRY_PARAM = "provisioningentry";
@@ -27,17 +27,17 @@ public class LoanProductProvisioningEntryData {
private final Long officeId;
private final String officeName ;
private final String currencyCode;
private final Long productId;
private final String productName ;
private final Long categoryId;
private final String categoryName ;
private final Long overdueInDays;
private final BigDecimal percentage;
@@ -45,21 +45,21 @@ public class LoanProductProvisioningEntryData {
private final BigDecimal balance;
private final BigDecimal amountreserved ;
private final Long liablityAccount;
private final String liabilityAccountCode ;
private final String liabilityAccountName ;
private final Long expenseAccount;
private final String expenseAccountCode ;
private final String expenseAccountName ;
private final Long criteriaId ;
public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String currencyCode, final Long productId,
final Long categoryId, final Long overdueInDays, final BigDecimal percentage, final BigDecimal balance, Long liablityAccount,
Long expenseAccount, final Long criteriaId) {
@@ -85,7 +85,7 @@ public class LoanProductProvisioningEntryData {
}
public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String officeName, final String currencyCode, final Long productId,
final String productName, final Long categoryId, final String categoryName, final Long overdueInDays, final BigDecimal amountReserved,
final String productName, final Long categoryId, final String categoryName, final Long overdueInDays, final BigDecimal amountReserved,
Long liablityAccount, String liabilityAccountglCode, String liabilityAccountName, Long expenseAccount, String expenseAccountglCode, String expenseAccountName, final Long criteriaId) {
this.historyId = historyId;
this.officeId = officeId;
@@ -146,7 +146,7 @@ public class LoanProductProvisioningEntryData {
public String getCurrencyCode() {
return this.currencyCode;
}
public Long getCriteriaId() {
return this.criteriaId ;
}
@@ -26,23 +26,23 @@ import java.util.Date;
public class ProvisioningEntryData {
private Long id ;
private Boolean journalEntry ;
private Long createdById ;
private String createdUser ;
Date createdDate ;
Long modifiedById ;
private String modifiedUser ;
private BigDecimal reservedAmount ;
private Collection<LoanProductProvisioningEntryData> provisioningEntries ;
public ProvisioningEntryData(final Long id, final Collection<LoanProductProvisioningEntryData> provisioningEntries) {
this.provisioningEntries = provisioningEntries ;
this.id = id ;
@@ -59,7 +59,7 @@ public class ProvisioningEntryData {
this.createdDate = createdDate ;
this.reservedAmount = totalReservedAmount ;
}
public void setEntries(Collection<LoanProductProvisioningEntryData> provisioningEntries) {
this.provisioningEntries = provisioningEntries ;
}
@@ -67,7 +67,7 @@ public class ProvisioningEntryData {
public Long getId() {
return this.id ;
}
public Date getCreatedDate() {
return this.createdDate ;
}
@@ -100,7 +100,7 @@ public class LoanProductProvisioningEntry extends AbstractPersistableCustom<Long
public void addReservedAmount(BigDecimal value) {
this.reservedAmount = this.reservedAmount.add(value);
}
public Office getOffice() {
return this.office;
}
@@ -43,10 +43,10 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
@Column(name = "journal_entry_created")
private Boolean isJournalEntryCreated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry", orphanRemoval = true, fetch=FetchType.EAGER)
private Set<LoanProductProvisioningEntry> provisioningEntries = new HashSet<>();
@OneToOne
@JoinColumn(name = "createdby_id")
private AppUser createdBy;
@@ -64,9 +64,9 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
private Date lastModifiedDate;
protected ProvisioningEntry() {
}
public ProvisioningEntry(AppUser createdBy, Date createdDate, AppUser lastModifiedBy, Date lastModifiedDate, Set<LoanProductProvisioningEntry> provisioningEntries ) {
this.provisioningEntries = provisioningEntries ;
this.createdBy = createdBy ;
@@ -74,22 +74,22 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
this.lastModifiedBy = lastModifiedBy ;
this.lastModifiedDate = lastModifiedDate ;
}
public void setProvisioningEntries(Collection<LoanProductProvisioningEntry> provisioningEntries) {
if(this.provisioningEntries == null) this.provisioningEntries = new HashSet<>();
if(this.provisioningEntries == null) this.provisioningEntries = new HashSet<>();
this.provisioningEntries.addAll(provisioningEntries) ;
}
public Collection<LoanProductProvisioningEntry> getLoanProductProvisioningEntries() {
return this.provisioningEntries ;
}
public void setJournalEntryCreated(Boolean bool) {
this.isJournalEntryCreated = bool ;
}
public Date getCreatedDate() {
return this.createdDate ;
}
}
@@ -27,10 +27,10 @@ import org.springframework.data.repository.query.Param;
public interface ProvisioningEntryRepository extends JpaRepository<ProvisioningEntry, Long>, JpaSpecificationExecutor<ProvisioningEntry> {
//OPENJPA throws error if we use entry
//OPENJPA throws error if we use entry
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = :createdDate")
ProvisioningEntry findByProvisioningEntryDate(@Param("createdDate") Date createdDate);
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = (select max(entry2.createdDate) from ProvisioningEntry entry2 where entry2.isJournalEntryCreated=true)")
ProvisioningEntry findExistingProvisioningEntryWithJournalEntries() ;
}
@@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
public class ReCreateProvisioningEntryRequestCommandHandler implements NewCommandSourceHandler {
private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService ;
@Autowired
public ReCreateProvisioningEntryRequestCommandHandler(
final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) {
@@ -30,16 +30,16 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
public interface ProvisioningEntriesReadPlatformService {
public Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(Date date) ;
public ProvisioningEntryData retrieveProvisioningEntryData(Long entryId) ;
public Page<ProvisioningEntryData> retrieveAllProvisioningEntries(Integer offset, Integer limit) ;
public ProvisioningEntryData retrieveProvisioningEntryData(String date) ;
public ProvisioningEntryData retrieveProvisioningEntryDataByCriteriaId(Long criteriaId) ;
public ProvisioningEntryData retrieveExistingProvisioningIdDateWithJournals() ;
public Page<LoanProductProvisioningEntryData> retrieveProvisioningEntries(SearchParameters searchParams) ;
}
@@ -225,12 +225,12 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
sqlBuilder.append(mapper.getSchema());
sqlBuilder.append(" order by entry.created_date");
if(limit != null ) {
sqlBuilder.append(" limit ").append(limit);
sqlBuilder.append(" limit ").append(limit);
}
if(offset != null) {
sqlBuilder.append(" offset ").append(offset);
sqlBuilder.append(" offset ").append(offset);
}
final String sqlCountRows = "SELECT FOUND_ROWS()";
Object[] whereClauseItemsitems = new Object[] {};
return this.provisioningEntryDataPaginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(),
@@ -25,10 +25,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
public interface ProvisioningEntriesWritePlatformService {
CommandProcessingResult createProvisioningEntries(JsonCommand command);
CommandProcessingResult reCreateProvisioningEntries(Long provisioningEntryId, JsonCommand command) ;
CommandProcessingResult createProvisioningJournalEntries(Long provisioningEntryId, JsonCommand command);
void generateLoanLossProvisioningAmount() ;
}
@@ -79,7 +79,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
private final JournalEntryWritePlatformService journalEntryWritePlatformService;
private final ProvisioningEntriesDefinitionJsonDeserializer fromApiJsonDeserializer;
private final FromJsonHelper fromApiJsonHelper;
@Autowired
public ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl(
final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService,
@@ -120,11 +120,11 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
existingEntryData.getId(), PortfolioProductType.PROVISIONING.getValue());
}
if(requestedEntry.getLoanProductProvisioningEntries() == null || requestedEntry.getLoanProductProvisioningEntries().size() == 0) {
requestedEntry.setJournalEntryCreated(Boolean.FALSE);
requestedEntry.setJournalEntryCreated(Boolean.FALSE);
}else {
requestedEntry.setJournalEntryCreated(Boolean.TRUE);
}
this.provisioningEntryRepository.save(requestedEntry);
this.journalEntryWritePlatformService.createProvisioningJournalEntries(requestedEntry);
}
@@ -156,7 +156,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
Date currentDate = DateUtils.getLocalDateOfTenant().toDate() ;
boolean addJournalEntries = true;
try {
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
if(criteriaCollection == null || criteriaCollection.size() == 0){
return ;
//FIXME: Do we need to throw NoProvisioningCriteriaDefinitionFound()?
@@ -171,7 +171,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
Date createdDate = parseDate(command);
boolean addJournalEntries = isJournalEntriesRequired(command);
try {
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
if(criteriaCollection == null || criteriaCollection.size() == 0){
throw new NoProvisioningCriteriaDefinitionFound() ;
}
@@ -29,7 +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.
*/
@@ -62,9 +62,9 @@ public class AdHocApiResource {
/**
* 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"));
private final PlatformSecurityContext context;
private final AdHocReadPlatformService adHocReadPlatformService;
private final DefaultToApiJsonSerializer<AdHocData> toApiJsonSerializer;
@@ -87,7 +87,7 @@ public class AdHocApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveAll(@Context final UriInfo uriInfo) {
this.context.authenticatedUser();
final Collection<AdHocData> adhocs = this.adHocReadPlatformService.retrieveAllAdHocQuery();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
@@ -149,7 +149,7 @@ public class AdHocApiResource {
}
/**
* Delete AdHocQuery
*
*
* @param adHocId
* @return
*/
@@ -22,7 +22,7 @@ import java.util.HashSet;
import java.util.Set;
/***
* Enum of all parameters passed in while creating/updating a AdHocQuery
* Enum of all parameters passed in while creating/updating a AdHocQuery
***/
public enum AdHocJsonInputParams {
ID("id"), NAME("name"),QUERY("query"),TABLENAME("tableName"), TABLEFIELDS("tableFields"), ISACTIVE("isActive"),
@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
/**
* Immutable data object represent note or case information AdHocData
*
*
*/
public class AdHocData {
@@ -53,12 +53,12 @@ public class AdHocData {
@SuppressWarnings("unused")
private final Long createdById;
@SuppressWarnings("unused")
private final Long updatedById;
private final Long updatedById;
@SuppressWarnings("unused")
private final DateTime updatedOn;
@SuppressWarnings("unused")
private final String createdBy;
private final List<EnumOptionData> reportRunFrequencies;
private final Long reportRunFrequency;
@@ -40,17 +40,17 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "name", length = 100)
private String name;
@Column(name = "query", length = 2000)
private String query;
@Column(name = "table_name", length = 100)
private String tableName;
@Column(name = "table_fields", length = 2000)
private String tableFields;
@Column(name = "email", length = 500)
private String email;
@@ -62,7 +62,7 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "IsActive", nullable = false)
private boolean isActive = false;
private AdHoc(final String name, final String query,final String tableName,final String tableFields ,final String email, final Long reportRunFrequency, final Long reportRunEvery, final boolean isActive) {
this.name = StringUtils.defaultIfEmpty(name, null);
this.query=StringUtils.defaultIfEmpty(query,null);
@@ -72,13 +72,13 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
this.reportRunFrequency = reportRunFrequency;
this.reportRunEvery = reportRunEvery;
this.isActive = BooleanUtils.toBooleanDefaultIfNull(isActive, false);
}
public static AdHoc fromJson(final JsonCommand command) {
final String name = command.stringValueOfParameterNamed(AdHocJsonInputParams.NAME.getValue());
String commandQuery=command.stringValueOfParameterNamed(AdHocJsonInputParams.QUERY.getValue());
SQLInjectionValidator.validateAdhocQuery(commandQuery);
final String query = commandQuery;
final String tableName = command.stringValueOfParameterNamed(AdHocJsonInputParams.TABLENAME.getValue());
@@ -89,7 +89,7 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
final boolean isActive = command.booleanPrimitiveValueOfParameterNamed(AdHocJsonInputParams.ISACTIVE.getValue());
return new AdHoc(name,query,tableName,tableFields, email, reportRunFrequency, reportRunEvery, isActive);
}
public Map<String, Object> update(final JsonCommand command) {
final Map<String, Object> actualChanges = new LinkedHashMap<>(7);
@@ -145,7 +145,7 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
}
return actualChanges;
}
public String getName() {
return name;
}
@@ -72,10 +72,10 @@ public final class AdHocDataValidator {
final String description = this.fromApiJsonHelper.extractStringNamed("query", element);
baseDataValidator.reset().parameter("query").value(description).notBlank().notExceedingLengthOf(2000);
final String tableName = this.fromApiJsonHelper.extractStringNamed("tableName", element);
baseDataValidator.reset().parameter("tableName").value(tableName).notBlank().notExceedingLengthOf(100);
final String tableFields = this.fromApiJsonHelper.extractStringNamed("tableFields", element);
baseDataValidator.reset().parameter("tableFields").value(tableFields).notBlank().notExceedingLengthOf(1000);
@@ -141,7 +141,7 @@ public final class AdHocDataValidator {
final Integer isActive = this.fromApiJsonHelper.extractIntegerNamed("isActive", element, Locale.getDefault());
baseDataValidator.reset().parameter("isActive").value(isActive).notNull().inMinMaxRange(1, 2);
}*/
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
@@ -30,5 +30,5 @@ public interface AdHocReadPlatformService {
AdHocData retrieveOne(Long adHocId);
AdHocData retrieveNewAdHocDetails();
}
@@ -100,7 +100,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
+ " r.report_run_frequency_code, r.report_run_every, r.last_run, "
+ " r.created_date as createdDate, r.createdby_id as createdById,cb.username as createdBy,r.lastmodifiedby_id as updatedById ,r.lastmodified_date as updatedOn "
+ " from m_adhoc r left join m_appuser cb on cb.id=r.createdby_id left join m_appuser mb on mb.id=r.lastmodifiedby_id";
}
}
@@ -109,5 +109,5 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
return AdHocData.template();
}
}
@@ -45,14 +45,14 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
private final static Logger logger = LoggerFactory.getLogger(AdHocScheduledJobRunnerServiceImpl.class);
private final AdHocReadPlatformService adHocReadPlatformService;
private final JdbcTemplate jdbcTemplate;
@Autowired
public AdHocScheduledJobRunnerServiceImpl(final RoutingDataSource dataSource,
final AdHocReadPlatformService adHocReadPlatformService
) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.adHocReadPlatformService = adHocReadPlatformService;
}
@Transactional
@@ -113,13 +113,13 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
} else {
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Skipping execution of " + adhoc.getName() + ", scheduled for execution on " + next);
}
});
});
}else{
logger.info(ThreadLocalContextUtil.getTenant().getName() + "Nothing to update ");
}
}
}
@@ -26,7 +26,7 @@ public interface AdHocWritePlatformService {
CommandProcessingResult createAdHocQuery(JsonCommand command);
CommandProcessingResult updateAdHocQuery(Long adHocId, JsonCommand command);
CommandProcessingResult deleteAdHocQuery(Long adHocId);
CommandProcessingResult disableAdHocQuery(Long adHocId);
@@ -42,7 +42,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
private final PlatformSecurityContext context;
private final AdHocRepository adHocRepository;
private final AdHocDataValidator adHocCommandFromApiJsonDeserializer;
@Autowired
public AdHocWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, final AdHocRepository adHocRepository,
@@ -50,7 +50,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
this.context = context;
this.adHocRepository = adHocRepository;
this.adHocCommandFromApiJsonDeserializer = adHocCommandFromApiJsonDeserializer;
}
@Transactional
@@ -50,9 +50,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.service.BatchApiService
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -70,11 +70,11 @@ public class BatchApiResource {
private final ToApiJsonSerializer<BatchResponse> toApiJsonSerializer;
private final BatchApiService service;
private final BatchRequestJsonHelper batchRequestJsonHelper;
/**
* Constructs a 'BatchApiService' with context, toApiJsonSerializer, service
* and batchRequestJsonHelper.
*
*
* @param context
* @param toApiJsonSerializer
* @param service
@@ -93,7 +93,7 @@ public class BatchApiResource {
/**
* Rest assured POST method to get {@link BatchRequest} and returns back the
* consolidated {@link BatchResponse}
*
*
* @param jsonRequestString
* @param enclosingTransaction
* @param uriInfo
@@ -22,16 +22,16 @@ 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.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.batch.service.BatchApiService
*/
public class CommandContext {
/**
* Static Builder class to provide a Build method for CommandContext.
*
*
* @author Rishabh Shukla
*/
public static class Builder {
@@ -72,7 +72,7 @@ public class CommandContext {
* 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
* @return boolean
*/
@@ -26,9 +26,9 @@ 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.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/
public interface CommandStrategy {
@@ -38,7 +38,7 @@ public interface CommandStrategy {
* {@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
* @return BatchResponse
@@ -28,9 +28,9 @@ import org.springframework.stereotype.Component;
/**
* Provides an appropriate CommandStrategy using the 'method' and 'resourceUrl'.
* CommandStrategy bean is created using Spring Application Context.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/
@Component
@@ -44,7 +44,7 @@ public class CommandStrategyProvider {
* type. It also initialize commandStrategies using init() function by
* filling it with available CommandStrategies in
* {@link org.apache.fineract.batch.command.internal}.
*
*
* @param applicationContext
*/
@Autowired
@@ -60,7 +60,7 @@ 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.
*
*
* @param commandContext
* @return CommandStrategy
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -62,7 +62,7 @@ public class ActivateClientCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String[] pathParameters = request.getRelativeUrl().split("/");
Long clientId = Long.parseLong(pathParameters[1].substring(0, pathParameters[1].indexOf("?")));
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -62,14 +62,14 @@ public class ApproveLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String[] pathParameters = request.getRelativeUrl().split("/");
Long loanId = Long.parseLong(pathParameters[1].substring(0, pathParameters[1].indexOf("?")));
// Try-catch blocks to map exceptions to appropriate status codes
try {
// Calls 'approve' function from 'LoansApiResource' to approve a loan
// Calls 'approve' function from 'LoansApiResource' to approve a loan
responseBody = loansApiResource.stateTransitions(loanId, "approve", request.getBody());
response.setStatusCode(200);
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -36,9 +36,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -62,18 +62,18 @@ public class DisburseLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String[] pathParameters = request.getRelativeUrl().split("/");
Long loanId = Long.parseLong(pathParameters[1].substring(0, pathParameters[1].indexOf("?")));
// Try-catch blocks to map exceptions to appropriate status codes
try {
// Calls 'disburse' function from 'LoansApiResource' to disburse a loan
// Calls 'disburse' function from 'LoansApiResource' to disburse a loan
responseBody = loansApiResource.stateTransitions(loanId, "disburse", request.getBody());
response.setStatusCode(200);
// Sets the body of the response after the successful disbursal of the loan
response.setBody(responseBody);
@@ -29,7 +29,7 @@ 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'.
*
*
* @author Rishabh Shukla
*/
@Component
@@ -37,9 +37,9 @@ import org.springframework.stereotype.Component;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
@@ -25,9 +25,9 @@ import java.util.Set;
* 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
*
*
* @see org.apache.fineract.batch.api.BatchApiResource
* @see Header
*/
@@ -43,7 +43,7 @@ public class BatchRequest {
/**
* Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers,
* reference and body of the incoming request.
*
*
* @param requestId
* of HTTP request.
* @param relativeUrl
@@ -56,7 +56,7 @@ public class BatchRequest {
* of HTTP request.
* @param body
* of HTTP request.
*
*
* @see Header
*/
public BatchRequest(Long requestId, String relativeUrl, String method, Set<Header> headers, Long reference, String body) {
@@ -78,7 +78,7 @@ public class BatchRequest {
/**
* Returns the value of 'requestId' of an object of this class.
*
*
* @return requestId of the HTTP request.
*/
public Long getRequestId() {
@@ -87,7 +87,7 @@ public class BatchRequest {
/**
* Sets the value of 'requestId' of an object of this class.
*
*
* @param requestId
*/
public void setRequestId(Long requestId) {
@@ -96,7 +96,7 @@ public class BatchRequest {
/**
* Returns the value of 'relativeUrl' of an object of this class.
*
*
* @return relativeUrl of the HTTP request.
*/
public String getRelativeUrl() {
@@ -105,7 +105,7 @@ public class BatchRequest {
/**
* Sets the value of 'relativeUrl' of an object of this class.
*
*
* @param relativeUrl
*/
public void setRelativeUrl(String relativeUrl) {
@@ -114,7 +114,7 @@ public class BatchRequest {
/**
* Returns the value of 'method' of an object of this class.
*
*
* @return method of the HTTP request.
*/
public String getMethod() {
@@ -123,7 +123,7 @@ public class BatchRequest {
/**
* Sets the value of 'method' of the object of this class.
*
*
* @param method
*/
public void setMethod(String method) {
@@ -133,7 +133,7 @@ public class BatchRequest {
/**
* Returns the values of 'headers' of {@link Header} type of an object of
* this class.
*
*
* @return headers of the HTTP request.
* @see Header
*/
@@ -144,7 +144,7 @@ public class BatchRequest {
/**
* Sets the values of 'headers' of {@link Header} type of an object of this
* class.
*
*
* @param headers
* @see Header
*/
@@ -154,7 +154,7 @@ public class BatchRequest {
/**
* Returns the value of 'reference' of an object of this class
*
*
* @return reference of the HTTP request
*/
public Long getReference() {
@@ -163,7 +163,7 @@ public class BatchRequest {
/**
* Sets the value of 'reference' of an object of this class.
*
*
* @param reference
*/
public void setReference(Long reference) {
@@ -172,7 +172,7 @@ public class BatchRequest {
/**
* Returns the value of 'body' of an object of this class.
*
*
* @return body of the HTTP request.
*/
public String getBody() {
@@ -181,7 +181,7 @@ public class BatchRequest {
/**
* Sets the value of 'body' of an object of this class.
*
*
* @param body
*/
public void setBody(String body) {
@@ -25,9 +25,9 @@ import java.util.Set;
* 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
*
*
* @see org.apache.fineract.batch.api.BatchApiResource
* @see org.apache.fineract.batch.service.BatchApiService
* @see Header
@@ -42,7 +42,7 @@ public class BatchResponse {
/**
* Constructs a 'BatchResponse' with requestId, statusCode, headers and body
* of the HTTP requests.
*
*
* @param requestId
* @param statusCode
* @param headers
@@ -65,7 +65,7 @@ public class BatchResponse {
/**
* Returns the 'requestId' of an object of this class.
*
*
* @return requestId of the HTTP request.
*/
public Long getRequestId() {
@@ -74,7 +74,7 @@ public class BatchResponse {
/**
* Sets the value of 'requestId' of an object of this class.
*
*
* @param requestId
*/
public void setRequestId(Long requestId) {
@@ -83,7 +83,7 @@ public class BatchResponse {
/**
* Returns the 'statusCode' of an object of this class.
*
*
* @return statusCode of the HTTP request.
*/
public Integer getStatusCode() {
@@ -92,7 +92,7 @@ public class BatchResponse {
/**
* Sets the value of 'statusCode' of an object of this class.
*
*
* @param statusCode
*/
public void setStatusCode(Integer statusCode) {
@@ -101,7 +101,7 @@ public class BatchResponse {
/**
* Returns the 'headers' of {@link Header} type of an object of this class.
*
*
* @return headers of the HTTP request.
* @see Header
*/
@@ -112,7 +112,7 @@ public class BatchResponse {
/**
* Sets the value of 'headers' of {@link Header} type of an object of this
* class.
*
*
* @param headers
* of {@link Header} Type
* @see Header
@@ -123,7 +123,7 @@ public class BatchResponse {
/**
* Returns the 'body' of an object of this class.
*
*
* @return body of the HTTP request.
*/
public String getBody() {
@@ -132,7 +132,7 @@ public class BatchResponse {
/**
* Sets the value of 'body' of an object of this class.
*
*
* @param body
*/
public void setBody(String body) {
@@ -22,9 +22,9 @@ 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.
*
*
* @author Rishabh Shukla
*
*
* @see BatchRequest
* @see BatchResponse
*/
@@ -35,7 +35,7 @@ public class Header {
/**
* Constructs a 'Header' with the name and value of HTTP headers.
*
*
* @param name
* of the HTTP header.
* @param value
@@ -55,7 +55,7 @@ public class Header {
/**
* Returns the 'name' data field of the object of this class.
*
*
* @return name data field of this class
*/
public String getName() {
@@ -64,7 +64,7 @@ public class Header {
/**
* Sets 'name' data field of this class.
*
*
* @param name
*/
public void setName(String name) {
@@ -73,7 +73,7 @@ public class Header {
/**
* Returns the 'value' data field of the object of this class.
*
*
* @return value data field of this class
*/
public String getValue() {
@@ -82,7 +82,7 @@ public class Header {
/**
* Sets 'value' data field of this class.
*
*
* @param value
*/
public void setValue(String value) {
@@ -44,9 +44,9 @@ import com.google.gson.GsonBuilder;
* 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
*
*
* @see org.apache.fineract.batch.command.CommandStrategy
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
*/
@@ -64,7 +64,7 @@ public class ErrorHandler extends RuntimeException {
/**
* Returns an object of ErrorInfo type containing the information regarding
* the raised error.
*
*
* @param exception
* @return ErrorInfo
*/
@@ -110,14 +110,14 @@ public class ErrorHandler extends RuntimeException {
final String errorBody = jsonHelper.toJson(mapper.toResponse((LinkedAccountRequiredException) exception).getEntity());
return new ErrorInfo(403, 3002, errorBody);
} else if (exception instanceof MultiDisbursementDataRequiredException) {
final PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper();
final String errorBody = jsonHelper.toJson(mapper.toResponse((MultiDisbursementDataRequiredException) exception).getEntity());
return new ErrorInfo(403, 3003, errorBody);
} else if (exception instanceof TransactionException) {
return new ErrorInfo(400, 4001, "{\"Exception\": " + exception.getMessage()+"}");
@@ -21,9 +21,9 @@ package org.apache.fineract.batch.exception;
/**
* Provides members to hold the basic information about the exceptions raised in
* commandStrategy classes.
*
*
* @author Rishabh Shukla
*
*
* @see ErrorHandler
*/
public final class ErrorInfo {
@@ -34,7 +34,7 @@ public final class ErrorInfo {
/**
* Constructor to initialize the members of this class.
*
*
* @param statusCode
* @param errorCode
* @param message
@@ -55,7 +55,7 @@ public final class ErrorInfo {
/**
* Getter method to provide the statusCode for an object of this type.
*
*
* @return Integer
*/
public Integer getStatusCode() {
@@ -64,7 +64,7 @@ public final class ErrorInfo {
/**
* Setter method to set the statusCode for an object of this type.
*
*
* @param statusCode
*/
public void setStatusCode(final Integer statusCode) {
@@ -73,7 +73,7 @@ public final class ErrorInfo {
/**
* Getter method to provide the errorCode for an object of this type.
*
*
* @return Integer
*/
public Integer getErrorCode() {
@@ -82,7 +82,7 @@ public final class ErrorInfo {
/**
* Setter method to set the errorCode for an object of this type.
*
*
* @param errorCode
*/
public void setErrorCode(final Integer errorCode) {
@@ -92,7 +92,7 @@ public final class ErrorInfo {
/**
* Getter method to provide the message of the error for an object of this
* type.
*
*
* @return String
*/
public String getMessage() {
@@ -101,7 +101,7 @@ public final class ErrorInfo {
/**
* Setter method to set the message of the error for an object of this type.
*
*
* @param message
*/
public void setMessage(final String message) {
@@ -32,9 +32,9 @@ import com.google.gson.reflect.TypeToken;
* {@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
*
*
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.infrastructure.core.serialization.FromJsonHelper
*/
@@ -44,7 +44,7 @@ public class BatchRequestJsonHelper extends FromJsonHelper {
/**
* Returns a list of batchRequests after de-serializing it from the input
* JSON string.
*
*
* @param json
* @return List&lt;BatchRequest&gt;
*/
@@ -28,9 +28,9 @@ import org.apache.fineract.batch.domain.BatchResponse;
/**
* Provides an interface for service class, that implements the method to handle
* separate Batch Requests.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
* @see BatchApiServiceImpl
@@ -42,7 +42,7 @@ public interface BatchApiService {
* 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
* @return List&lt;BatchResponse&gt;
@@ -56,7 +56,7 @@ public interface BatchApiService {
* 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
* @return List&lt;BatchResponse&gt;
@@ -50,9 +50,9 @@ import com.google.gson.Gson;
* Implementation for {@link BatchApiService} to iterate through all the
* incoming requests and obtain the appropriate CommandStrategy from
* CommandStrategyProvider.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
* @see org.apache.fineract.batch.command.CommandStrategyProvider
@@ -67,7 +67,7 @@ public class BatchApiServiceImpl implements BatchApiService {
/**
* Constructs a 'BatchApiServiceImpl' with an argument of
* {@link org.apache.fineract.batch.command.CommandStrategyProvider} type.
*
*
* @param strategyProvider
* @param resolutionHelper
* @param transactionTemplate
@@ -84,7 +84,7 @@ 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.
*
*
* @param requestList
* @param uriInfo
* @return List<BatchResponse>
@@ -37,7 +37,7 @@ import com.jayway.jsonpath.JsonModel;
* 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
*/
@@ -46,9 +46,9 @@ public class ResolutionHelper {
/**
* Provides a Node like object for the request tree.
*
*
* @author Rishabh shukla
*
*
*/
public class BatchRequestNode {
@@ -89,7 +89,7 @@ public class ResolutionHelper {
* 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;
*/
@@ -126,7 +126,7 @@ public class ResolutionHelper {
* 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
* @return BatchRequest
@@ -164,9 +164,9 @@ public class ResolutionHelper {
queryParams = relativeUrl.substring(relativeUrl.indexOf("?"));
relativeUrl = relativeUrl.substring(0, relativeUrl.indexOf("?"));
}
final String[] parameters = relativeUrl.split("/");
for (String parameter : parameters) {
if (parameter.contains("$.")) {
final String resParamValue = responseJsonModel.get(parameter).toString();
@@ -92,13 +92,13 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
@Column(name = "product_id")
private Long productId;
@Column(name = "transaction_id", length = 100)
private String transactionId;
@Column(name="creditbureau_id")
private Long creditBureauId;
@Column(name="organisation_creditbureau_id")
private Long organisationCreditBureauId;
@@ -126,21 +126,21 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
return this.creditBureauId;
}
public void setCreditBureauId(Long creditBureauId) {
this.creditBureauId = creditBureauId;
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public void setOrganisationCreditBureauId(Long OrganisationCreditBureauId) {
this.organisationCreditBureauId = OrganisationCreditBureauId;
}
public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) {
this.checker = checker;
this.checkedOnDate = checkedOnDate.toDate();
@@ -130,11 +130,11 @@ public class CommandWrapper {
this.creditBureauId=creditBureauId;
this.organisationCreditBureauId=organisationCreditBureauId;
}
public Long getCreditBureauId() {
return this.creditBureauId;
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
@@ -25,10 +25,10 @@ public class RollbackTransactionAsCommandIsNotApprovedByCheckerException extends
/**
* 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.
*
*
* 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.
@@ -207,7 +207,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
String updatedExtraCriteria = "";
if (StringUtils.isNotBlank(extraCriteria)) {
updatedExtraCriteria = " where (" + extraCriteria + ")";
updatedExtraCriteria = " where (" + extraCriteria + ")";
}
final AuditMapper rm = new AuditMapper();
@@ -259,7 +259,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
final AuditMapper rm = new AuditMapper();
String sql = "select " + rm.schema(includeJson, hierarchy);
Boolean isLimitedChecker = false;
if (useType.equals("makerchecker")) {
if (currentUser.hasNotPermissionForAnyOf("ALL_FUNCTIONS", "CHECKER_SUPER_USER")) {
@@ -275,7 +275,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
sql += extraCriteria;
if(isExtraCritereaIncluded){
this.columnValidator.validateSqlInjection(sql, extraCriteria);
}
}
logger.info("sql: " + sql);
return this.jdbcTemplate.query(sql, rm, new Object[] {});
@@ -29,7 +29,7 @@ public interface CommandProcessingService {
CommandProcessingResult processAndLogCommand(CommandWrapper wrapper, JsonCommand command, boolean isApprovedByChecker);
CommandProcessingResult logCommand(CommandSource commandSourceResult);
boolean validateCommand(final CommandWrapper commandWrapper,final AppUser user);
}
@@ -44,14 +44,14 @@ public class CommandWrapperBuilder {
private Long templateId;
private Long creditBureauId;
private Long organisationCreditBureauId;
public CommandWrapper build() {
return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.savingsId, this.actionName,
this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId,
this.templateId,this.creditBureauId,this.organisationCreditBureauId);
}
public CommandWrapperBuilder updateCreditBureau() {
this.actionName = "UPDATE";
this.entityName = "ORGANISATIONCREDITBUREAU";
@@ -59,7 +59,7 @@ public class CommandWrapperBuilder {
this.href = "/creditBureauConfiguration/template";
return this;
}
public CommandWrapperBuilder updateCreditBureauLoanProductMapping() {
this.actionName = "UPDATE";
this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
@@ -67,7 +67,7 @@ public class CommandWrapperBuilder {
this.href = "/creditBureauConfiguration/template";
return this;
}
public CommandWrapperBuilder addOrganisationCreditBureau(final long organisationCreditBureauId) {
this.actionName = "CREATE";
this.entityName = "ORGANISATIONCREDITBUREAU";
@@ -76,7 +76,7 @@ public class CommandWrapperBuilder {
this.organisationCreditBureauId=organisationCreditBureauId;
return this;
}
public CommandWrapperBuilder createCreditBureauLoanProductMapping(final long CreditBureauId) {
this.actionName = "CREATE";
this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
@@ -85,7 +85,7 @@ public class CommandWrapperBuilder {
this.creditBureauId=CreditBureauId;
return this;
}
public CommandWrapperBuilder addClientAddress(final long clientId,final long addressTypeId) {
this.actionName = "CREATE";
this.entityName = "ADDRESS";
@@ -94,7 +94,7 @@ public class CommandWrapperBuilder {
this.clientId=clientId;
return this;
}
public CommandWrapperBuilder updateClientAddress(final long clientId) {
this.actionName = "UPDATE";
this.entityName = "ADDRESS";
@@ -102,8 +102,8 @@ public class CommandWrapperBuilder {
this.clientId=clientId;
return this;
}
public CommandWrapperBuilder addFamilyMembers(final long clientId) {
this.actionName = "CREATE";
this.entityName = "FAMILYMEMBERS";
@@ -111,7 +111,7 @@ public class CommandWrapperBuilder {
this.clientId=clientId;
return this;
}
public CommandWrapperBuilder updateFamilyMembers(final long familyMemberId) {
this.actionName = "UPDATE";
this.entityName = "FAMILYMEMBERS";
@@ -119,7 +119,7 @@ public class CommandWrapperBuilder {
this.entityId=familyMemberId;
return this;
}
public CommandWrapperBuilder deleteFamilyMembers(final long familyMemberId) {
this.actionName = "DELETE";
this.entityName = "FAMILYMEMBERS";
@@ -127,7 +127,7 @@ public class CommandWrapperBuilder {
this.entityId=familyMemberId;
return this;
}
public CommandWrapperBuilder withLoanId(final Long withLoanId) {
this.loanId = withLoanId;
return this;
@@ -2310,7 +2310,7 @@ public class CommandWrapperBuilder {
this.href = "/savingsaccounts/" + accountId + "?commad=unassignSavingsOfficer";
return this;
}
public CommandWrapperBuilder SavingsInterestPostingAsOnDate(final Long accountId) {
this.actionName = "POSTINTERESTASONDATE";
this.entityName = "SAVINGSACCOUNT";
@@ -2761,7 +2761,7 @@ public class CommandWrapperBuilder {
this.href = "/shareproduct/" + productId + "/dividend/" + dividendId;
return this;
}
public CommandWrapperBuilder deleteShareProductDividendPayoutCommand(final Long productId, final Long dividendId) {
this.entityName = "SHAREPRODUCT";
this.actionName = "DELETE_DIVIDEND";
@@ -2769,7 +2769,7 @@ public class CommandWrapperBuilder {
this.href = "/shareproduct/" + productId + "/dividend/" + dividendId;
return this;
}
public CommandWrapperBuilder createAccountCommand(String accountType, final Long accountId, String command) {
this.entityName = accountType.toUpperCase()+"ACCOUNT" ;
this.actionName = command.toUpperCase();
@@ -2777,7 +2777,7 @@ public class CommandWrapperBuilder {
this.href = "/accounts/" + accountType+"/"+accountId+"?command="+command;
return this;
}
public CommandWrapperBuilder createTaxComponent() {
this.actionName = "CREATE";
this.entityName = "TAXCOMPONENT";
@@ -2809,7 +2809,7 @@ public class CommandWrapperBuilder {
this.href = "/taxes/group/" + taxGroupId;
return this;
}
public CommandWrapperBuilder updateWithHoldTax(final Long accountId) {
this.actionName = "UPDATEWITHHOLDTAX";
this.entityName = "SAVINGSACCOUNT";
@@ -2867,7 +2867,7 @@ public class CommandWrapperBuilder {
this.href = "/reportmailingjobs";
return this;
}
public CommandWrapperBuilder updateReportMailingJob(final String entityName, final Long entityId) {
this.actionName = "UPDATE";
this.entityName = entityName;
@@ -2875,7 +2875,7 @@ public class CommandWrapperBuilder {
this.href = "/reportmailingjobs/" + entityId;
return this;
}
public CommandWrapperBuilder deleteReportMailingJob(final String entityName, final Long entityId) {
this.actionName = "DELETE";
this.entityName = entityName;
@@ -2883,7 +2883,7 @@ public class CommandWrapperBuilder {
this.href = "/reportmailingjobs/" + entityId;
return this;
}
public CommandWrapperBuilder createSmsCampaign() {
this.actionName = "CREATE";
this.entityName = "SMSCAMPAIGN";
@@ -2891,7 +2891,7 @@ public class CommandWrapperBuilder {
this.href = "/smscampaigns";
return this;
}
public CommandWrapperBuilder updateSmsCampaign(final Long resourceId) {
this.actionName = "UPDATE";
this.entityName = "SMSCAMPAIGN";
@@ -2899,7 +2899,7 @@ public class CommandWrapperBuilder {
this.href = "/smscampaigns/"+resourceId;
return this;
}
public CommandWrapperBuilder activateSmsCampaign(final Long resourceId) {
this.actionName = "ACTIVATE";
this.entityName = "SMSCAMPAIGN";
@@ -2922,7 +2922,7 @@ public class CommandWrapperBuilder {
this.href = "/smscampaigns/"+resourceId + "?command=reactivate";
return this;
}
public CommandWrapperBuilder deleteSmsCampaign(final Long resourceId) {
this.actionName = "DELETE";
this.entityName = "SMSCAMPAIGN";
@@ -3133,14 +3133,14 @@ public class CommandWrapperBuilder {
this.href = "/twofactor/configure";
return this;
}
public CommandWrapperBuilder linkAccountsToPocket() {
this.actionName = PocketApiConstants.linkAccountsActionName;
this.entityName = PocketApiConstants.pocketEntityName;
this.href = "/self/pocket?command="+PocketApiConstants.linkAccountsToPocketCommandParam;
return this;
}
public CommandWrapperBuilder delinkAccountsFromPocket() {
this.actionName = PocketApiConstants.delinkAccountsActionName;
this.entityName = PocketApiConstants.pocketEntityName;
@@ -212,7 +212,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
final String authToken = ThreadLocalContextUtil.getAuthToken();
final String tenantIdentifier = ThreadLocalContextUtil.getTenant().getTenantIdentifier();
final AppUser appUser = this.context.authenticatedUser(CommandWrapper.wrap(actionName,
final AppUser appUser = this.context.authenticatedUser(CommandWrapper.wrap(actionName,
entityName, null, null));
final HookEventSource hookEventSource = new HookEventSource(entityName, actionName);
@@ -125,7 +125,7 @@ public class AccountNumberFormatDataValidator {
case CENTER:
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForCenters;
break;
case GROUP:
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
break;
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.Map;
public enum EntityAccountType {
CLIENT(1, "accountType.client"), LOAN(2, "accountType.loan"), SAVINGS(3, "accountType.savings"), CENTER(4, "accountType.center"),
CLIENT(1, "accountType.client"), LOAN(2, "accountType.loan"), SAVINGS(3, "accountType.savings"), CENTER(4, "accountType.center"),
GROUP(5, "accountType.group"), SHARES(6, "accountType.shares");
private final Integer value;
@@ -90,11 +90,11 @@ public enum EntityAccountType {
public boolean isSavingsAccount() {
return this.value.equals(EntityAccountType.SAVINGS.getValue());
}
public Boolean isCenterAccount(){
return this.value.equals(EntityAccountType.CENTER.getValue());
}
public Boolean isGroupAccount(){
return this.value.equals(EntityAccountType.GROUP.getValue());
}
@@ -137,7 +137,7 @@ public class AccountNumberFormatWritePlatformServiceJpaRepositoryImpl implements
.build();
}
/*
* Guaranteed to throw an exception no matter what the data integrity issue
* is.
@@ -86,11 +86,11 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
throw new IllegalArgumentException("ParseException");
}
}
protected void writeBigDecimal(int colIndex, Row row, BigDecimal value) {
row.createCell(colIndex).setCellValue(((value != null) ? value.doubleValue() : 0));
}
protected void setOfficeDateLookupTable(Sheet sheet, List<OfficeData> offices, int officeNameCol,
int activationDateCol,String dateFormat) {
if(offices!=null){
@@ -152,7 +152,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
if (group.getActivationDate() != null) {
date = inputFormat.parse(group.getActivationDate().toString());
writeDate(activationDateCol, row, outputFormat.format(date), dateCellStyle, dateFormat);
}
}
}
}
@@ -41,7 +41,7 @@ public class ExtrasSheetPopulator extends AbstractWorkbookPopulator {
private static final int CURRENCY_CODE_COL = 4;
private static final int CURRENCY_NAME_COL = 5;
public ExtrasSheetPopulator(List<FundData> funds, List<PaymentTypeData> paymentTypes,
List<CurrencyData> currencies) {
this.funds = funds;
@@ -111,6 +111,6 @@ public class ExtrasSheetPopulator extends AbstractWorkbookPopulator {
return currencies.size();
}
}
@@ -34,7 +34,7 @@ import java.util.Map;
public class GroupSheetPopulator extends AbstractWorkbookPopulator {
private List<GroupGeneralData> groups;
private List<OfficeData> offices;
private Map<String, ArrayList<String>> officeToGroups;
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfGroups;
private Map<String,Long> groupNameToGroupId;
@@ -91,10 +91,10 @@ public class GroupSheetPopulator extends AbstractWorkbookPopulator {
startIndex = rowIndex+1;
writeString(OFFICE_NAME_COL, row, office.name());
ArrayList<String> groupsList = new ArrayList<>();
if(officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_")))
groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_"));
if(!groupsList.isEmpty()) {
for(String groupName : groupsList) {
writeString(GROUP_NAME_COL, row, groupName);
@@ -31,7 +31,7 @@ import java.util.List;
public class LoanProductSheetPopulator extends AbstractWorkbookPopulator {
private List<LoanProductData> products;
private static final int ID_COL = 0;
private static final int NAME_COL = 1;
private static final int FUND_NAME_COL = 2;
@@ -58,8 +58,8 @@ public class LoanProductSheetPopulator extends AbstractWorkbookPopulator {
private static final int START_DATE_COL = 23;
private static final int CLOSE_DATE_COL = 24;
public LoanProductSheetPopulator(List<LoanProductData> products) {
this.products = products;
}
@@ -191,7 +191,7 @@ public class LoanProductSheetPopulator extends AbstractWorkbookPopulator {
}
public List<LoanProductData> getProducts(){
return products;
}
public Integer getProductsSize() {
return products.size();
@@ -70,7 +70,7 @@ public class OfficeSheetPopulator extends AbstractWorkbookPopulator {
public List<OfficeData> getOffices() {
return offices;
}
public List<String> getOfficeNames() {
List<String> officeNames=new ArrayList<>();
for (OfficeData office : offices) {
@@ -78,5 +78,5 @@ public class OfficeSheetPopulator extends AbstractWorkbookPopulator {
}
return officeNames;
}
}
@@ -53,7 +53,7 @@ public class SharedProductsSheetPopulator extends AbstractWorkbookPopulator {
public SharedProductsSheetPopulator(List<ShareProductData> shareProductDataList,List<ChargeData> chargesForShares) {
this.sharedProductDataList=shareProductDataList;
this.chargesForSharedProducts=chargesForShares;
}
@Override
@@ -58,7 +58,7 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
setLookupTable(centerSheet,dateFormat);
setRules(centerSheet,dateFormat);
}
private void setLayout(Sheet worksheet) {
Row rowHeader = worksheet.createRow(0);
@@ -113,7 +113,7 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
row = centerSheet.createRow(rowIndex);
writeInt(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
}
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
writeInt(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, centerSheet.getRow(rowIndex), rowIndex);
String[] days = new String[]{
@@ -127,7 +127,7 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
for(rowIndex = 1; rowIndex <= 7; rowIndex++)
writeString(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, centerSheet.getRow(rowIndex), days[rowIndex-1]);
}
private void setRules(Sheet worksheet,String dateFormat) {
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.OFFICE_NAME_COL,CenterConstants. OFFICE_NAME_COL);
@@ -140,12 +140,12 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
CellRangeAddressList repeatsRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.FREQUENCY_COL, CenterConstants.FREQUENCY_COL);
CellRangeAddressList repeatsEveryRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.INTERVAL_COL,CenterConstants. INTERVAL_COL);
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.REPEATS_ON_DAY_COL,CenterConstants. REPEATS_ON_DAY_COL);
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
List<OfficeData> offices = officeSheetPopulator.getOffices();
setNames(worksheet, offices);
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
DataValidationConstraint staffNameConstraint = validationHelper.
@@ -180,7 +180,7 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
worksheet.addValidationData(activeValidation);
worksheet.addValidationData(officeValidation);
@@ -193,14 +193,14 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
worksheet.addValidationData(repeatsEveryValidation);
worksheet.addValidationData(repeatsOnValidation);
}
private void setNames(Sheet worksheet, List<OfficeData> offices) {
Workbook centerWorkbook = worksheet.getWorkbook();
Name officeCenter = centerWorkbook.createName();
officeCenter.setNameName("Office");
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME +"!$B$2:$B$" + (offices.size() + 1));
//Repeat constraint names
Name repeatsDaily = centerWorkbook.createName();
repeatsDaily.setNameName("Daily");
@@ -217,8 +217,8 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
Name repeatsOnWeekly = centerWorkbook.createName();
repeatsOnWeekly.setNameName("Weekly_Days");
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IV$2:$IV$8");
//Staff Names for each office
for(Integer i = 0; i < offices.size(); i++) {
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
@@ -228,8 +228,8 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
}
}
}
}
@@ -215,7 +215,7 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_ACCOUNT_ID_COL,TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_TAG_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
writeString(ChartOfAcountsConstants.ACCOUNT_TYPE_COL,rowHeader,"Account Type*");
writeString(ChartOfAcountsConstants.GL_CODE_COL,rowHeader,"GL Code *");
writeString(ChartOfAcountsConstants.ACCOUNT_USAGE_COL,rowHeader,"Account Usage *");
@@ -354,7 +354,7 @@ public class ClientPersonWorkbookPopulator extends AbstractWorkbookPopulator {
countryGroup.setNameName("Country");
countryGroup.setRefersToFormula(TemplatePopulateImportConstants.CLIENT_PERSON_SHEET_NAME+"!$AQ$2:$AQ$" +
(countryCodeValues.size() + 1));
for (Integer i = 0; i < offices.size(); i++) {
Integer[] officeNameToBeginEndIndexesOfStaff =
personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
@@ -116,7 +116,7 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
row = groupSheet.createRow(rowIndex);
writeInt(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
}
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
writeInt(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, groupSheet.getRow(rowIndex), rowIndex);
String[] days = new String[]{
TemplatePopulateImportConstants.MONDAY,
@@ -126,10 +126,10 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
TemplatePopulateImportConstants.FRIDAY,
TemplatePopulateImportConstants.SATURDAY,
TemplatePopulateImportConstants.SUNDAY};
for(rowIndex = 1; rowIndex <= 7; rowIndex++)
for(rowIndex = 1; rowIndex <= 7; rowIndex++)
writeString(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, groupSheet.getRow(rowIndex), days[rowIndex-1]);
}
private void setRules(Sheet worksheet,String dateFormat){
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
GroupConstants.OFFICE_NAME_COL, GroupConstants.OFFICE_NAME_COL);
@@ -153,11 +153,11 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
GroupConstants.INTERVAL_COL,GroupConstants. INTERVAL_COL);
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
GroupConstants.REPEATS_ON_DAY_COL, GroupConstants.REPEATS_ON_DAY_COL);
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
List<OfficeData> offices = officeSheetPopulator.getOffices();
setNames(worksheet, offices);
DataValidationConstraint centerNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Center_\",$B1))");
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
DataValidationConstraint staffNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Staff_\",$B1))");
@@ -178,7 +178,7 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
TemplatePopulateImportConstants.FREQUENCY_YEARLY});
DataValidationConstraint repeatsEveryConstraint = validationHelper.createFormulaListConstraint("INDIRECT($K1)");
DataValidationConstraint repeatsOnConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE($K1,\"_DAYS\"))");
DataValidation centerValidation=validationHelper.createValidation(centerNameConstraint, centerNameRange);
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
DataValidation staffValidation = validationHelper.createValidation(staffNameConstraint, staffNameRange);
@@ -190,7 +190,7 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
worksheet.addValidationData(centerValidation);
worksheet.addValidationData(activeValidation);
worksheet.addValidationData(officeValidation);
@@ -203,14 +203,14 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
worksheet.addValidationData(repeatsEveryValidation);
worksheet.addValidationData(repeatsOnValidation);
}
private void setNames(Sheet worksheet, List<OfficeData> offices) {
Workbook centerWorkbook = worksheet.getWorkbook();
Name officeCenter = centerWorkbook.createName();
officeCenter.setNameName("Office");
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (offices.size() + 1));
//Repeat constraint names
Name repeatsDaily = centerWorkbook.createName();
repeatsDaily.setNameName("Daily");
@@ -227,11 +227,11 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
Name repeatsOnWeekly = centerWorkbook.createName();
repeatsOnWeekly.setNameName("Weekly_Days");
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IV$2:$IV$8");
//Staff Names for each office & center Names for each office
//Staff Names for each office & center Names for each office
for(Integer i = 0; i < offices.size(); i++) {
Integer[] officeNameToBeginEndIndexesOfCenters =centerSheetPopulator.getOfficeNameToBeginEndIndexesOfCenters().get(i);
Integer[] officeNameToBeginEndIndexesOfCenters =centerSheetPopulator.getOfficeNameToBeginEndIndexesOfCenters().get(i);
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
Name loanOfficerName = centerWorkbook.createName();
@@ -248,7 +248,7 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
"!$B$" + officeNameToBeginEndIndexesOfCenters[0] + ":$B$" + officeNameToBeginEndIndexesOfCenters[1]);
}
}
}
}
@@ -113,7 +113,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
writeString(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, rowHeader, "Lookup Loan Account");
writeString(GuarantorConstants.LOOKUP_SAVINGS_CLIENT_NAME_COL, rowHeader, "Savings Lookup Client");
writeString(GuarantorConstants.LOOKUP_SAVINGS_ACCOUNT_NO_COL, rowHeader, "Savings Lookup Account");
}
private void populateSavingsTable(Sheet addGuarantorSheet,String dateFormat) {
Workbook workbook = addGuarantorSheet.getWorkbook();
@@ -189,11 +189,11 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
GuarantorConstants.GUARANTO_TYPE_COL, GuarantorConstants.GUARANTO_TYPE_COL);
CellRangeAddressList guranterRelationshipTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL);
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
setNames(worksheet);
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
DataValidationConstraint clientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$A1))");
DataValidationConstraint accountNumberConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Account_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($B1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
@@ -204,7 +204,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
DataValidationConstraint guarantorRelationshipConstraint = validationHelper.createFormulaListConstraint("GuarantorRelationship");
DataValidationConstraint entityofficeNameConstraint = validationHelper.createFormulaListConstraint("Office");
DataValidationConstraint entityclientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$F1))");
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
DataValidation clientValidation = validationHelper.createValidation(clientNameConstraint, clientNameRange);
DataValidation accountNumberValidation = validationHelper.createValidation(accountNumberConstraint, accountNumberRange);
@@ -213,8 +213,8 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
DataValidation guarantorRelationshipValidation=validationHelper.createValidation(guarantorRelationshipConstraint,guranterRelationshipTypeRange);
DataValidation entityofficeValidation = validationHelper.createValidation(entityofficeNameConstraint, entityofficeNameRange);
DataValidation entityclientValidation = validationHelper.createValidation(entityclientNameConstraint, entityclientNameRange);
worksheet.addValidationData(officeValidation);
worksheet.addValidationData(clientValidation);
worksheet.addValidationData(accountNumberValidation);
@@ -223,12 +223,12 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
worksheet.addValidationData(entityofficeValidation);
worksheet.addValidationData(entityclientValidation);
worksheet.addValidationData(savingsaccountNumberValidation);
}
private void setNames(Sheet worksheet) {
Workbook addGurarantorWorkbook = worksheet.getWorkbook();
ArrayList<String> officeNames = new ArrayList<String>(officeSheetPopulator.getOfficeNames());
//Office Names
Name officeGroup = addGurarantorWorkbook.createName();
officeGroup.setNameName("Office");
@@ -238,7 +238,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
Name guarantorRelationshipsGroup = addGurarantorWorkbook.createName();
guarantorRelationshipsGroup.setNameName("GuarantorRelationship");
guarantorRelationshipsGroup.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CH$2:$CH$" + (guarantorRelationshipTypes.size() + 1));
//Clients Named after Offices
for(Integer i = 0; i < officeNames.size(); i++) {
Integer[] officeNameToBeginEndIndexesOfClients = clientSheetPopulator.getOfficeNameToBeginEndIndexesOfClients().get(i);
@@ -249,7 +249,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
":$B$" + officeNameToBeginEndIndexesOfClients[1]);
}
}
//Counting clients with active loans and starting and end addresses of cells
HashMap<String, Integer[]> clientNameToBeginEndIndexes = new HashMap<String, Integer[]>();
ArrayList<String> clientsWithActiveLoans = new ArrayList<String>();
@@ -272,7 +272,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
}
}
//Account Number Named after Clients
for(int j = 0; j < clientsWithActiveLoans.size(); j++) {
Name name = addGurarantorWorkbook.createName();
@@ -308,7 +308,7 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
name.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[0] +
":$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[1]);
}
}
}
@@ -34,7 +34,7 @@ import java.util.ArrayList;
public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
private OfficeSheetPopulator officeSheetPopulator;
private GlAccountSheetPopulator glAccountSheetPopulator;
private ExtrasSheetPopulator extrasSheetPopulator;
@@ -56,7 +56,7 @@ public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
setDefaults(addJournalEntriesSheet);
setLayout(addJournalEntriesSheet);
}
private void setLayout(Sheet worksheet) {
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
@@ -95,9 +95,9 @@ public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
// TODO Auto-generated method stub
}
private void setRules(Sheet worksheet) {
CellRangeAddressList officeNameRange = new CellRangeAddressList(1,
SpreadsheetVersion.EXCEL97.getLastRowIndex(),
JournalEntryConstants.OFFICE_NAME_COL,JournalEntryConstants. OFFICE_NAME_COL);
@@ -152,7 +152,7 @@ public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
worksheet.addValidationData(glaccountCreditValidation);
worksheet.addValidationData(glaccountDebitValidation);
}
private void setNames(Sheet worksheet) {
Workbook addJournalEntriesWorkbook = worksheet.getWorkbook();
ArrayList<String> officeNames = new ArrayList<>(officeSheetPopulator.getOfficeNames());
@@ -178,7 +178,7 @@ public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
glaccountGroup.setRefersToFormula(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME+"!$B$2:$B$"
+ (glAccountSheetPopulator.getGlAccountNamesSize() + 1));
}
private void setDefaults(Sheet worksheet) {
for (Integer rowNo = 1; rowNo < 1000; rowNo++) {
Row row = worksheet.createRow(rowNo);
@@ -186,6 +186,6 @@ public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
}
}
@@ -116,7 +116,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
private final ChargeReadPlatformService chargeReadPlatformService;
private final DepositProductReadPlatformService depositProductReadPlatformService;
private final RoleReadPlatformService roleReadPlatformService;
@Autowired
public BulkImportWorkbookPopulatorServiceImpl(final PlatformSecurityContext context,
final OfficeReadPlatformService officeReadPlatformService,
@@ -324,7 +324,7 @@ private WorkbookPopulator populateCenterWorkbook(Long officeId,Long staffId){
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
centers = (List<CenterData>)centerReadPlatformService.retrieveAll(searchParameters,null);
}
return centers;
}
private List<ClientData> fetchClients(Long officeId) {
@@ -103,7 +103,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
// extension we use this fix.
throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension",
"Uploaded file extension is not recognized.");
}
Workbook workbook = new HSSFWorkbook(clonedInputStreamWorkbook);
GlobalEntityType entityType=null;
@@ -38,7 +38,7 @@ import org.springframework.stereotype.Component;
/**
* 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
@@ -54,7 +54,7 @@ public enum CampaignType {
}
return type;
}
public static EnumOptionData campaignType(final Integer campaignTypeId) {
return campaignType(CampaignType.fromInt(campaignTypeId));
}
@@ -27,11 +27,11 @@ public class ScheduledEmailConstants {
// define the API resource entity name
public static final String SCHEDULED_EMAIL_ENTITY_NAME = "SCHEDULEDEMAIL";
// general API resource request parameter constants
public static final String LOCALE_PARAM_NAME = "locale";
public static final String DATE_FORMAT_PARAM_NAME = "dateFormat";
// parameter constants for create/update entity API request
public static final String NAME_PARAM_NAME = "name";
public static final String DESCRIPTION_PARAM_NAME = "description";
@@ -44,7 +44,7 @@ public class ScheduledEmailConstants {
public static final String STRETCHY_REPORT_ID_PARAM_NAME = "stretchyReportId";
public static final String STRETCHY_REPORT_PARAM_MAP_PARAM_NAME = "stretchyReportParamMap";
public static final String IS_ACTIVE_PARAM_NAME = "isActive";
// other parameter constants
public static final String ID_PARAM_NAME = "id";
public static final String EMAIL_ATTACHMENT_FILE_FORMAT_PARAM_NAME = "emailAttachmentFileFormat";
@@ -55,29 +55,29 @@ public class ScheduledEmailConstants {
public static final String PREVIOUS_RUN_ERROR_MESSAGE = "previousRunErrorMessage";
public static final String NUMBER_OF_RUNS = "numberOfRuns";
public static final String STRETCHY_REPORT_PARAM_NAME = "stretchyReport";
// list of permitted parameters for the create report mailing job request
public static final Set<String> CREATE_REQUEST_PARAMETERS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(LOCALE_PARAM_NAME, DATE_FORMAT_PARAM_NAME,
NAME_PARAM_NAME, DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME,
EMAIL_MESSAGE_PARAM_NAME, EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME, STRETCHY_REPORT_ID_PARAM_NAME,
NAME_PARAM_NAME, DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME,
EMAIL_MESSAGE_PARAM_NAME, EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME, STRETCHY_REPORT_ID_PARAM_NAME,
STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, IS_ACTIVE_PARAM_NAME, START_DATE_TIME_PARAM_NAME)));
// list of permitted parameters for the update report mailing job request
public static final Set<String> UPDATE_REQUEST_PARAMETERS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(LOCALE_PARAM_NAME, DATE_FORMAT_PARAM_NAME,
NAME_PARAM_NAME, DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME,
EMAIL_MESSAGE_PARAM_NAME, EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME, STRETCHY_REPORT_ID_PARAM_NAME,
NAME_PARAM_NAME, DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME,
EMAIL_MESSAGE_PARAM_NAME, EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME, STRETCHY_REPORT_ID_PARAM_NAME,
STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, IS_ACTIVE_PARAM_NAME, START_DATE_TIME_PARAM_NAME)));
// list of parameters that represent the properties of a report mailing job
public static final Set<String> REPORT_MAILING_JOB_DATA_PARAMETERS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(ID_PARAM_NAME, NAME_PARAM_NAME,
DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME, EMAIL_MESSAGE_PARAM_NAME,
EMAIL_ATTACHMENT_FILE_FORMAT_PARAM_NAME, STRETCHY_REPORT_PARAM_NAME, STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, IS_ACTIVE_PARAM_NAME,
START_DATE_TIME_PARAM_NAME, PREVIOUS_RUN_DATE_TIME_PARAM_NAME, NEXT_RUN_DATE_TIME_PARAM_NAME, PREVIOUS_RUN_STATUS,
DESCRIPTION_PARAM_NAME, RECURRENCE_PARAM_NAME, EMAIL_RECIPIENTS_PARAM_NAME, EMAIL_SUBJECT_PARAM_NAME, EMAIL_MESSAGE_PARAM_NAME,
EMAIL_ATTACHMENT_FILE_FORMAT_PARAM_NAME, STRETCHY_REPORT_PARAM_NAME, STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, IS_ACTIVE_PARAM_NAME,
START_DATE_TIME_PARAM_NAME, PREVIOUS_RUN_DATE_TIME_PARAM_NAME, NEXT_RUN_DATE_TIME_PARAM_NAME, PREVIOUS_RUN_STATUS,
PREVIOUS_RUN_ERROR_LOG, PREVIOUS_RUN_ERROR_MESSAGE, NUMBER_OF_RUNS)));
// report mailing job configuration names
public static final String GMAIL_SMTP_SERVER = "GMAIL_SMTP_SERVER";
public static final String GMAIL_SMTP_PORT = "GMAIL_SMTP_PORT";

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