removing warnings after upgrade to java 7
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ public enum GLClosureJsonInputParams {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final GLClosureJsonInputParams type : GLClosureJsonInputParams.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class GLClosuresApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "officeId", "officeName",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
"closingDate", "deleted", "createdDate", "lastUpdatedDate", "createdByUserId", "createdByUsername", "lastUpdatedByUserId",
|
||||
"lastUpdatedByUsername"));
|
||||
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ public class GLClosureCommand {
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLClosure");
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GLClosureCommand {
|
||||
}
|
||||
|
||||
public void validateForUpdate() {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLClosure");
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class GLClosureData {
|
||||
@SuppressWarnings("unused")
|
||||
private final String comments;
|
||||
|
||||
private Collection<OfficeData> allowedOffices = new ArrayList<OfficeData>();
|
||||
private Collection<OfficeData> allowedOffices = new ArrayList<>();
|
||||
|
||||
public GLClosureData(final Long id, final Long officeId, final String officeName, final LocalDate closingDate, final boolean deleted,
|
||||
final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername,
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class GLClosure extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(5);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(5);
|
||||
handlePropertyUpdate(command, actualChanges, GLClosureJsonInputParams.COMMENTS.getValue(), this.comments);
|
||||
return actualChanges;
|
||||
}
|
||||
|
||||
+5
-5
@@ -35,7 +35,7 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<Integer, CASH_ACCOUNTS_FOR_LOAN>();
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final CASH_ACCOUNTS_FOR_LOAN type : CASH_ACCOUNTS_FOR_LOAN.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
@@ -68,7 +68,7 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, ACCRUAL_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<Integer, ACCRUAL_ACCOUNTS_FOR_LOAN>();
|
||||
private static final Map<Integer, ACCRUAL_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final ACCRUAL_ACCOUNTS_FOR_LOAN type : ACCRUAL_ACCOUNTS_FOR_LOAN.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
@@ -155,7 +155,7 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_SAVINGS> intToEnumMap = new HashMap<Integer, CASH_ACCOUNTS_FOR_SAVINGS>();
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_SAVINGS> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final CASH_ACCOUNTS_FOR_SAVINGS type : CASH_ACCOUNTS_FOR_SAVINGS.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
@@ -255,7 +255,7 @@ public class AccountingConstants {
|
||||
return this.value.toString();
|
||||
}
|
||||
|
||||
private static final Map<Integer, FINANCIAL_ACTIVITY> intToEnumMap = new HashMap<Integer, FINANCIAL_ACTIVITY>();
|
||||
private static final Map<Integer, FINANCIAL_ACTIVITY> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
@@ -274,7 +274,7 @@ public class AccountingConstants {
|
||||
|
||||
public static List<FinancialActivityData> getAllFinancialActivities() {
|
||||
if (financialActivities == null) {
|
||||
financialActivities = new ArrayList<FinancialActivityData>();
|
||||
financialActivities = new ArrayList<>();
|
||||
for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) {
|
||||
FinancialActivityData financialActivityData = convertToFinancialActivityData(type);
|
||||
financialActivities.add(financialActivityData);
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class AccountingDropdownReadPlatformServiceImpl implements AccountingDrop
|
||||
|
||||
@Override
|
||||
public Map<String, List<GLAccountData>> retrieveAccountMappingOptions() {
|
||||
final Map<String, List<GLAccountData>> accountOptions = new HashMap<String, List<GLAccountData>>();
|
||||
final Map<String, List<GLAccountData>> accountOptions = new HashMap<>();
|
||||
List<GLAccountData> assetAccountOptions = this.accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
|
||||
if (assetAccountOptions.isEmpty()) {
|
||||
assetAccountOptions = null;
|
||||
|
||||
+4
-4
@@ -27,7 +27,7 @@ public class AccountingEnumerations {
|
||||
}
|
||||
|
||||
public static List<EnumOptionData> gLAccountType(final GLAccountType[] accountTypes) {
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<EnumOptionData>();
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<>();
|
||||
for (final GLAccountType accountType : accountTypes) {
|
||||
optionDatas.add(gLAccountType(accountType));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class AccountingEnumerations {
|
||||
}
|
||||
|
||||
public static List<EnumOptionData> gLAccountUsage(final GLAccountUsage[] accountUsages) {
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<EnumOptionData>();
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<>();
|
||||
for (final GLAccountUsage accountUsage : accountUsages) {
|
||||
optionDatas.add(gLAccountUsage(accountUsage));
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class AccountingEnumerations {
|
||||
}
|
||||
|
||||
public static List<EnumOptionData> journalEntryTypes(final JournalEntryType[] journalEntryTypes) {
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<EnumOptionData>();
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<>();
|
||||
for (final JournalEntryType journalEntryType : journalEntryTypes) {
|
||||
optionDatas.add(journalEntryType(journalEntryType));
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class AccountingEnumerations {
|
||||
}
|
||||
|
||||
public static List<EnumOptionData> accountingRuleTypes(final AccountingRuleType[] accountingRuleTypes) {
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<EnumOptionData>();
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<>();
|
||||
for (final AccountingRuleType accountingRuleType : accountingRuleTypes) {
|
||||
optionDatas.add(accountingRuleType(accountingRuleType));
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public enum AccountingRuleType {
|
||||
private final Integer value;
|
||||
private final String code;
|
||||
|
||||
private static final Map<Integer, AccountingRuleType> intToEnumMap = new HashMap<Integer, AccountingRuleType>();
|
||||
private static final Map<Integer, AccountingRuleType> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final AccountingRuleType type : AccountingRuleType.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import java.util.Set;
|
||||
|
||||
public class FinancialActivityAccountsConstants {
|
||||
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "financialActivityData",
|
||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "financialActivityData",
|
||||
"glAccountData", "glAccountOptions", "financialActivityOptions"));
|
||||
|
||||
public static final String resourceNameForPermission = "FINANCIALACTIVITYACCOUNT";
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public enum FinancialActivityAccountsJsonInputParams {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final FinancialActivityAccountsJsonInputParams type : FinancialActivityAccountsJsonInputParams.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ public final class FinancialActivityAccountDataValidator {
|
||||
public void validateForCreate(final String json) {
|
||||
validateJSONAndCheckForUnsupportedParams(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -69,7 +69,7 @@ public final class FinancialActivityAccountDataValidator {
|
||||
public void validateForUpdate(final String json) {
|
||||
validateJSONAndCheckForUnsupportedParams(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
|
||||
public Map<String, Object> findChanges(JsonCommand command, FinancialActivityAccount financialActivityAccount) {
|
||||
|
||||
Map<String, Object> changes = new HashMap<String, Object>();
|
||||
Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
Long existingGLAccountId = financialActivityAccount.getGlAccount().getId();
|
||||
Integer financialActivityType = financialActivityAccount.getFinancialActivityType();
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public enum GLAccountJsonInputParams {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final GLAccountJsonInputParams type : GLAccountJsonInputParams.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class GLAccountsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "parentId", "glCode",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode",
|
||||
"disabled", "manualEntriesAllowed", "type", "usage", "description", "assetHeaderAccountOptions",
|
||||
"liabilityHeaderAccountOptions", "equityHeaderAccountOptions", "incomeHeaderAccountOptions", "expenseHeaderAccountOptions",
|
||||
"nameDecorated", "tagId", "allowedAssetsTagOptions", "allowedLiabilitiesTagOptions", "allowedEquityTagOptions",
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ public class GLAccountCommand {
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLAccount");
|
||||
|
||||
@@ -80,7 +80,7 @@ public class GLAccountCommand {
|
||||
}
|
||||
|
||||
public void validateForUpdate() {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLAccount");
|
||||
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ public class GLAccount extends AbstractPersistable<Long> {
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parent_id")
|
||||
private final List<GLAccount> children = new LinkedList<GLAccount>();
|
||||
private final List<GLAccount> children = new LinkedList<>();
|
||||
|
||||
@Column(name = "name", nullable = false, length = 45)
|
||||
private String name;
|
||||
@@ -96,7 +96,7 @@ public class GLAccount extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(15);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(15);
|
||||
handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.DESCRIPTION.getValue(), this.description);
|
||||
handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.DISABLED.getValue(), this.disabled);
|
||||
handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.GL_CODE.getValue(), this.glCode);
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public enum GLAccountType {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
private static final Map<Integer, GLAccountType> intToEnumMap = new HashMap<Integer, GLAccountType>();
|
||||
private static final Map<Integer, GLAccountType> intToEnumMap = new HashMap<>();
|
||||
private static int minValue;
|
||||
private static int maxValue;
|
||||
static {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public enum GLAccountUsage {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
private static final Map<Integer, GLAccountUsage> intToEnumMap = new HashMap<Integer, GLAccountUsage>();
|
||||
private static final Map<Integer, GLAccountUsage> intToEnumMap = new HashMap<>();
|
||||
private static int minValue;
|
||||
private static int maxValue;
|
||||
static {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class JournalEntriesApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "officeId", "officeName",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
"glAccountName", "glAccountId", "glAccountCode", "glAccountType", "transactionDate", "entryType", "amount", "transactionId",
|
||||
"manualEntry", "entityType", "entityId", "createdByUserId", "createdDate", "createdByUserName", "comments", "reversed",
|
||||
"referenceNumber", "currency"));
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public enum JournalEntryJsonInputParams {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final JournalEntryJsonInputParams type : JournalEntryJsonInputParams.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class JournalEntryCommand {
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLJournalEntry");
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ public class JournalEntryDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
public static final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(
|
||||
public static final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(JournalEntryJsonInputParams.OFFICE_ID.getValue()));
|
||||
|
||||
@Autowired
|
||||
@@ -35,7 +35,7 @@ public class JournalEntryDataValidator {
|
||||
public void validateForUpdateRunningbalance(final JsonCommand command) {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, command.json(), RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLJournalEntry");
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(JournalEntryJsonInputParams.OFFICE_ID.getValue(), command.parsedJson())) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public enum JournalEntryType {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
private static final Map<Integer, JournalEntryType> intToEnumMap = new HashMap<Integer, JournalEntryType>();
|
||||
private static final Map<Integer, JournalEntryType> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final JournalEntryType type : JournalEntryType.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
|
||||
final JsonObject creditElement = array.get(i).getAsJsonObject();
|
||||
final Set<String> parametersPassedInForCreditsCommand = new HashSet<String>();
|
||||
final Set<String> parametersPassedInForCreditsCommand = new HashSet<>();
|
||||
|
||||
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed("glAccountId", creditElement);
|
||||
final String comments = this.fromApiJsonHelper.extractStringNamed("comments", creditElement);
|
||||
|
||||
+7
-7
@@ -90,7 +90,7 @@ public class AccountingProcessorHelper {
|
||||
final Long loanProductId = (Long) accountingBridgeData.get("loanProductId");
|
||||
final Long officeId = (Long) accountingBridgeData.get("officeId");
|
||||
final CurrencyData currencyData = (CurrencyData) accountingBridgeData.get("currency");
|
||||
final List<LoanTransactionDTO> newLoanTransactions = new ArrayList<LoanTransactionDTO>();
|
||||
final List<LoanTransactionDTO> newLoanTransactions = new ArrayList<>();
|
||||
boolean isAccountTransfer = (Boolean) accountingBridgeData.get("isAccountTransfer");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -110,8 +110,8 @@ public class AccountingProcessorHelper {
|
||||
final boolean reversed = (Boolean) map.get("reversed");
|
||||
final Long paymentTypeId = (Long) map.get("paymentTypeId");
|
||||
|
||||
final List<ChargePaymentDTO> feePaymentDetails = new ArrayList<ChargePaymentDTO>();
|
||||
final List<ChargePaymentDTO> penaltyPaymentDetails = new ArrayList<ChargePaymentDTO>();
|
||||
final List<ChargePaymentDTO> feePaymentDetails = new ArrayList<>();
|
||||
final List<ChargePaymentDTO> penaltyPaymentDetails = new ArrayList<>();
|
||||
// extract charge payment details (if exists)
|
||||
if (map.containsKey("loanChargesPaid")) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -152,7 +152,7 @@ public class AccountingProcessorHelper {
|
||||
final Long loanProductId = (Long) accountingBridgeData.get("savingsProductId");
|
||||
final Long officeId = (Long) accountingBridgeData.get("officeId");
|
||||
final CurrencyData currencyData = (CurrencyData) accountingBridgeData.get("currency");
|
||||
final List<SavingsTransactionDTO> newSavingsTransactions = new ArrayList<SavingsTransactionDTO>();
|
||||
final List<SavingsTransactionDTO> newSavingsTransactions = new ArrayList<>();
|
||||
boolean isAccountTransfer = (Boolean) accountingBridgeData.get("isAccountTransfer");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -168,8 +168,8 @@ public class AccountingProcessorHelper {
|
||||
final Long paymentTypeId = (Long) map.get("paymentTypeId");
|
||||
final BigDecimal overdraftAmount = (BigDecimal) map.get("overdraftAmount");
|
||||
|
||||
final List<ChargePaymentDTO> feePayments = new ArrayList<ChargePaymentDTO>();
|
||||
final List<ChargePaymentDTO> penaltyPayments = new ArrayList<ChargePaymentDTO>();
|
||||
final List<ChargePaymentDTO> feePayments = new ArrayList<>();
|
||||
final List<ChargePaymentDTO> penaltyPayments = new ArrayList<>();
|
||||
// extract charge payment details (if exists)
|
||||
if (map.containsKey("savingsChargesPaid")) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -383,7 +383,7 @@ public class AccountingProcessorHelper {
|
||||
* Map to track each account and the net credit to be made for a
|
||||
* particular account
|
||||
***/
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<GLAccount, BigDecimal>();
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
|
||||
for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) {
|
||||
final Long chargeId = chargePaymentDTO.getChargeId();
|
||||
final GLAccount chargeSpecificAccount = getLinkedGLAccountForLoanCharges(loanProductId, accountMappingTypeId, chargeId);
|
||||
|
||||
+2
-2
@@ -28,6 +28,7 @@ import org.mifosplatform.infrastructure.core.service.Page;
|
||||
import org.mifosplatform.infrastructure.core.service.PaginationHelper;
|
||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.portfolio.account.PortfolioAccountType;
|
||||
import org.mifosplatform.portfolio.group.service.SearchParameters;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionEnumData;
|
||||
import org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations;
|
||||
@@ -35,7 +36,6 @@ import org.mifosplatform.portfolio.note.data.NoteData;
|
||||
import org.mifosplatform.portfolio.paymentdetail.data.PaymentDetailData;
|
||||
import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionEnumData;
|
||||
import org.mifosplatform.portfolio.savings.service.SavingsEnumerations;
|
||||
import org.mifosplatform.portfolio.account.PortfolioAccountType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -47,7 +47,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<JournalEntryData>();
|
||||
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<>();
|
||||
|
||||
@Autowired
|
||||
public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource) {
|
||||
|
||||
+5
-5
@@ -120,8 +120,8 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
|
||||
@Transactional
|
||||
private void updateOrganizationRunningBalance(Date entityDate) {
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<Long, BigDecimal>(5);
|
||||
Map<Long, Map<Long, BigDecimal>> officesRunningBalance = new HashMap<Long, Map<Long, BigDecimal>>();
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
|
||||
Map<Long, Map<Long, BigDecimal>> officesRunningBalance = new HashMap<>();
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceSql, entityDate, entityDate);
|
||||
for (Map<String, Object> entries : list) {
|
||||
@@ -139,7 +139,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
if (officesRunningBalance.containsKey(officeId)) {
|
||||
runningBalance = officesRunningBalance.get(officeId);
|
||||
} else {
|
||||
runningBalance = new HashMap<Long, BigDecimal>();
|
||||
runningBalance = new HashMap<>();
|
||||
officesRunningBalance.put(officeId, runningBalance);
|
||||
}
|
||||
if (!runningBalance.containsKey(accountId)) {
|
||||
@@ -157,7 +157,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
if (officesRunningBalance.containsKey(entryData.getOfficeId())) {
|
||||
officeRunningBalanceMap = officesRunningBalance.get(entryData.getOfficeId());
|
||||
} else {
|
||||
officeRunningBalanceMap = new HashMap<Long, BigDecimal>();
|
||||
officeRunningBalanceMap = new HashMap<>();
|
||||
officesRunningBalance.put(entryData.getOfficeId(), officeRunningBalanceMap);
|
||||
}
|
||||
BigDecimal officeRunningBalance = calculateRunningBalance(entryData, officeRunningBalanceMap);
|
||||
@@ -173,7 +173,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
|
||||
@Transactional
|
||||
private void updateRunningBalance(Long officeId, Date entityDate) {
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<Long, BigDecimal>(5);
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(officeRunningBalanceSql, officeId, entityDate, officeId, entityDate);
|
||||
for (Map<String, Object> entries : list) {
|
||||
|
||||
+3
-3
@@ -117,7 +117,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
validateBusinessRulesForJournalEntries(journalEntryCommand);
|
||||
|
||||
/** Capture payment details **/
|
||||
final Map<String, Object> changes = new LinkedHashMap<String, Object>();
|
||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
||||
final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes);
|
||||
|
||||
/** Set a transaction Id and save these Journal entries **/
|
||||
@@ -203,8 +203,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
private void checkDebitOrCreditAccountsAreValid(final AccountingRule accountingRule, final SingleDebitOrCreditEntryCommand[] credits,
|
||||
final SingleDebitOrCreditEntryCommand[] debits) {
|
||||
// Validate the debit and credit arrays are appropriate accounts
|
||||
List<GLAccountDataForLookup> allowedCreditGLAccounts = new ArrayList<GLAccountDataForLookup>();
|
||||
List<GLAccountDataForLookup> allowedDebitGLAccounts = new ArrayList<GLAccountDataForLookup>();
|
||||
List<GLAccountDataForLookup> allowedCreditGLAccounts = new ArrayList<>();
|
||||
List<GLAccountDataForLookup> allowedDebitGLAccounts = new ArrayList<>();
|
||||
final SingleDebitOrCreditEntryCommand[] validCredits = new SingleDebitOrCreditEntryCommand[credits.length];
|
||||
final SingleDebitOrCreditEntryCommand[] validDebits = new SingleDebitOrCreditEntryCommand[debits.length];
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public enum PortfolioProductType {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
private static final Map<Integer, PortfolioProductType> intToEnumMap = new HashMap<Integer, PortfolioProductType>();
|
||||
private static final Map<Integer, PortfolioProductType> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final PortfolioProductType type : PortfolioProductType.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
public void validateForLoanProductCreate(final String json) {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -149,7 +149,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
public void validateForSavingsProductCreate(final String json, DepositAccountType accountType) {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(SAVINGS_PRODUCT_RESOURCE_NAME);
|
||||
|
||||
|
||||
+13
-10
@@ -110,7 +110,7 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
|
||||
public Map<String, Object> populateChangesForNewLoanProductToGLAccountMappingCreation(final JsonElement element,
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
final Map<String, Object> changes = new HashMap<String, Object>();
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), element);
|
||||
final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
@@ -144,17 +144,18 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
break;
|
||||
case CASH_BASED:
|
||||
populateChangesForCashBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId,
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId);
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,
|
||||
incomeFromRecoveryAccountId);
|
||||
break;
|
||||
case ACCRUAL_PERIODIC:
|
||||
populateChangesForAccrualBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId,
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId,
|
||||
receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId);
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,
|
||||
incomeFromRecoveryAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId);
|
||||
break;
|
||||
case ACCRUAL_UPFRONT:
|
||||
populateChangesForAccrualBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId,
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId,
|
||||
receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId);
|
||||
incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,
|
||||
incomeFromRecoveryAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -163,21 +164,23 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
|
||||
private void populateChangesForAccrualBasedAccounting(final Map<String, Object> changes, final Long fundAccountId,
|
||||
final Long loanPortfolioAccountId, final Long incomeFromInterestId, final Long incomeFromFeeId, final Long incomeFromPenaltyId,
|
||||
final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,final Long incomeFromRecoveryAccountId,
|
||||
final Long receivableInterestAccountId, final Long receivableFeeAccountId, final Long receivablePenaltyAccountId) {
|
||||
final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,
|
||||
final Long incomeFromRecoveryAccountId, final Long receivableInterestAccountId, final Long receivableFeeAccountId,
|
||||
final Long receivablePenaltyAccountId) {
|
||||
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), receivableInterestAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), receivableFeeAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), receivablePenaltyAccountId);
|
||||
|
||||
populateChangesForCashBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, incomeFromFeeId,
|
||||
incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId);
|
||||
incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, incomeFromRecoveryAccountId);
|
||||
|
||||
}
|
||||
|
||||
private void populateChangesForCashBasedAccounting(final Map<String, Object> changes, final Long fundAccountId,
|
||||
final Long loanPortfolioAccountId, final Long incomeFromInterestId, final Long incomeFromFeeId, final Long incomeFromPenaltyId,
|
||||
final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,final Long incomeFromRecoveryAccountId) {
|
||||
final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,
|
||||
final Long incomeFromRecoveryAccountId) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), fundAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanPortfolioAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), incomeFromInterestId);
|
||||
|
||||
+4
-4
@@ -175,12 +175,12 @@ public class ProductToGLAccountMappingHelper {
|
||||
* associated income Id's (value) extracted from the passed in
|
||||
* Jsoncommand
|
||||
**/
|
||||
final Map<Long, Long> inputChargeToIncomeAccountMap = new HashMap<Long, Long>();
|
||||
final Map<Long, Long> inputChargeToIncomeAccountMap = new HashMap<>();
|
||||
/***
|
||||
* Variable stores all charges which have already been mapped to Income
|
||||
* Accounts in the system
|
||||
**/
|
||||
final Set<Long> existingCharges = new HashSet<Long>();
|
||||
final Set<Long> existingCharges = new HashSet<>();
|
||||
if (chargeToIncomeAccountMappingArray != null && chargeToIncomeAccountMappingArray.size() > 0) {
|
||||
if (changes != null) {
|
||||
changes.put(arrayFragmentName, command.jsonFragment(arrayFragmentName));
|
||||
@@ -253,12 +253,12 @@ public class ProductToGLAccountMappingHelper {
|
||||
* Variable stores a map representation of Payment channels (key) and
|
||||
* their fund sources (value) extracted from the passed in Jsoncommand
|
||||
**/
|
||||
final Map<Long, Long> inputPaymentChannelFundSourceMap = new HashMap<Long, Long>();
|
||||
final Map<Long, Long> inputPaymentChannelFundSourceMap = new HashMap<>();
|
||||
/***
|
||||
* Variable stores all payment types which have already been mapped to
|
||||
* Fund Sources in the system
|
||||
**/
|
||||
final Set<Long> existingPaymentTypes = new HashSet<Long>();
|
||||
final Set<Long> existingPaymentTypes = new HashSet<>();
|
||||
if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) {
|
||||
if (changes != null) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
|
||||
+6
-6
@@ -69,7 +69,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
final String chargeName = rs.getString("chargeName");
|
||||
final Boolean penalty = rs.getBoolean("penalty");
|
||||
|
||||
final Map<String, Object> loanProductToGLAccountMap = new LinkedHashMap<String, Object>(5);
|
||||
final Map<String, Object> loanProductToGLAccountMap = new LinkedHashMap<>(5);
|
||||
loanProductToGLAccountMap.put("id", id);
|
||||
loanProductToGLAccountMap.put("glAccountId", glAccountId);
|
||||
loanProductToGLAccountMap.put("productId", productId);
|
||||
@@ -89,7 +89,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
@Override
|
||||
public Map<String, Object> fetchAccountMappingDetailsForLoanProduct(final Long loanProductId, final Integer accountingType) {
|
||||
|
||||
final Map<String, Object> accountMappingDetails = new LinkedHashMap<String, Object>(8);
|
||||
final Map<String, Object> accountMappingDetails = new LinkedHashMap<>(8);
|
||||
|
||||
final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper();
|
||||
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null";
|
||||
@@ -127,7 +127,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (AccountingRuleType.ACCRUAL_UPFRONT.getValue().equals(accountingType)
|
||||
|| AccountingRuleType.ACCRUAL_PERIODIC.getValue().equals(accountingType)) {
|
||||
@@ -175,7 +175,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
|
||||
@Override
|
||||
public Map<String, Object> fetchAccountMappingDetailsForSavingsProduct(final Long savingsProductId, final Integer accountingType) {
|
||||
final Map<String, Object> accountMappingDetails = new LinkedHashMap<String, Object>(8);
|
||||
final Map<String, Object> accountMappingDetails = new LinkedHashMap<>(8);
|
||||
|
||||
final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper();
|
||||
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null ";
|
||||
@@ -245,7 +245,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
List<PaymentTypeToGLAccountMapper> paymentTypeToGLAccountMappers = null;
|
||||
for (final Map<String, Object> productToGLAccountMap : paymentTypeToFundSourceMappingsList) {
|
||||
if (paymentTypeToGLAccountMappers == null) {
|
||||
paymentTypeToGLAccountMappers = new ArrayList<PaymentTypeToGLAccountMapper>();
|
||||
paymentTypeToGLAccountMappers = new ArrayList<>();
|
||||
}
|
||||
final Long paymentTypeId = (Long) productToGLAccountMap.get("paymentTypeId");
|
||||
final String paymentTypeValue = (String) productToGLAccountMap.get("paymentTypeValue");
|
||||
@@ -296,7 +296,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
List<ChargeToGLAccountMapper> chargeToGLAccountMappers = null;
|
||||
for (final Map<String, Object> chargeToIncomeAccountMap : chargeToFundSourceMappingsList) {
|
||||
if (chargeToGLAccountMappers == null) {
|
||||
chargeToGLAccountMappers = new ArrayList<ChargeToGLAccountMapper>();
|
||||
chargeToGLAccountMappers = new ArrayList<>();
|
||||
}
|
||||
final Long glAccountId = (Long) chargeToIncomeAccountMap.get("glAccountId");
|
||||
final String glAccountName = (String) chargeToIncomeAccountMap.get("glAccountName");
|
||||
|
||||
+2
-2
@@ -225,7 +225,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
* Variable tracks all accounting mapping properties that have been
|
||||
* updated
|
||||
***/
|
||||
Map<String, Object> changes = new HashMap<String, Object>();
|
||||
Map<String, Object> changes = new HashMap<>();
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
|
||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
|
||||
|
||||
@@ -256,7 +256,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
* Variable tracks all accounting mapping properties that have been
|
||||
* updated
|
||||
***/
|
||||
Map<String, Object> changes = new HashMap<String, Object>();
|
||||
Map<String, Object> changes = new HashMap<>();
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
|
||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
|
||||
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
||||
|
||||
public Map<String, Object> populateChangesForNewSavingsProductToGLAccountMappingCreation(final JsonElement element,
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
final Map<String, Object> changes = new HashMap<String, Object>();
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final Long savingsReferenceId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
|
||||
+3
-3
@@ -55,7 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class AccountingRuleApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "officeId", "officeName",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
"accountToDebitId", "accountToCreditId", "name", "description", "systemDefined", "allowedCreditTagOptions",
|
||||
"allowedDebitTagOptions", "debitTags", "creditTags", "creditAccounts", "debitAccounts", "allowMultipleCreditEntries",
|
||||
"allowMultipleDebitEntries", "tag"));
|
||||
@@ -232,8 +232,8 @@ public class AccountingRuleApiResource {
|
||||
|
||||
private Collection<CodeValueData> retrieveSelectedTags(final Collection<CodeValueData> allowedTagOptions,
|
||||
final List<AccountingTagRuleData> existedTags) {
|
||||
final Collection<CodeValueData> tempOptions = new ArrayList<CodeValueData>(allowedTagOptions);
|
||||
final Map<Long, CodeValueData> selectedTags = new HashMap<Long, CodeValueData>();
|
||||
final Collection<CodeValueData> tempOptions = new ArrayList<>(allowedTagOptions);
|
||||
final Map<Long, CodeValueData> selectedTags = new HashMap<>();
|
||||
for (final AccountingTagRuleData accountingTagRuleData : existedTags) {
|
||||
for (final CodeValueData codeValueData : tempOptions) {
|
||||
if (codeValueData.getId().equals(accountingTagRuleData.getTag().getId())) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public enum AccountingRuleJsonInputParams {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final AccountingRuleJsonInputParams type : AccountingRuleJsonInputParams.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+5
-5
@@ -58,7 +58,7 @@ public class AccountingRule extends AbstractPersistable<Long> {
|
||||
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accountingRule", orphanRemoval = true)
|
||||
private final List<AccountingTagRule> accountingTagRules = new ArrayList<AccountingTagRule>();
|
||||
private final List<AccountingTagRule> accountingTagRules = new ArrayList<>();
|
||||
|
||||
@Column(name = "allow_multiple_credits", nullable = false)
|
||||
private boolean allowMultipleCreditEntries;
|
||||
@@ -94,7 +94,7 @@ public class AccountingRule extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(10);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(10);
|
||||
handlePropertyUpdate(command, actualChanges, AccountingRuleJsonInputParams.OFFICE_ID.getValue(), this.office == null ? 0L
|
||||
: this.office.getId());
|
||||
handlePropertyUpdate(command, actualChanges, AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue(),
|
||||
@@ -219,8 +219,8 @@ public class AccountingRule extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public void updateTags(final JournalEntryType type) {
|
||||
final Set<AccountingTagRule> existedCreditTags = new HashSet<AccountingTagRule>();
|
||||
final Set<AccountingTagRule> existedDebitTags = new HashSet<AccountingTagRule>();
|
||||
final Set<AccountingTagRule> existedCreditTags = new HashSet<>();
|
||||
final Set<AccountingTagRule> existedDebitTags = new HashSet<>();
|
||||
for (final AccountingTagRule accountingTagRule : this.accountingTagRules) {
|
||||
if (accountingTagRule.isCreditAccount()) {
|
||||
existedCreditTags.add(accountingTagRule);
|
||||
@@ -238,7 +238,7 @@ public class AccountingRule extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public Set<AccountingTagRule> getAccountingTagRulesByType(final JournalEntryType type) {
|
||||
final Set<AccountingTagRule> existedTags = new HashSet<AccountingTagRule>();
|
||||
final Set<AccountingTagRule> existedTags = new HashSet<>();
|
||||
for (final AccountingTagRule accountingTagRule : this.accountingTagRules) {
|
||||
if (accountingTagRule.getAccountType().equals(type.getValue())) {
|
||||
existedTags.add(accountingTagRule);
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public class AccountingRuleCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("AccountingRule");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -149,7 +149,7 @@ public class AccountingRuleCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("AccountingRule");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
+4
-4
@@ -76,7 +76,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
|
||||
|
||||
@Override
|
||||
public Map<Long, AccountingRuleData> extractData(final ResultSet rs) throws SQLException, DataAccessException {
|
||||
final Map<Long, AccountingRuleData> extractedData = new HashMap<Long, AccountingRuleData>();
|
||||
final Map<Long, AccountingRuleData> extractedData = new HashMap<>();
|
||||
|
||||
while (rs.next()) {
|
||||
final Long id = rs.getLong("id");
|
||||
@@ -110,7 +110,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
|
||||
creditTags = null;
|
||||
final GLAccountDataForLookup creditAccount = new GLAccountDataForLookup(accountToCreditId, creditAccountName,
|
||||
creditAccountGLCode);
|
||||
creditAccounts = new ArrayList<GLAccountDataForLookup>(Arrays.asList(creditAccount));
|
||||
creditAccounts = new ArrayList<>(Arrays.asList(creditAccount));
|
||||
}
|
||||
if (accountToDebitId == null) {
|
||||
debitTags = !this.isAssociationParametersExists ? getCreditOrDebitTags(id, JournalEntryType.DEBIT.getValue())
|
||||
@@ -121,7 +121,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
|
||||
debitTags = null;
|
||||
final GLAccountDataForLookup debitAccount = new GLAccountDataForLookup(accountToDebitId, debitAccountName,
|
||||
debitAccountGLCode);
|
||||
debitAccounts = new ArrayList<GLAccountDataForLookup>(Arrays.asList(debitAccount));
|
||||
debitAccounts = new ArrayList<>(Arrays.asList(debitAccount));
|
||||
}
|
||||
accountingRuleData = new AccountingRuleData(id, officeId, officeName, name, description, systemDefined,
|
||||
allowMultipleDebitEntries, allowMultipleCreditEntries, creditTags, debitTags, creditAccounts, debitAccounts);
|
||||
@@ -153,7 +153,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
|
||||
}
|
||||
sql = sql + " order by rule.id asc";
|
||||
final Map<Long, AccountingRuleData> extractedData = this.jdbcTemplate.query(sql, resultSetExtractor, arguments);
|
||||
return new ArrayList<AccountingRuleData>(extractedData.values());
|
||||
return new ArrayList<>(extractedData.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-10
@@ -112,8 +112,8 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
// get the GL Accounts or tags to Debit and Credit
|
||||
final String[] debitTags = command.arrayValueOfParameterNamed(AccountingRuleJsonInputParams.DEBIT_ACCOUNT_TAGS.getValue());
|
||||
final String[] creditTags = command.arrayValueOfParameterNamed(AccountingRuleJsonInputParams.CREDIT_ACCOUNT_TAGS.getValue());
|
||||
final Set<String> incomingDebitTags = debitTags == null ? new HashSet<String>() : new HashSet<String>(Arrays.asList(debitTags));
|
||||
final Set<String> incomingCreditTags = creditTags == null ? new HashSet<String>() : new HashSet<String>(Arrays.asList(creditTags));
|
||||
final Set<String> incomingDebitTags = debitTags == null ? new HashSet<String>() : new HashSet<>(Arrays.asList(debitTags));
|
||||
final Set<String> incomingCreditTags = creditTags == null ? new HashSet<String>() : new HashSet<>(Arrays.asList(creditTags));
|
||||
final Long accountToDebitId = command.longValueOfParameterNamed(AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue());
|
||||
final Long accountToCreditId = command.longValueOfParameterNamed(AccountingRuleJsonInputParams.ACCOUNT_TO_CREDIT.getValue());
|
||||
|
||||
@@ -121,7 +121,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
boolean allowMultipleDebitEntries = false;
|
||||
GLAccount debitAccount = null;
|
||||
GLAccount creditAccount = null;
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<AccountingTagRule>();
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<>();
|
||||
|
||||
if ((accountToDebitId != null && debitTags != null) || (accountToDebitId == null && debitTags == null)) {
|
||||
throw new AccountingRuleDataException(AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue(),
|
||||
@@ -226,7 +226,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
accountingRule);
|
||||
|
||||
if (!creditTagsToAdd.isEmpty()) {
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<AccountingTagRule>();
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<>();
|
||||
accountingTagRules = saveDebitOrCreditTags(creditTagsToAdd, JournalEntryType.CREDIT, accountingTagRules);
|
||||
accountingRule.updateAccountingRuleForTags(accountingTagRules);
|
||||
accountingRule.updateCreditAccount(null);
|
||||
@@ -243,7 +243,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
final Set<String> debitTagsToAdd = determineCreditTagToAddAndRemoveOldTags(debitTags, JournalEntryType.DEBIT,
|
||||
accountingRule);
|
||||
if (!debitTagsToAdd.isEmpty()) {
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<AccountingTagRule>();
|
||||
List<AccountingTagRule> accountingTagRules = new ArrayList<>();
|
||||
accountingTagRules = saveDebitOrCreditTags(debitTagsToAdd, JournalEntryType.DEBIT, accountingTagRules);
|
||||
accountingRule.updateAccountingRuleForTags(accountingTagRules);
|
||||
accountingRule.updateDebitAccount(null);
|
||||
@@ -276,12 +276,12 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
private Set<String> determineCreditTagToAddAndRemoveOldTags(final String[] creditOrDebitTags, final JournalEntryType type,
|
||||
final AccountingRule accountingRule) {
|
||||
|
||||
final Set<String> incomingTags = new HashSet<String>(Arrays.asList(creditOrDebitTags));
|
||||
final Set<String> incomingTags = new HashSet<>(Arrays.asList(creditOrDebitTags));
|
||||
final Set<AccountingTagRule> existingTags = accountingRule.getAccountingTagRulesByType(type);
|
||||
final Set<String> existingTagIds = retrieveExistingTagIds(existingTags);
|
||||
final Set<String> tagsToAdd = new HashSet<String>();
|
||||
final Set<String> tagsToAdd = new HashSet<>();
|
||||
final Set<String> tagsToRemove = existingTagIds;
|
||||
final Map<Long, AccountingTagRule> accountsToRemove = new HashMap<Long, AccountingTagRule>();
|
||||
final Map<Long, AccountingTagRule> accountsToRemove = new HashMap<>();
|
||||
|
||||
for (final String tagId : incomingTags) {
|
||||
if (existingTagIds.contains(tagId)) {
|
||||
@@ -299,13 +299,13 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
}
|
||||
}
|
||||
}
|
||||
accountingRule.removeOldTags(new ArrayList<AccountingTagRule>(accountsToRemove.values()));
|
||||
accountingRule.removeOldTags(new ArrayList<>(accountsToRemove.values()));
|
||||
}
|
||||
return tagsToAdd;
|
||||
}
|
||||
|
||||
private Set<String> retrieveExistingTagIds(final Set<AccountingTagRule> existingCreditTags) {
|
||||
final Set<String> existingCreditTagIds = new HashSet<String>();
|
||||
final Set<String> existingCreditTagIds = new HashSet<>();
|
||||
for (final AccountingTagRule accountingTagRule : existingCreditTags) {
|
||||
existingCreditTagIds.add(accountingTagRule.getTagId().toString());
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class AuditsApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
"subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName",
|
||||
"groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId", "url"));
|
||||
|
||||
@@ -123,7 +123,7 @@ public class AuditsApiResource {
|
||||
|
||||
final AuditSearchData auditSearchData = this.auditReadPlatformService.retrieveSearchTemplate("audit");
|
||||
|
||||
final Set<String> RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<String>(Arrays.asList("appUsers", "actionNames",
|
||||
final Set<String> RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<>(Arrays.asList("appUsers", "actionNames",
|
||||
"entityNames", "processingResults"));
|
||||
|
||||
return this.toApiJsonSerializerSearchTemplate.serialize(settings, auditSearchData, RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE);
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class MakercheckersApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
"subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName",
|
||||
"groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId"));
|
||||
|
||||
@@ -95,7 +95,7 @@ public class MakercheckersApiResource {
|
||||
|
||||
final AuditSearchData auditSearchData = this.readPlatformService.retrieveSearchTemplate("makerchecker");
|
||||
|
||||
final Set<String> RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<String>(Arrays.asList("appUsers", "actionNames",
|
||||
final Set<String> RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<>(Arrays.asList("appUsers", "actionNames",
|
||||
"entityNames"));
|
||||
|
||||
return this.toApiJsonSerializerSearchTemplate.serialize(settings, auditSearchData, RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE);
|
||||
|
||||
+7
-7
@@ -62,9 +62,9 @@ import com.google.gson.JsonObject;
|
||||
public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(AuditReadPlatformServiceImpl.class);
|
||||
private final static Set<String> supportedOrderByValues = new HashSet<String>(Arrays.asList("id", "actionName", "entityName",
|
||||
"resourceId", "subresourceId", "madeOnDate", "checkedOnDate", "officeName", "groupName", "clientName", "loanAccountNo",
|
||||
"savingsAccountNo", "clientId", "loanId"));
|
||||
private final static Set<String> supportedOrderByValues = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
"subresourceId", "madeOnDate", "checkedOnDate", "officeName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo",
|
||||
"clientId", "loanId"));
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -74,7 +74,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
private final ClientReadPlatformService clientReadPlatformService;
|
||||
private final LoanProductReadPlatformService loanProductReadPlatformService;
|
||||
private final StaffReadPlatformService staffReadPlatformService;
|
||||
private final PaginationHelper<AuditData> paginationHelper = new PaginationHelper<AuditData>();
|
||||
private final PaginationHelper<AuditData> paginationHelper = new PaginationHelper<>();
|
||||
private final PaginationParametersDataValidator paginationParametersDataValidator;
|
||||
private final SavingsProductReadPlatformService savingsProductReadPlatformService;
|
||||
private final DepositProductReadPlatformService depositProductReadPlatformService;
|
||||
@@ -377,7 +377,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
private void updateEnumerations(Map<String, Object> commandAsJsonMap, JsonObject auditObject, String entityName) {
|
||||
|
||||
if (entityName.equalsIgnoreCase("LOAN") || entityName.equalsIgnoreCase("LOANPRODUCT")) {
|
||||
|
||||
|
||||
final String[] enumTypes = { "loanTermFrequencyType", "termFrequencyType", "repaymentFrequencyType", "amortizationType",
|
||||
"interestType", "interestCalculationPeriodType", "interestRateFrequencyType", "accountingRule" };
|
||||
|
||||
@@ -394,7 +394,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (entityName.equalsIgnoreCase("SAVINGSPRODUCT") || entityName.equalsIgnoreCase("SAVINGSACCOUNT")
|
||||
|| entityName.equalsIgnoreCase("RECURRINGDEPOSITPRODUCT") || entityName.equalsIgnoreCase("RECURRINGDEPOSITACCOUNT")
|
||||
|| entityName.equalsIgnoreCase("FIXEDDEPOSITPRODUCT") || entityName.equalsIgnoreCase("FIXEDDEPOSITACCOUNT")) {
|
||||
@@ -416,7 +416,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -8,6 +8,6 @@ public class CacheApiConstants {
|
||||
|
||||
public static final String RESOURCE_NAME = "CACHE";
|
||||
public static final String cacheTypeParameter = "cacheType";
|
||||
public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(cacheTypeParameter));
|
||||
public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(cacheTypeParameter));
|
||||
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class CacheApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id"));
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id"));
|
||||
private final String resourceNameForPermissions = "CACHE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class UpdateCacheCommandHandler implements NewCommandSourceHandler {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
command.checkForUnsupportedParameters(typeOfMap, json, CacheApiConstants.REQUEST_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(CacheApiConstants.RESOURCE_NAME.toLowerCase());
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ public enum CacheType {
|
||||
private final Integer value;
|
||||
private final String code;
|
||||
|
||||
private static final Map<Integer, CacheType> intToEnumMap = new HashMap<Integer, CacheType>();
|
||||
private static final Map<Integer, CacheType> intToEnumMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (final CacheType type : CacheType.values()) {
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
|
||||
public Map<String, Object> switchToCache(final boolean ehcacheEnabled, final CacheType toCacheType) {
|
||||
|
||||
final Map<String, Object> changes = new HashMap<String, Object>();
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final boolean noCacheEnabled = !ehcacheEnabled;
|
||||
final boolean distributedCacheEnabled = !ehcacheEnabled;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class CodeConstants {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<String>();
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final CODEVALUE_JSON_INPUT_PARAMS type : CODEVALUE_JSON_INPUT_PARAMS.values()) {
|
||||
values.add(type.value);
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class CodeValuesApiResource {
|
||||
/**
|
||||
* The set of parameters that are supported in response for {@link CodeData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "position"));
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "position"));
|
||||
private final String resourceNameForPermissions = "CODEVALUE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class CodesApiResource {
|
||||
/**
|
||||
* The set of parameters that are supported in response for {@link CodeData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "systemDefined"));
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "systemDefined"));
|
||||
private final String resourceNameForPermissions = "CODE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class Code extends AbstractPersistable<Long> {
|
||||
|
||||
if (this.systemDefined) { throw new SystemDefinedCodeCannotBeChangedException(); }
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(1);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(1);
|
||||
|
||||
final String firstnameParamName = "name";
|
||||
if (command.isChangeInStringParameterNamed(firstnameParamName, this.name)) {
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class CodeValue extends AbstractPersistable<Long> {
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(2);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(2);
|
||||
|
||||
final String labelParamName = CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue();
|
||||
if (command.isChangeInStringParameterNamed(labelParamName, this.label)) {
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ public final class CodeCommandFromApiJsonDeserializer {
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("name"));
|
||||
private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("name"));
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
@@ -48,7 +48,7 @@ public final class CodeCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -65,7 +65,7 @@ public final class CodeCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public final class CodeValueCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code.value");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -69,7 +69,7 @@ public final class CodeValueCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code.value");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
+1
-1
@@ -11,6 +11,6 @@ public class GlobalConfigurationApiConstant {
|
||||
public static final String ID = "id";
|
||||
public static final String CONFIGURATION_RESOURCE_NAME = "globalConfiguration";
|
||||
|
||||
public static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(ENABLED, VALUE));
|
||||
public static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ENABLED, VALUE));
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class GlobalConfigurationApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("globalConfiguration"));
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
|
||||
|
||||
private final String resourceNameForPermissions = "CONFIGURATION";
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class GlobalConfigurationDataValidator {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CONFIGURATION_RESOURCE_NAME);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class GlobalConfigurationProperty extends AbstractPersistable<Long> {
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(7);
|
||||
|
||||
final String enabledParamName = "enabled";
|
||||
if (command.isChangeInBooleanParameterNamed(enabledParamName, this.enabled)) {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public final class GlobalConfigurationCommandFromApiJsonDeserializer extends
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("globalConfiguration"));
|
||||
private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("globalConfiguration"));
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
|
||||
+5
-5
@@ -32,24 +32,24 @@ public class ApiParameterHelper {
|
||||
}
|
||||
|
||||
public static Set<String> extractFieldsForResponseIfProvided(final MultivaluedMap<String, String> queryParams) {
|
||||
Set<String> fields = new HashSet<String>();
|
||||
Set<String> fields = new HashSet<>();
|
||||
String commaSerperatedParameters = "";
|
||||
if (queryParams.getFirst("fields") != null) {
|
||||
commaSerperatedParameters = queryParams.getFirst("fields");
|
||||
if (StringUtils.isNotBlank(commaSerperatedParameters)) {
|
||||
fields = new HashSet<String>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
|
||||
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
|
||||
}
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static Set<String> extractAssociationsForResponseIfProvided(final MultivaluedMap<String, String> queryParams) {
|
||||
Set<String> fields = new HashSet<String>();
|
||||
Set<String> fields = new HashSet<>();
|
||||
String commaSerperatedParameters = "";
|
||||
if (queryParams.getFirst("associations") != null) {
|
||||
commaSerperatedParameters = queryParams.getFirst("associations");
|
||||
if (StringUtils.isNotBlank(commaSerperatedParameters)) {
|
||||
fields = new HashSet<String>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
|
||||
fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*")));
|
||||
}
|
||||
}
|
||||
return fields;
|
||||
@@ -148,7 +148,7 @@ public class ApiParameterHelper {
|
||||
|
||||
public static Map<String, String> asMap(final MultivaluedMap<String, String> queryParameters) {
|
||||
|
||||
final Map<String, String> map = new HashMap<String, String>(queryParameters.size());
|
||||
final Map<String, String> map = new HashMap<>(queryParameters.size());
|
||||
|
||||
for (final String parameterName : queryParameters.keySet()) {
|
||||
final List<String> values = queryParameters.get(parameterName);
|
||||
|
||||
+7
-7
@@ -44,7 +44,7 @@ public class ApiGlobalErrorResponse {
|
||||
* they be needed. Typically used to express data validation errors with
|
||||
* parameters passed to API.
|
||||
*/
|
||||
private List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
private List<ApiParameterError> errors = new ArrayList<>();
|
||||
|
||||
public static ApiGlobalErrorResponse unAuthenticated() {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode("error.msg.not.authorized");
|
||||
globalErrorResponse.setDefaultUserMessage("Insufficient privileges to perform this action.");
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.generalError("error.msg.not.authorized", defaultUserMessage));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode("validation.msg.domain.rule.violation");
|
||||
globalErrorResponse.setDefaultUserMessage("Errors contain reason for domain rule violation.");
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode("error.msg.resource.not.found");
|
||||
globalErrorResponse.setDefaultUserMessage("The requested resource is not available.");
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.resourceIdentifierNotFound(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
@@ -123,7 +123,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode(globalisationMessageCode);
|
||||
globalErrorResponse.setDefaultUserMessage(defaultUserMessage);
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.parameterError(globalisationMessageCode, defaultUserMessage, parameterName, defaultUserMessageArgs));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode("error.msg.platform.server.side.error");
|
||||
globalErrorResponse.setDefaultUserMessage("An unexpected error occured on the platform server.");
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
@@ -170,7 +170,7 @@ public class ApiGlobalErrorResponse {
|
||||
globalErrorResponse.setUserMessageGlobalisationCode("error.msg.platform.service.unavailable");
|
||||
globalErrorResponse.setDefaultUserMessage("The server is currently unable to handle the request , please try after some time.");
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs));
|
||||
globalErrorResponse.setErrors(errors);
|
||||
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ public class ApiParameterError {
|
||||
/**
|
||||
* Arguments related to the user error message.
|
||||
*/
|
||||
private List<ApiErrorMessageArg> args = new ArrayList<ApiErrorMessageArg>();
|
||||
private List<ApiErrorMessageArg> args = new ArrayList<>();
|
||||
|
||||
public static ApiParameterError generalError(final String globalisationMessageCode, final String defaultUserMessage,
|
||||
final Object... defaultUserMessageArgs) {
|
||||
@@ -70,7 +70,7 @@ public class ApiParameterError {
|
||||
this.developerMessage = defaultUserMessage;
|
||||
this.defaultUserMessage = defaultUserMessage;
|
||||
|
||||
final List<ApiErrorMessageArg> messageArgs = new ArrayList<ApiErrorMessageArg>();
|
||||
final List<ApiErrorMessageArg> messageArgs = new ArrayList<>();
|
||||
if (defaultUserMessageArgs != null) {
|
||||
for (final Object object : defaultUserMessageArgs) {
|
||||
messageArgs.add(ApiErrorMessageArg.from(object));
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class CommandProcessingResult {
|
||||
this.loanId = null;
|
||||
this.savingsId = null;
|
||||
this.transactionId = null;
|
||||
this.changes = new HashMap<String, Object>();
|
||||
this.changes = new HashMap<>();
|
||||
this.productId = null;
|
||||
this.subResourceId = null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,11 +17,11 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class PaginationParametersDataValidator {
|
||||
|
||||
public static Set<String> sortOrderValues = new HashSet<String>(Arrays.asList("ASC", "DESC"));
|
||||
public static Set<String> sortOrderValues = new HashSet<>(Arrays.asList("ASC", "DESC"));
|
||||
|
||||
public void validateParameterValues(PaginationParameters parameters, final Set<String> supportedOrdeByValues, final String resourceName) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
if (parameters.isOrderByRequested() && !supportedOrdeByValues.contains(parameters.getOrderBy())) {
|
||||
final String defaultUserMessage = "The orderBy value '" + parameters.getOrderBy()
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class UnrecognizedQueryParamExceptionMapper implements ExceptionMapper<Un
|
||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(),
|
||||
parameterName, parameterName, parameterValue, exception.getSupportedParams());
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
errors.add(error);
|
||||
|
||||
final ApiGlobalErrorResponse invalidParameterError = ApiGlobalErrorResponse.badClientRequest(
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class UnsupportedCommandExceptionMapper implements ExceptionMapper<Unsupp
|
||||
@Override
|
||||
public Response toResponse(final UnsupportedCommandException exception) {
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
|
||||
final StringBuilder validationErrorCode = new StringBuilder("error.msg.command.unsupported");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The command ").append(exception.getUnsupportedCommandName()).append(
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class UnsupportedParameterExceptionMapper implements ExceptionMapper<Unsu
|
||||
@Override
|
||||
public Response toResponse(final UnsupportedParameterException exception) {
|
||||
|
||||
final List<ApiParameterError> errors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> errors = new ArrayList<>();
|
||||
|
||||
for (final String parameterName : exception.getUnsupportedParameters()) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("error.msg.parameter.unsupported");
|
||||
|
||||
+8
-8
@@ -34,17 +34,17 @@ public class DatatableCommandFromApiJsonDeserializer {
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParametersForCreate = new HashSet<String>(Arrays.asList("datatableName", "apptableName", "multiRow",
|
||||
private final Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList("datatableName", "apptableName", "multiRow",
|
||||
"columns"));
|
||||
private final Set<String> supportedParametersForCreateColumns = new HashSet<String>(Arrays.asList("name", "type", "length",
|
||||
private final Set<String> supportedParametersForCreateColumns = new HashSet<>(Arrays.asList("name", "type", "length",
|
||||
"mandatory", "code"));
|
||||
private final Set<String> supportedParametersForUpdate = new HashSet<String>(Arrays.asList("apptableName", "changeColumns",
|
||||
private final Set<String> supportedParametersForUpdate = new HashSet<>(Arrays.asList("apptableName", "changeColumns",
|
||||
"addColumns", "dropColumns"));
|
||||
private final Set<String> supportedParametersForAddColumns = new HashSet<String>(Arrays.asList("name", "type", "length", "mandatory",
|
||||
private final Set<String> supportedParametersForAddColumns = new HashSet<>(Arrays.asList("name", "type", "length", "mandatory",
|
||||
"after", "code"));
|
||||
private final Set<String> supportedParametersForChangeColumns = new HashSet<String>(Arrays.asList("name", "newName", "length",
|
||||
private final Set<String> supportedParametersForChangeColumns = new HashSet<>(Arrays.asList("name", "newName", "length",
|
||||
"mandatory", "after", "code", "newCode"));
|
||||
private final Set<String> supportedParametersForDropColumns = new HashSet<String>(Arrays.asList("name"));
|
||||
private final Set<String> supportedParametersForDropColumns = new HashSet<>(Arrays.asList("name"));
|
||||
private final Object[] supportedColumnTypes = { "string", "number", "decimal", "date", "text", "dropdown" };
|
||||
private final Object[] supportedApptableNames = { "m_loan", "m_savings_account", "m_client", "m_group", "m_center", "m_office",
|
||||
"m_savings_product", "m_product_loan" };
|
||||
@@ -97,7 +97,7 @@ public class DatatableCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParametersForCreate);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -147,7 +147,7 @@ public class DatatableCommandFromApiJsonDeserializer {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParametersForUpdate);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable");
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
+6
-6
@@ -73,7 +73,7 @@ public class FromJsonHelper {
|
||||
|
||||
final Map<String, Object> requestMap = this.gsonConverter.fromJson(json, typeOfMap);
|
||||
|
||||
final List<String> unsupportedParameterList = new ArrayList<String>();
|
||||
final List<String> unsupportedParameterList = new ArrayList<>();
|
||||
for (final String providedParameter : requestMap.keySet()) {
|
||||
if (!supportedParams.contains(providedParameter)) {
|
||||
unsupportedParameterList.add(providedParameter);
|
||||
@@ -87,7 +87,7 @@ public class FromJsonHelper {
|
||||
if (object == null) { throw new InvalidParameterException(); }
|
||||
|
||||
final Set<Entry<String, JsonElement>> entries = object.entrySet();
|
||||
final List<String> unsupportedParameterList = new ArrayList<String>();
|
||||
final List<String> unsupportedParameterList = new ArrayList<>();
|
||||
|
||||
for (final Entry<String, JsonElement> providedParameter : entries) {
|
||||
if (!supportedParams.contains(providedParameter.getKey())) {
|
||||
@@ -227,8 +227,8 @@ public class FromJsonHelper {
|
||||
return this.helperDelegator.extractMonthDayFormatParameter(element);
|
||||
}
|
||||
|
||||
public Gson getGsonConverter() {
|
||||
return this.gsonConverter;
|
||||
}
|
||||
|
||||
public Gson getGsonConverter() {
|
||||
return this.gsonConverter;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -58,16 +58,16 @@ public final class GoogleGsonSerializerHelper {
|
||||
public Gson createGsonBuilderWithParameterExclusionSerializationStrategy(final Set<String> supportedParameters,
|
||||
final boolean prettyPrint, final Set<String> responseParameters) {
|
||||
|
||||
final Set<String> parameterNamesToSkip = new HashSet<String>();
|
||||
final Set<String> parameterNamesToSkip = new HashSet<>();
|
||||
|
||||
if (!responseParameters.isEmpty()) {
|
||||
|
||||
// strip out all known support parameters from expected response to
|
||||
// see if unsupported parameters requested for response.
|
||||
final Set<String> differentParametersDetectedSet = new HashSet<String>(responseParameters);
|
||||
final Set<String> differentParametersDetectedSet = new HashSet<>(responseParameters);
|
||||
differentParametersDetectedSet.removeAll(supportedParameters);
|
||||
|
||||
if (!differentParametersDetectedSet.isEmpty()) { throw new UnsupportedParameterException(new ArrayList<String>(
|
||||
if (!differentParametersDetectedSet.isEmpty()) { throw new UnsupportedParameterException(new ArrayList<>(
|
||||
differentParametersDetectedSet)); }
|
||||
|
||||
parameterNamesToSkip.addAll(supportedParameters);
|
||||
|
||||
+10
-10
@@ -298,7 +298,7 @@ public class JsonParserHelper {
|
||||
final DateTimeFormatter formatter = DateTimeFormat.forPattern(dateFormat).withLocale(clientApplicationLocale);
|
||||
value = MonthDay.parse(valueAsString.toLowerCase(clientApplicationLocale), formatter);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.month.day",
|
||||
"The parameter " + parameterName + " is invalid based on the monthDayFormat: '" + dateFormat
|
||||
+ "' and locale: '" + clientApplicationLocale + "' provided:", parameterName, valueAsString,
|
||||
@@ -356,7 +356,7 @@ public class JsonParserHelper {
|
||||
|
||||
if (StringUtils.isBlank(dateFormat) || clientApplicationLocale == null) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
if (StringUtils.isBlank(dateFormat)) {
|
||||
final String defaultMessage = new StringBuilder("The parameter '" + parameterName
|
||||
+ "' requires a 'dateFormat' parameter to be passed with it.").toString();
|
||||
@@ -382,7 +382,7 @@ public class JsonParserHelper {
|
||||
eventLocalDate = DateTimeFormat.forPattern(dateFormat).withLocale(clientApplicationLocale)
|
||||
.parseLocalDate(dateAsString.toLowerCase(clientApplicationLocale));
|
||||
} catch (final IllegalArgumentException e) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.format", "The parameter "
|
||||
+ parameterName + " is invalid based on the dateFormat: '" + dateFormat + "' and locale: '"
|
||||
+ clientApplicationLocale + "' provided:", parameterName, dateAsString, dateFormat);
|
||||
@@ -400,7 +400,7 @@ public class JsonParserHelper {
|
||||
|
||||
if (clientApplicationLocale == null) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final String defaultMessage = new StringBuilder("The parameter '" + parameterName
|
||||
+ "' requires a 'locale' parameter to be passed with it.").toString();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.missing.locale.parameter", defaultMessage,
|
||||
@@ -445,7 +445,7 @@ public class JsonParserHelper {
|
||||
return number;
|
||||
} catch (final ParseException e) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.integer.format", "The parameter "
|
||||
+ parameterName + " has value: " + numericalValueFormatted + " which is invalid integer value for provided locale of ["
|
||||
+ clientApplicationLocale.toString() + "].", parameterName, numericalValueFormatted, clientApplicationLocale);
|
||||
@@ -469,7 +469,7 @@ public class JsonParserHelper {
|
||||
return number;
|
||||
} catch (final NumberFormatException e) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.integer", "The parameter "
|
||||
+ parameterName + " has value: " + numericalValueFormatted + " which is invalid integer.", parameterName,
|
||||
numericalValueFormatted);
|
||||
@@ -485,7 +485,7 @@ public class JsonParserHelper {
|
||||
|
||||
if (clientApplicationLocale == null) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final String defaultMessage = new StringBuilder("The parameter '" + parameterName
|
||||
+ "' requires a 'locale' parameter to be passed with it.").toString();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.missing.locale.parameter", defaultMessage,
|
||||
@@ -524,7 +524,7 @@ public class JsonParserHelper {
|
||||
return number;
|
||||
} catch (final ParseException e) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.decimal.format", "The parameter "
|
||||
+ parameterName + " has value: " + numericalValueFormatted + " which is invalid decimal value for provided locale of ["
|
||||
+ clientApplicationLocale.toString() + "].", parameterName, numericalValueFormatted, clientApplicationLocale);
|
||||
@@ -540,7 +540,7 @@ public class JsonParserHelper {
|
||||
public static Locale localeFromString(final String localeAsString) {
|
||||
|
||||
if (StringUtils.isBlank(localeAsString)) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.locale.format",
|
||||
"The parameter locale is invalid. It cannot be blank.", "locale");
|
||||
dataValidationErrors.add(error);
|
||||
@@ -575,7 +575,7 @@ public class JsonParserHelper {
|
||||
|
||||
private static Locale localeFrom(final String languageCode, final String courntryCode, final String variantCode) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final List<String> allowedLanguages = Arrays.asList(Locale.getISOLanguages());
|
||||
if (!allowedLanguages.contains(languageCode.toLowerCase())) {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class DateUtils {
|
||||
final DateTime dateTime = dateStringFormat.parseDateTime(stringDate);
|
||||
return dateTime.toLocalDate();
|
||||
} catch (final IllegalArgumentException e) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.pattern", "The parameter date ("
|
||||
+ stringDate + ") is invalid w.r.t. pattern " + pattern, "date", stringDate, pattern);
|
||||
dataValidationErrors.add(error);
|
||||
|
||||
+1
-1
@@ -20,6 +20,6 @@ public class PaginationHelper<E> {
|
||||
// determine how many rows are available
|
||||
final int totalFilteredRecords = jt.queryForInt(sqlCountRows);
|
||||
|
||||
return new Page<E>(items, totalFilteredRecords);
|
||||
return new Page<>(items, totalFilteredRecords);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -15,9 +15,9 @@ public class ThreadLocalContextUtil {
|
||||
|
||||
public static final String CONTEXT_TENANTS = "tenants";
|
||||
|
||||
private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();
|
||||
private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
|
||||
|
||||
private static final ThreadLocal<MifosPlatformTenant> tenantcontext = new ThreadLocal<MifosPlatformTenant>();
|
||||
private static final ThreadLocal<MifosPlatformTenant> tenantcontext = new ThreadLocal<>();
|
||||
|
||||
public static void setTenant(final MifosPlatformTenant tenant) {
|
||||
Assert.notNull(tenant, "tenant cannot be null");
|
||||
|
||||
+7
-7
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceService {
|
||||
|
||||
private final Map<Long, DataSource> tenantToDataSourceMap = new HashMap<Long, DataSource>(1);
|
||||
private final Map<Long, DataSource> tenantToDataSourceMap = new HashMap<>(1);
|
||||
private final DataSource tenantDataSource;
|
||||
|
||||
@Autowired
|
||||
@@ -88,13 +88,13 @@ public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceSe
|
||||
* Vishwas- Do we need to enable the below properties and add
|
||||
* ResetAbandonedTimer for long running batch Jobs?
|
||||
**/
|
||||
//poolConfiguration.setMaxActive(tenant.getMaxActive());
|
||||
//poolConfiguration.setMinIdle(tenant.getMinIdle());
|
||||
//poolConfiguration.setMaxIdle(tenant.getMaxIdle());
|
||||
// poolConfiguration.setMaxActive(tenant.getMaxActive());
|
||||
// poolConfiguration.setMinIdle(tenant.getMinIdle());
|
||||
// poolConfiguration.setMaxIdle(tenant.getMaxIdle());
|
||||
|
||||
//poolConfiguration.setSuspectTimeout(tenant.getSuspectTimeout());
|
||||
//poolConfiguration.setTimeBetweenEvictionRunsMillis(tenant.getTimeBetweenEvictionRunsMillis());
|
||||
//poolConfiguration.setMinEvictableIdleTimeMillis(tenant.getMinEvictableIdleTimeMillis());
|
||||
// poolConfiguration.setSuspectTimeout(tenant.getSuspectTimeout());
|
||||
// poolConfiguration.setTimeBetweenEvictionRunsMillis(tenant.getTimeBetweenEvictionRunsMillis());
|
||||
// poolConfiguration.setMinEvictableIdleTimeMillis(tenant.getMinEvictableIdleTimeMillis());
|
||||
|
||||
poolConfiguration.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
|
||||
+ "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport");
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class DataTableApiConstant {
|
||||
|
||||
public static final String categoryParamName ="category";
|
||||
public static final String localParamName = "locale";
|
||||
public static final Set<String> REGISTER_PARAMS = new HashSet<String>(Arrays.asList(categoryParamName,localParamName));
|
||||
public static final Set<String> REGISTER_PARAMS = new HashSet<>(Arrays.asList(categoryParamName,localParamName));
|
||||
|
||||
public static final String DATATABLE_RESOURCE_NAME ="dataTables";
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
public class ReportsApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "reportName", "reportType",
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType",
|
||||
"reportSubType", "reportCategory", "description", "reportSql", "coreReport", "useReport", "reportParameters"));
|
||||
|
||||
private final String resourceNameForPermissions = "REPORT";
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ public class RunreportsApiResource {
|
||||
|
||||
private Map<String, String> getReportParams(final MultivaluedMap<String, String> queryParams, final Boolean isPentaho) {
|
||||
|
||||
final Map<String, String> reportParams = new HashMap<String, String>();
|
||||
final Map<String, String> reportParams = new HashMap<>();
|
||||
final Set<String> keys = queryParams.keySet();
|
||||
String pKey;
|
||||
String pValue;
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class DataTableValidator {
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REGISTER_PARAMS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(DATATABLE_RESOURCE_NAME);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
|
||||
+2
-2
@@ -75,13 +75,13 @@ final public class ReportData {
|
||||
|
||||
public void appendedTemplate(final Collection<ReportParameterData> allowedParameters) {
|
||||
|
||||
final List<String> reportTypes = new ArrayList<String>();
|
||||
final List<String> reportTypes = new ArrayList<>();
|
||||
reportTypes.add("Table");
|
||||
reportTypes.add("Pentaho");
|
||||
reportTypes.add("Chart");
|
||||
this.allowedReportTypes = reportTypes;
|
||||
|
||||
final List<String> reportSubTypes = new ArrayList<String>();
|
||||
final List<String> reportSubTypes = new ArrayList<>();
|
||||
reportSubTypes.add("Bar");
|
||||
reportSubTypes.add("Pie");
|
||||
this.allowedReportSubTypes = reportSubTypes;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public final class ResultsetColumnHeaderData {
|
||||
final Long columnLength = null;
|
||||
final boolean columnNullable = false;
|
||||
final boolean columnIsPrimaryKey = false;
|
||||
final List<ResultsetColumnValueData> columnValues = new ArrayList<ResultsetColumnValueData>();
|
||||
final List<ResultsetColumnValueData> columnValues = new ArrayList<>();
|
||||
final String columnCode = null;
|
||||
return new ResultsetColumnHeaderData(columnName, columnType, columnLength, columnNullable, columnIsPrimaryKey, columnValues,
|
||||
columnCode);
|
||||
|
||||
+3
-3
@@ -62,7 +62,7 @@ public final class Report extends AbstractPersistable<Long> {
|
||||
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "report", orphanRemoval = true)
|
||||
private final Set<ReportParameterUsage> reportParameterUsages = new HashSet<ReportParameterUsage>();
|
||||
private final Set<ReportParameterUsage> reportParameterUsages = new HashSet<>();
|
||||
|
||||
public static Report fromJson(final JsonCommand command) {
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class Report extends AbstractPersistable<Long> {
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(8);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(8);
|
||||
|
||||
String paramName = "reportName";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportName)) {
|
||||
@@ -203,7 +203,7 @@ public final class Report extends AbstractPersistable<Long> {
|
||||
|
||||
private void validate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("report");
|
||||
|
||||
baseDataValidator.reset().parameter("reportName").value(this.reportName).notBlank().notExceedingLengthOf(100);
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public final class ReportCommandFromApiJsonDeserializer {
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("reportName", "reportType", "reportSubType",
|
||||
private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("reportName", "reportType", "reportSubType",
|
||||
"reportCategory", "description", "reportSql", "useReport", "reportParameters"));
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
+7
-10
@@ -44,9 +44,8 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
|
||||
final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql);
|
||||
|
||||
|
||||
final List<ResultsetColumnHeaderData> columnHeaders = new ArrayList<ResultsetColumnHeaderData>();
|
||||
final List<ResultsetRowData> resultsetDataRows = new ArrayList<ResultsetRowData>();
|
||||
final List<ResultsetColumnHeaderData> columnHeaders = new ArrayList<>();
|
||||
final List<ResultsetRowData> resultsetDataRows = new ArrayList<>();
|
||||
|
||||
final SqlRowSetMetaData rsmd = rs.getMetaData();
|
||||
|
||||
@@ -60,7 +59,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
}
|
||||
|
||||
while (rs.next()) {
|
||||
final List<String> columnValues = new ArrayList<String>();
|
||||
final List<String> columnValues = new ArrayList<>();
|
||||
for (int i = 0; i < rsmd.getColumnCount(); i++) {
|
||||
final String columnName = rsmd.getColumnName(i + 1);
|
||||
final String columnValue = rs.getString(columnName);
|
||||
@@ -180,7 +179,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
|
||||
final SqlRowSet columnDefinitions = getDatatableMetaData(datatable);
|
||||
|
||||
final List<ResultsetColumnHeaderData> columnHeaders = new ArrayList<ResultsetColumnHeaderData>();
|
||||
final List<ResultsetColumnHeaderData> columnHeaders = new ArrayList<>();
|
||||
|
||||
columnDefinitions.beforeFirst();
|
||||
while (columnDefinitions.next()) {
|
||||
@@ -193,7 +192,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
final boolean columnNullable = "YES".equalsIgnoreCase(isNullable);
|
||||
final boolean columnIsPrimaryKey = "PRI".equalsIgnoreCase(isPrimaryKey);
|
||||
|
||||
List<ResultsetColumnValueData> columnValues = new ArrayList<ResultsetColumnValueData>();
|
||||
List<ResultsetColumnValueData> columnValues = new ArrayList<>();
|
||||
String codeName = null;
|
||||
if ("varchar".equalsIgnoreCase(columnType)) {
|
||||
|
||||
@@ -238,8 +237,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
*/
|
||||
private List<ResultsetColumnValueData> retreiveColumnValues(final String codeName) {
|
||||
|
||||
|
||||
final List<ResultsetColumnValueData> columnValues = new ArrayList<ResultsetColumnValueData>();
|
||||
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";
|
||||
@@ -260,8 +258,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
|
||||
private List<ResultsetColumnValueData> retreiveColumnValues(final Integer codeId) {
|
||||
|
||||
|
||||
final List<ResultsetColumnValueData> columnValues = new ArrayList<ResultsetColumnValueData>();
|
||||
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";
|
||||
|
||||
+4
-4
@@ -363,7 +363,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
rptParamValues.put("userhierarchy", userhierarchy);
|
||||
|
||||
final MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
|
||||
|
||||
rptParamValues.put("tenantUrl", tenantUrl);
|
||||
rptParamValues.put("username", tenant.getSchemaUsername());
|
||||
rptParamValues.put("password", tenant.getSchemaPassword());
|
||||
@@ -462,7 +462,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
|
||||
final Collection<ReportParameterJoinData> rpJoins = this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||
|
||||
final Collection<ReportData> reportList = new ArrayList<ReportData>();
|
||||
final Collection<ReportData> reportList = new ArrayList<>();
|
||||
if (rpJoins == null || rpJoins.size() == 0) { return reportList; }
|
||||
|
||||
Collection<ReportParameterData> reportParameters = null;
|
||||
@@ -484,7 +484,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
if (rpJoin.getReportId().equals(prevReportId)) {
|
||||
// more than one parameter for report
|
||||
if (reportParameters == null) {
|
||||
reportParameters = new ArrayList<ReportParameterData>();
|
||||
reportParameters = new ArrayList<>();
|
||||
}
|
||||
reportParameters.add(new ReportParameterData(rpJoin.getReportParameterId(), rpJoin.getParameterId(), rpJoin
|
||||
.getReportParameterName(), rpJoin.getParameterName()));
|
||||
@@ -512,7 +512,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
|
||||
if (rpJoin.getReportParameterId() != null) {
|
||||
// report has at least one parameter
|
||||
reportParameters = new ArrayList<ReportParameterData>();
|
||||
reportParameters = new ArrayList<>();
|
||||
reportParameters.add(new ReportParameterData(rpJoin.getReportParameterId(), rpJoin.getParameterId(), rpJoin
|
||||
.getReportParameterName(), rpJoin.getParameterName()));
|
||||
} else {
|
||||
|
||||
+18
-18
@@ -134,7 +134,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql);
|
||||
|
||||
final List<DatatableData> datatables = new ArrayList<DatatableData>();
|
||||
final List<DatatableData> datatables = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
final String appTableName = rs.getString("application_table_name");
|
||||
final String registeredDatatableName = rs.getString("registered_table_name");
|
||||
@@ -528,7 +528,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
final String fkName = dataTableNameAlias + "_" + fkColumnName;
|
||||
StringBuilder sqlBuilder = new StringBuilder();
|
||||
final StringBuilder constrainBuilder = new StringBuilder();
|
||||
final Map<String, Long> codeMappings = new HashMap<String, Long>();
|
||||
final Map<String, Long> codeMappings = new HashMap<>();
|
||||
sqlBuilder = sqlBuilder.append("CREATE TABLE `" + datatableName + "` (");
|
||||
|
||||
if (multiRow) {
|
||||
@@ -565,7 +565,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
registerColumnCodeMapping(codeMappings);
|
||||
} catch (final SQLGrammarException e) {
|
||||
final Throwable realCause = e.getCause();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable");
|
||||
|
||||
if (realCause.getMessage().toLowerCase().contains("duplicate column name")) {
|
||||
@@ -787,7 +787,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
validateDatatableName(datatableName);
|
||||
|
||||
final List<ResultsetColumnHeaderData> columnHeaderData = this.genericDataService.fillResultsetColumnHeaders(datatableName);
|
||||
final Map<String, ResultsetColumnHeaderData> mapColumnNameDefinition = new HashMap<String, ResultsetColumnHeaderData>();
|
||||
final Map<String, ResultsetColumnHeaderData> mapColumnNameDefinition = new HashMap<>();
|
||||
for (final ResultsetColumnHeaderData columnHeader : columnHeaderData) {
|
||||
mapColumnNameDefinition.put(columnHeader.getColumnName(), columnHeader);
|
||||
}
|
||||
@@ -834,7 +834,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`");
|
||||
final StringBuilder constrainBuilder = new StringBuilder();
|
||||
final List<String> codeMappings = new ArrayList<String>();
|
||||
final List<String> codeMappings = new ArrayList<>();
|
||||
for (final JsonElement column : dropColumns) {
|
||||
parseDatatableColumnForDrop(column.getAsJsonObject(), sqlBuilder, datatableName, constrainBuilder, codeMappings);
|
||||
}
|
||||
@@ -852,7 +852,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`");
|
||||
final StringBuilder constrainBuilder = new StringBuilder();
|
||||
final Map<String, Long> codeMappings = new HashMap<String, Long>();
|
||||
final Map<String, Long> codeMappings = new HashMap<>();
|
||||
for (final JsonElement column : addColumns) {
|
||||
parseDatatableColumnForAdd(column.getAsJsonObject(), sqlBuilder, datatableName.toLowerCase().replaceAll("\\s", "_"),
|
||||
constrainBuilder, codeMappings, isConstraintApproach);
|
||||
@@ -871,8 +871,8 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`");
|
||||
final StringBuilder constrainBuilder = new StringBuilder();
|
||||
final Map<String, Long> codeMappings = new HashMap<String, Long>();
|
||||
final List<String> removeMappings = new ArrayList<String>();
|
||||
final Map<String, Long> codeMappings = new HashMap<>();
|
||||
final List<String> removeMappings = new ArrayList<>();
|
||||
for (final JsonElement column : changeColumns) {
|
||||
parseDatatableColumnForUpdate(column.getAsJsonObject(), mapColumnNameDefinition, sqlBuilder, datatableName,
|
||||
constrainBuilder, codeMappings, removeMappings, isConstraintApproach);
|
||||
@@ -895,7 +895,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
}
|
||||
} catch (final SQLGrammarException e) {
|
||||
final Throwable realCause = e.getCause();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable");
|
||||
|
||||
if (realCause.getMessage().toLowerCase().contains("unknown column")) {
|
||||
@@ -933,7 +933,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
this.jdbcTemplate.batchUpdate(sqlArray);
|
||||
} catch (final SQLGrammarException e) {
|
||||
final Throwable realCause = e.getCause();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable");
|
||||
if (realCause.getMessage().contains("Unknown table")) {
|
||||
baseDataValidator.reset().parameter("datatableName").failWithCode("does.not.exist");
|
||||
@@ -1218,12 +1218,12 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql);
|
||||
|
||||
final List<ResultsetRowData> resultsetDataRows = new ArrayList<ResultsetRowData>();
|
||||
final List<ResultsetRowData> resultsetDataRows = new ArrayList<>();
|
||||
|
||||
final SqlRowSetMetaData rsmd = rs.getMetaData();
|
||||
|
||||
while (rs.next()) {
|
||||
final List<String> columnValues = new ArrayList<String>();
|
||||
final List<String> columnValues = new ArrayList<>();
|
||||
for (int i = 0; i < rsmd.getColumnCount(); i++) {
|
||||
final String columnName = rsmd.getColumnName(i + 1);
|
||||
final String columnValue = rs.getString(columnName);
|
||||
@@ -1387,7 +1387,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
final String fkName) {
|
||||
|
||||
final Map<String, String> affectedColumns = getAffectedColumns(grs.getColumnHeaders(), queryParams, fkName);
|
||||
final Map<String, Object> affectedAndChangedColumns = new HashMap<String, Object>();
|
||||
final Map<String, Object> affectedAndChangedColumns = new HashMap<>();
|
||||
|
||||
for (final String key : affectedColumns.keySet()) {
|
||||
final String columnValue = affectedColumns.get(key);
|
||||
@@ -1435,7 +1435,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
String columnHeaderUnderscored;
|
||||
boolean notFound;
|
||||
|
||||
final Map<String, String> affectedColumns = new HashMap<String, String>();
|
||||
final Map<String, String> affectedColumns = new HashMap<>();
|
||||
final Set<String> keys = queryParams.keySet();
|
||||
for (final String key : keys) {
|
||||
// ignores id and foreign key fields
|
||||
@@ -1475,7 +1475,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
if (StringUtils.isEmpty(paramValue) && columnHeader.isMandatory()) {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("error.msg.column.mandatory", "Mandatory",
|
||||
columnHeader.getColumnName());
|
||||
dataValidationErrors.add(error);
|
||||
@@ -1489,7 +1489,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
if (columnHeader.isCodeValueDisplayType()) {
|
||||
|
||||
if (columnHeader.isColumnValueNotAllowed(paramValue)) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("error.msg.invalid.columnValue",
|
||||
"Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue);
|
||||
dataValidationErrors.add(error);
|
||||
@@ -1502,7 +1502,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
final Integer codeLookup = Integer.valueOf(paramValue);
|
||||
if (columnHeader.isColumnCodeNotAllowed(codeLookup)) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("error.msg.invalid.columnValue",
|
||||
"Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue);
|
||||
dataValidationErrors.add(error);
|
||||
@@ -1544,7 +1544,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
final ApiParameterError error = ApiParameterError.parameterError(
|
||||
"validation.msg.datatable.entry.column.exceeds.maxlength", "The column `" + columnHeader.getColumnName()
|
||||
+ "` exceeds its defined max-length ", columnHeader.getColumnName(), paramValue);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
dataValidationErrors.add(error);
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.",
|
||||
dataValidationErrors);
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public class ReportWritePlatformServiceImpl implements ReportWritePlatformServic
|
||||
final JsonArray reportParametersArray = command.arrayOfParameterNamed("reportParameters");
|
||||
if (reportParametersArray != null) {
|
||||
|
||||
reportParameterUsages = new HashSet<ReportParameterUsage>();
|
||||
reportParameterUsages = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < reportParametersArray.size(); i++) {
|
||||
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
@Scope("singleton")
|
||||
public class DocumentManagementApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "parentEntityType", "parentEntityId",
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "parentEntityType", "parentEntityId",
|
||||
"name", "fileName", "size", "type", "description"));
|
||||
|
||||
private final String SystemEntityType = "DOCUMENT";
|
||||
@@ -120,7 +120,7 @@ public class DocumentManagementApiResource {
|
||||
@FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name,
|
||||
@FormDataParam("description") final String description) {
|
||||
|
||||
final Set<String> modifiedParams = new HashSet<String>();
|
||||
final Set<String> modifiedParams = new HashSet<>();
|
||||
modifiedParams.add("name");
|
||||
modifiedParams.add("description");
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ public class DocumentCommandValidator {
|
||||
}
|
||||
|
||||
public void validateForUpdate() {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("document");
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DocumentCommandValidator {
|
||||
}
|
||||
|
||||
public void validateForCreate() {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("document");
|
||||
baseDataValidator.reset().parameter("parentEntityType").value(this.command.getParentEntityType()).notBlank()
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ public class ContentRepositoryUtils {
|
||||
}
|
||||
|
||||
public static void validateClientImageNotEmpty(final String imageFileName) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
if (imageFileName == null) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.clientImage.cannot.be.blank");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter image cannot be blank.");
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public enum StorageType {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, StorageType> intToEnumMap = new HashMap<Integer, StorageType>();
|
||||
private static final Map<Integer, StorageType> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final StorageType type : StorageType.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class CronMethodParser {
|
||||
|
||||
private static final String RESOURCE_PATTERN = "**/*.class";
|
||||
|
||||
private static final Map<String, String[]> targetMethosMap = new HashMap<String, String[]>();
|
||||
private static final Map<String, String[]> targetMethosMap = new HashMap<>();
|
||||
|
||||
private static final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
|
||||
|
||||
|
||||
+4
-4
@@ -27,18 +27,18 @@ public class SchedulerJobApiConstants {
|
||||
public static final String cronExpressionParamName = "cronExpression";
|
||||
public static final String schedulerStatusParamName = "active";
|
||||
|
||||
public static final Set<String> JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(jobIdentifierParamName,
|
||||
public static final Set<String> JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(jobIdentifierParamName,
|
||||
displayNameParamName, nextRunTimeParamName, initializingErrorParamName, cronExpressionParamName, jobActiveStatusParamName,
|
||||
currentlyRunningParamName, lastRunHistoryObjParamName));
|
||||
|
||||
public static final Set<String> JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(versionParamName,
|
||||
public static final Set<String> JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(versionParamName,
|
||||
jobRunStartTimeParamName, jobRunEndTimeParamName, statusParamName, jobRunErrorMessageParamName, triggerTypeParamName,
|
||||
jobRunErrorLogParamName));
|
||||
|
||||
public static final Set<String> JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(displayNameParamName,
|
||||
public static final Set<String> JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(displayNameParamName,
|
||||
jobActiveStatusParamName, cronExpressionParamName));
|
||||
|
||||
public static final Set<String> SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(schedulerStatusParamName));
|
||||
public static final Set<String> SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(schedulerStatusParamName));
|
||||
|
||||
public static final String COMMAND_EXECUTE_JOB = "executeJob";
|
||||
public static final String COMMAND_STOP_SCHEDULER = "stop";
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class JobDetailDataValidator {
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SchedulerJobApiConstants.JOB_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(SchedulerJobApiConstants.JOB_RESOURCE_NAME);
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ public class ScheduledJobDetail extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(9);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(9);
|
||||
|
||||
if (command.isChangeInStringParameterNamed(SchedulerJobApiConstants.displayNameParamName, this.jobDisplayName)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(SchedulerJobApiConstants.displayNameParamName).trim();
|
||||
|
||||
+10
-15
@@ -51,7 +51,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
|
||||
private final TenantDetailsService tenantDetailsService;
|
||||
|
||||
private final HashMap<String, Scheduler> schedulers = new HashMap<String, Scheduler>(4);
|
||||
private final HashMap<String, Scheduler> schedulers = new HashMap<>(4);
|
||||
|
||||
@Autowired
|
||||
public JobRegisterServiceImpl(final ApplicationContext applicationContext, final SchedularWritePlatformService schedularService,
|
||||
@@ -95,7 +95,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
if (scheduler == null || !scheduler.checkExists(jobKey)) {
|
||||
final JobDetail jobDetail = createJobDetail(scheduledJobDetail);
|
||||
final String tempSchedulerName = "temp" + scheduledJobDetail.getId();
|
||||
final List<Class<? extends JobListener>> listenerClasses = new ArrayList<Class<? extends JobListener>>(2);
|
||||
final List<Class<? extends JobListener>> listenerClasses = new ArrayList<>(2);
|
||||
listenerClasses.add(SchedulerJobListener.class);
|
||||
listenerClasses.add(SchedulerStopListener.class);
|
||||
final Scheduler tempScheduler = createScheduler(tempSchedulerName, 1, listenerClasses);
|
||||
@@ -108,12 +108,9 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
}
|
||||
|
||||
} catch (final Exception e) {
|
||||
final String msg = "Job execution failed for job with id:"
|
||||
+ scheduledJobDetail.getId();
|
||||
logger.error(msg, e);
|
||||
throw new PlatformInternalServerException(
|
||||
"error.msg.sheduler.job.execution.failed", msg,
|
||||
scheduledJobDetail.getId());
|
||||
final String msg = "Job execution failed for job with id:" + scheduledJobDetail.getId();
|
||||
logger.error(msg, e);
|
||||
throw new PlatformInternalServerException("error.msg.sheduler.job.execution.failed", msg, scheduledJobDetail.getId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -218,9 +215,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
scheduledJobDetails.updateNextRunTime(null);
|
||||
final String stackTrace = getStackTraceAsString(throwable);
|
||||
scheduledJobDetails.updateErrorLog(stackTrace);
|
||||
logger.error(
|
||||
"Could not schedule job: "
|
||||
+ scheduledJobDetails.getJobName(), throwable);
|
||||
logger.error("Could not schedule job: " + scheduledJobDetails.getJobName(), throwable);
|
||||
}
|
||||
scheduledJobDetails.updateCurrentlyRunningStatus(false);
|
||||
}
|
||||
@@ -264,7 +259,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
final SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
|
||||
schedulerFactoryBean.setSchedulerName(name);
|
||||
if (listenerClasses == null) {
|
||||
listenerClasses = new ArrayList<Class<? extends JobListener>>(1);
|
||||
listenerClasses = new ArrayList<>(1);
|
||||
listenerClasses.add(SchedulerJobListener.class);
|
||||
}
|
||||
schedulerFactoryBean.setGlobalJobListeners(getGlobalListener(listenerClasses));
|
||||
@@ -280,7 +275,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
}
|
||||
|
||||
private JobListener[] getGlobalListener(final List<Class<? extends JobListener>> listenerClasses) throws ClassNotFoundException {
|
||||
final List<JobListener> listeners = new ArrayList<JobListener>(listenerClasses.size());
|
||||
final List<JobListener> listeners = new ArrayList<>(listenerClasses.size());
|
||||
for (final Class<?> listenerClass : listenerClasses) {
|
||||
final JobListener listener = (JobListener) getBeanObject(listenerClass);
|
||||
listeners.add(listener);
|
||||
@@ -309,7 +304,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
private Object getBeanObject(final Class<?> classType) throws ClassNotFoundException {
|
||||
final List<Class<?>> typesList = new ArrayList<Class<?>>();
|
||||
final List<Class<?>> typesList = new ArrayList<>();
|
||||
final Class<?>[] interfaceType = classType.getInterfaces();
|
||||
if (interfaceType.length > 0) {
|
||||
typesList.addAll(Arrays.asList(interfaceType));
|
||||
@@ -320,7 +315,7 @@ public class JobRegisterServiceImpl implements JobRegisterService {
|
||||
}
|
||||
typesList.add(superclassType);
|
||||
}
|
||||
final List<String> beanNames = new ArrayList<String>();
|
||||
final List<String> beanNames = new ArrayList<>();
|
||||
for (final Class<?> clazz : typesList) {
|
||||
beanNames.addAll(Arrays.asList(this.applicationContext.getBeanNamesForType(clazz)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class SchedulerJobRunnerReadServiceImpl implements SchedulerJobRunnerRead
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private final PaginationHelper<JobDetailHistoryData> paginationHelper = new PaginationHelper<JobDetailHistoryData>();
|
||||
private final PaginationHelper<JobDetailHistoryData> paginationHelper = new PaginationHelper<>();
|
||||
|
||||
@Autowired
|
||||
public SchedulerJobRunnerReadServiceImpl(final RoutingDataSource dataSource) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user