Skip to content

Commit

Permalink
FINERACT-1932: Add starter Configuration class for portfolio.savings …
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
mmagdiab authored and vidakovic committed Oct 31, 2023
1 parent 30ad4f5 commit dc3b94d
Show file tree
Hide file tree
Showing 25 changed files with 488 additions and 281 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
Expand All @@ -45,15 +46,13 @@
import org.apache.fineract.portfolio.savings.data.DepositAccountInterestRateChartData;
import org.apache.fineract.portfolio.savings.data.DepositAccountInterestRateChartSlabData;
import org.apache.fineract.portfolio.savings.exception.DepositAccountInterestRateChartNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class DepositAccountInterestRateChartReadPlatformServiceImpl implements DepositAccountInterestRateChartReadPlatformService {

private final PlatformSecurityContext context;
Expand All @@ -64,19 +63,6 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D
private final InterestIncentiveDropdownReadPlatformService interestIncentiveDropdownReadPlatformService;
private final CodeValueReadPlatformService codeValueReadPlatformService;

@Autowired
public DepositAccountInterestRateChartReadPlatformServiceImpl(PlatformSecurityContext context, final JdbcTemplate jdbcTemplate,
InterestRateChartDropdownReadPlatformService chartDropdownReadPlatformService,
final InterestIncentiveDropdownReadPlatformService interestIncentiveDropdownReadPlatformService,
final CodeValueReadPlatformService codeValueReadPlatformService, DatabaseSpecificSQLGenerator sqlGenerator) {
this.context = context;
this.jdbcTemplate = jdbcTemplate;
this.chartDropdownReadPlatformService = chartDropdownReadPlatformService;
this.interestIncentiveDropdownReadPlatformService = interestIncentiveDropdownReadPlatformService;
this.codeValueReadPlatformService = codeValueReadPlatformService;
chartExtractor = new DepositAccountInterestRateChartExtractor(sqlGenerator);
}

@Override
public DepositAccountInterestRateChartData retrieveOne(Long chartId) {
try {
Expand Down Expand Up @@ -182,7 +168,7 @@ public DepositAccountInterestRateChartData template() {
clientClassificationOptions);
}

private static final class DepositAccountInterestRateChartExtractor
public static final class DepositAccountInterestRateChartExtractor
implements ResultSetExtractor<Collection<DepositAccountInterestRateChartData>> {

DepositAccountInterestRateChartMapper chartMapper = new DepositAccountInterestRateChartMapper();
Expand All @@ -194,7 +180,7 @@ public String schema() {
return this.schemaSql;
}

private DepositAccountInterestRateChartExtractor(DatabaseSpecificSQLGenerator sqlGenerator) {
public DepositAccountInterestRateChartExtractor(DatabaseSpecificSQLGenerator sqlGenerator) {
final StringBuilder sqlBuilder = new StringBuilder(400);

sqlBuilder.append("irc.id as ircId, irc.name as ircName, irc.description as ircDescription,")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
import org.apache.fineract.infrastructure.core.service.Page;
Expand All @@ -32,29 +33,17 @@
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
import org.apache.fineract.infrastructure.security.utils.ColumnValidator;
import org.apache.fineract.portfolio.savings.data.DepositAccountOnHoldTransactionData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class DepositAccountOnHoldTransactionReadPlatformServiceImpl implements DepositAccountOnHoldTransactionReadPlatformService {

private final JdbcTemplate jdbcTemplate;
private final DatabaseSpecificSQLGenerator sqlGenerator;
private final ColumnValidator columnValidator;
private final PaginationHelper paginationHelper;
private final DepositAccountOnHoldTransactionsMapper mapper;

@Autowired
public DepositAccountOnHoldTransactionReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, final ColumnValidator columnValidator,
DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper paginationHelper) {
this.jdbcTemplate = jdbcTemplate;
this.sqlGenerator = sqlGenerator;
this.mapper = new DepositAccountOnHoldTransactionsMapper();
this.columnValidator = columnValidator;
this.paginationHelper = paginationHelper;
}
private final DepositAccountOnHoldTransactionsMapper mapper = new DepositAccountOnHoldTransactionsMapper();

@Override
public Page<DepositAccountOnHoldTransactionData> retriveAll(Long savingsId, Long guarantorFundingId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gson.JsonElement;
import java.time.LocalDate;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.api.JsonQuery;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
Expand All @@ -40,11 +41,9 @@
import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
import org.apache.fineract.portfolio.savings.domain.RecurringDepositAccount;
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
public class DepositAccountPreMatureCalculationPlatformServiceImpl implements DepositAccountPreMatureCalculationPlatformService {

private final FromJsonHelper fromJsonHelper;
Expand All @@ -54,21 +53,6 @@ public class DepositAccountPreMatureCalculationPlatformServiceImpl implements De
private final ConfigurationDomainService configurationDomainService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;

@Autowired
public DepositAccountPreMatureCalculationPlatformServiceImpl(final FromJsonHelper fromJsonHelper,
final DepositAccountTransactionDataValidator depositAccountTransactionDataValidator,
final DepositAccountAssembler depositAccountAssembler,
final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
final ConfigurationDomainService configurationDomainService, PaymentTypeReadPlatformService paymentTypeReadPlatformService) {
this.fromJsonHelper = fromJsonHelper;
this.depositAccountTransactionDataValidator = depositAccountTransactionDataValidator;
this.depositAccountAssembler = depositAccountAssembler;
this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
this.configurationDomainService = configurationDomainService;
this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;

}

@Transactional
@Override
public DepositAccountData calculatePreMatureAmount(final Long accountId, final JsonQuery query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.data.PaginationParameters;
import org.apache.fineract.infrastructure.core.data.PaginationParametersDataValidator;
Expand Down Expand Up @@ -92,14 +93,13 @@
import org.apache.fineract.portfolio.savings.exception.DepositAccountNotFoundException;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

@Service
@RequiredArgsConstructor

public class DepositAccountReadPlatformServiceImpl implements DepositAccountReadPlatformService {

private static final FixedDepositAccountMapper FIXED_DEPOSIT_ACCOUNT_MAPPER = new FixedDepositAccountMapper();
Expand All @@ -116,7 +116,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
private final PaginationParametersDataValidator paginationParametersDataValidator;
private final DatabaseSpecificSQLGenerator sqlGenerator;
private final PaginationHelper paginationHelper;
private final SavingsAccountTransactionsMapper transactionsMapper;
private final SavingsAccountTransactionsMapper transactionsMapper = new SavingsAccountTransactionsMapper();
private final ClientReadPlatformService clientReadPlatformService;
private final GroupReadPlatformService groupReadPlatformService;
private final DepositProductReadPlatformService depositProductReadPlatformService;
Expand All @@ -125,47 +125,11 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
private final StaffReadPlatformService staffReadPlatformService;
private final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final RecurringAccountDepositTransactionTemplateMapper rdTransactionTemplateMapper;
private final RecurringAccountDepositTransactionTemplateMapper rdTransactionTemplateMapper = new RecurringAccountDepositTransactionTemplateMapper();
private final DropdownReadPlatformService dropdownReadPlatformService;
private final CalendarReadPlatformService calendarReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;

@Autowired
public DepositAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final JdbcTemplate jdbcTemplate,
final DepositAccountInterestRateChartReadPlatformService chartReadPlatformService,
final PaginationParametersDataValidator paginationParametersDataValidator,
final ClientReadPlatformService clientReadPlatformService, final GroupReadPlatformService groupReadPlatformService,
final DepositProductReadPlatformService depositProductReadPlatformService,
final SavingsDropdownReadPlatformService savingsDropdownReadPlatformService,
final ChargeReadPlatformService chargeReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService,
final InterestRateChartReadPlatformService productChartReadPlatformService,
final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
final DropdownReadPlatformService dropdownReadPlatformService, final CalendarReadPlatformService calendarReadPlatformService,
PaymentTypeReadPlatformService paymentTypeReadPlatformService, DatabaseSpecificSQLGenerator sqlGenerator,
PaginationHelper paginationHelper) {
this.context = context;
this.jdbcTemplate = jdbcTemplate;
this.accountChartReadPlatformService = chartReadPlatformService;
this.paginationParametersDataValidator = paginationParametersDataValidator;
this.sqlGenerator = sqlGenerator;
this.transactionsMapper = new SavingsAccountTransactionsMapper();
this.clientReadPlatformService = clientReadPlatformService;
this.groupReadPlatformService = groupReadPlatformService;
this.depositProductReadPlatformService = depositProductReadPlatformService;
this.savingsDropdownReadPlatformService = savingsDropdownReadPlatformService;
this.chargeReadPlatformService = chargeReadPlatformService;
this.staffReadPlatformService = staffReadPlatformService;
this.depositsDropdownReadPlatformService = depositsDropdownReadPlatformService;
this.productChartReadPlatformService = productChartReadPlatformService;
this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
this.rdTransactionTemplateMapper = new RecurringAccountDepositTransactionTemplateMapper();
this.dropdownReadPlatformService = dropdownReadPlatformService;
this.calendarReadPlatformService = calendarReadPlatformService;
this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
this.paginationHelper = paginationHelper;
}

@Override
public Collection<DepositAccountData> retrieveAll(final DepositAccountType depositAccountType,
final PaginationParameters paginationParameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@
import org.apache.fineract.portfolio.savings.exception.SavingsAccountTransactionNotFoundException;
import org.apache.fineract.portfolio.savings.exception.TransactionUpdateNotAllowedException;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
@Transactional
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.fineract.infrastructure.accountnumberformat.domain.AccountNumberFormat;
Expand Down Expand Up @@ -92,18 +94,13 @@
import org.apache.fineract.portfolio.savings.domain.SavingsProductRepository;
import org.apache.fineract.portfolio.savings.exception.SavingsProductNotFoundException;
import org.apache.fineract.useradministration.domain.AppUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Slf4j
public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl implements DepositApplicationProcessWritePlatformService {

private static final Logger LOG = LoggerFactory.getLogger(DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.class);

private final PlatformSecurityContext context;
private final SavingsAccountRepositoryWrapper savingAccountRepository;
private final FixedDepositAccountRepository fixedDepositAccountRepository;
Expand All @@ -125,43 +122,6 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
private final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository;
private final BusinessEventNotifierService businessEventNotifierService;

@Autowired
public DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
final SavingsAccountRepositoryWrapper savingAccountRepository, final DepositAccountAssembler depositAccountAssembler,
final DepositAccountDataValidator depositAccountDataValidator, final AccountNumberGenerator accountNumberGenerator,
final ClientRepositoryWrapper clientRepository, final GroupRepository groupRepository,
final SavingsProductRepository savingsProductRepository, final NoteRepository noteRepository,
final StaffRepositoryWrapper staffRepository,
final SavingsAccountApplicationTransitionApiJsonValidator savingsAccountApplicationTransitionApiJsonValidator,
final SavingsAccountChargeAssembler savingsAccountChargeAssembler,
final FixedDepositAccountRepository fixedDepositAccountRepository,
final RecurringDepositAccountRepository recurringDepositAccountRepository,
final AccountAssociationsRepository accountAssociationsRepository, final FromJsonHelper fromJsonHelper,
final CalendarInstanceRepository calendarInstanceRepository, final ConfigurationDomainService configurationDomainService,
final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository,
final BusinessEventNotifierService businessEventNotifierService) {
this.context = context;
this.savingAccountRepository = savingAccountRepository;
this.depositAccountAssembler = depositAccountAssembler;
this.accountNumberGenerator = accountNumberGenerator;
this.depositAccountDataValidator = depositAccountDataValidator;
this.clientRepository = clientRepository;
this.groupRepository = groupRepository;
this.savingsProductRepository = savingsProductRepository;
this.noteRepository = noteRepository;
this.staffRepository = staffRepository;
this.savingsAccountApplicationTransitionApiJsonValidator = savingsAccountApplicationTransitionApiJsonValidator;
this.savingsAccountChargeAssembler = savingsAccountChargeAssembler;
this.fixedDepositAccountRepository = fixedDepositAccountRepository;
this.recurringDepositAccountRepository = recurringDepositAccountRepository;
this.accountAssociationsRepository = accountAssociationsRepository;
this.fromJsonHelper = fromJsonHelper;
this.calendarInstanceRepository = calendarInstanceRepository;
this.configurationDomainService = configurationDomainService;
this.accountNumberFormatRepository = accountNumberFormatRepository;
this.businessEventNotifierService = businessEventNotifierService;
}

/*
* Guaranteed to throw an exception no matter what the data integrity issue is.
*/
Expand All @@ -184,7 +144,7 @@ private void handleDataIntegrityIssues(final JsonCommand command, final Throwabl
}

errorCodeBuilder.append(".unknown.data.integrity.issue");
LOG.error("Error occured.", dve);
log.error("Error occured.", dve);
throw new PlatformDataIntegrityException(errorCodeBuilder.toString(), "Unknown data integrity issue with savings account.");
}

Expand Down
Loading

0 comments on commit dc3b94d

Please sign in to comment.