You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by na...@apache.org on 2017/06/16 14:50:59 UTC
[1/6] fineract git commit: Completed the sonar fixes in FINERATC-436
Repository: fineract
Updated Branches:
refs/heads/develop 17ff4b54c -> 0cd1e3965
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQuerySearchConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQuerySearchConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQuerySearchConstants.java
index 1e48c67..a895253 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQuerySearchConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQuerySearchConstants.java
@@ -46,18 +46,17 @@ public interface AdHocQuerySearchConstants {
public static final String maxOutstandingAmountParamName = "maxOutstandingAmount";
public static final String outstandingAmountParamName = "outstandingAmount";
- public static final Set<String> AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(entitiesParamName, loanStatusParamName,
- loanProductsParamName, officesParamName, loanDateOptionParamName, loanFromDateParamName, loanToDateParamName,
- includeOutStandingAmountPercentageParamName, outStandingAmountPercentageConditionParamName,
- minOutStandingAmountPercentageParamName, maxOutStandingAmountPercentageParamName, outStandingAmountPercentageParamName,
- includeOutstandingAmountParamName, outstandingAmountConditionParamName, minOutstandingAmountParamName,
- maxOutstandingAmountParamName, outstandingAmountParamName, localeParamName, dateFormatParamName));
-
- public static final Set<String> AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet<>(
- Arrays.asList("between", "<=", ">=", "<", ">", "="));
-
- public static final Object[] loanDateOptions = { "approvalDate", "createdDate", "disbursalDate" };
+ public static final String approvalDateOption = "approvalDate";
+ public static final String createDateOption = "createdDate";
+ public static final String disbursalDateOption = "disbursalDate";
+
+ public static final String allLoanStatusOption= "all";
+ public static final String activeLoanStatusOption= "active";
+ public static final String overpaidLoanStatusOption= "overpaid";
+ public static final String arrearsLoanStatusOption= "arrears";
+ public static final String closedLoanStatusOption= "closed";
+ public static final String writeoffLoanStatusOption= "writeoff";
+
public static final Object[] entityTypeOptions = { "clients", "groups", "loans", "clientIdentifiers" };
- public static final Object[] loanStatusOptions = { "all", "active", "overpaid", "arrears", "closed", "writeoff" };
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiConstants.java
index affe03b..cb1971a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiConstants.java
@@ -36,18 +36,4 @@ public interface SelfBeneficiariesTPTApiConstants {
public static final String ID_PARAM_NAME = "id";
public static final String CLIENT_NAME_PARAM_NAME = "clientName";
public static final String ACCOUNT_TYPE_OPTIONS_PARAM_NAME = "accountTypeOptions";
-
- public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(LOCALE, NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
- ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME,
- TRANSFER_LIMIT_PARAM_NAME));
-
- public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(NAME_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
-
- public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
- ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME,
- TRANSFER_LIMIT_PARAM_NAME, ID_PARAM_NAME,
- CLIENT_NAME_PARAM_NAME, ACCOUNT_TYPE_OPTIONS_PARAM_NAME));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
index 344d991..5f2ff48 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
@@ -20,6 +20,8 @@ package org.apache.fineract.portfolio.self.account.api;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -60,6 +62,13 @@ public class SelfBeneficiariesTPTApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final SelfBeneficiariesTPTReadPlatformService readPlatformService;
+ private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ SelfBeneficiariesTPTApiConstants.NAME_PARAM_NAME, SelfBeneficiariesTPTApiConstants.OFFICE_NAME_PARAM_NAME,
+ SelfBeneficiariesTPTApiConstants.ACCOUNT_NUMBER_PARAM_NAME,
+ SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_PARAM_NAME,
+ SelfBeneficiariesTPTApiConstants.TRANSFER_LIMIT_PARAM_NAME, SelfBeneficiariesTPTApiConstants.ID_PARAM_NAME,
+ SelfBeneficiariesTPTApiConstants.CLIENT_NAME_PARAM_NAME,
+ SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_OPTIONS_PARAM_NAME));
@Autowired
public SelfBeneficiariesTPTApiResource(
@@ -94,8 +103,7 @@ public class SelfBeneficiariesTPTApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, templateData,
- SelfBeneficiariesTPTApiConstants.RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, templateData, RESPONSE_DATA_PARAMETERS);
}
@POST
@@ -154,8 +162,7 @@ public class SelfBeneficiariesTPTApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, beneficiaries,
- SelfBeneficiariesTPTApiConstants.RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, beneficiaries, RESPONSE_DATA_PARAMETERS);
}
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java
index 2ba2899..2c85923 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java
@@ -24,14 +24,15 @@ import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTP
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_PARAM_NAME;
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.ACCOUNT_NUMBER_PARAM_NAME;
import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.TRANSFER_LIMIT_PARAM_NAME;
-import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.CREATE_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants.UPDATE_REQUEST_DATA_PARAMETERS;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -40,6 +41,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.account.PortfolioAccountType;
+import org.apache.fineract.portfolio.self.account.api.SelfBeneficiariesTPTApiConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,6 +52,13 @@ import com.google.gson.reflect.TypeToken;
public class SelfBeneficiariesTPTDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(SelfBeneficiariesTPTApiConstants.LOCALE, NAME_PARAM_NAME, OFFICE_NAME_PARAM_NAME,
+ ACCOUNT_NUMBER_PARAM_NAME, ACCOUNT_TYPE_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
+
+ private static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(NAME_PARAM_NAME, TRANSFER_LIMIT_PARAM_NAME));
+
@Autowired
public SelfBeneficiariesTPTDataValidator(
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java
index 80812af..d3efb05 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java
@@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.shareaccounts.serialization;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -89,6 +90,26 @@ public class ShareAccountDataSerializer {
private final ShareProductRepositoryWrapper shareProductRepository;
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService ;
+
+ private static final Set<String> approvalParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
+ .locale_paramname,
+ ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.approveddate_paramname,
+ ShareAccountApiConstants.note_paramname));
+
+ private static final Set<String> activateParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
+ .locale_paramname,
+ ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.activatedate_paramname));
+
+ private static final Set<String> closeParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
+ .locale_paramname,
+ ShareAccountApiConstants.dateformat_paramname, ShareAccountApiConstants.closeddate_paramname,
+ ShareAccountApiConstants.note_paramname));
+
+ private static final Set<String> addtionalSharesParameters = new HashSet<>(Arrays.asList(ShareAccountApiConstants
+ .locale_paramname,
+ ShareAccountApiConstants.requesteddate_paramname, ShareAccountApiConstants.requestedshares_paramname,
+ ShareAccountApiConstants.purchasedprice_paramname, ShareAccountApiConstants.dateformat_paramname));
+
@Autowired
public ShareAccountDataSerializer(final PlatformSecurityContext platformSecurityContext, final FromJsonHelper fromApiJsonHelper,
@@ -426,7 +447,7 @@ public class ShareAccountDataSerializer {
Map<String, Object> actualChanges = new HashMap<>();
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.approvalParameters);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), approvalParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
@@ -498,7 +519,7 @@ public class ShareAccountDataSerializer {
Map<String, Object> actualChanges = new HashMap<>();
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.activateParameters);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
if(!account.status().equals(ShareAccountStatusType.APPROVED.getValue())) {
@@ -552,7 +573,7 @@ public class ShareAccountDataSerializer {
Map<String, Object> actualChanges = new HashMap<>();
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.activateParameters);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
@@ -633,7 +654,7 @@ public class ShareAccountDataSerializer {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareAccountApiConstants.addtionalSharesParameters);
+ addtionalSharesParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
@@ -697,7 +718,7 @@ public class ShareAccountDataSerializer {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareAccountApiConstants.addtionalSharesParameters);
+ addtionalSharesParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
@@ -747,7 +768,7 @@ public class ShareAccountDataSerializer {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareAccountApiConstants.addtionalSharesParameters);
+ addtionalSharesParameters);
JsonElement element = jsonCommand.parsedJson();
final ArrayList<Long> purchasedShares = new ArrayList<>();
if (this.fromApiJsonHelper.parameterExists(ShareAccountApiConstants.requestedshares_paramname, element)) {
@@ -792,7 +813,7 @@ public class ShareAccountDataSerializer {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareAccountApiConstants.addtionalSharesParameters);
+ addtionalSharesParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
@@ -938,7 +959,7 @@ public class ShareAccountDataSerializer {
Map<String, Object> actualChanges = new HashMap<>();
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.closeParameters);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), closeParameters);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesaccount");
JsonElement element = jsonCommand.parsedJson();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/constants/ShareProductApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/constants/ShareProductApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/constants/ShareProductApiConstants.java
index 4a0725e..ff2e62b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/constants/ShareProductApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/constants/ShareProductApiConstants.java
@@ -65,19 +65,4 @@ public interface ShareProductApiConstants {
String accountingRuleParamName = "accountingRule";
- Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(locale_paramname, name_paramname, shortname_paramname,
- shortname_paramname, description_paramname, externalid_paramname, totalshares_paramname, currency_paramname,
- digitsafterdecimal_paramname, digitsafterdecimal_paramname, inmultiplesof_paramname, totalsharesissued_paramname,
- unitprice_paramname, minimumshares_paramname, nominaltshares_paramname, maximumshares_paramname, marketprice_paramname,
- charges_paramname, allowdividendcalculationforinactiveclients_paramname, lockperiod_paramname,
- lockinperiodfrequencytype_paramname, minimumactiveperiodfordividends_paramname, minimumactiveperiodfrequencytype_paramname,
- sharecapital_paramname, accountingRuleParamName,
- AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
- AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
- AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
- AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue()));
-
- Set<String> supportedParametersForDivident = new HashSet<>(Arrays.asList(locale_paramname, dateFormatParamName,
- dividendPeriodStartDateParamName, dividendPeriodEndDateParamName, dividendAmountParamName));
-
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java
index 076861d..9dbb75e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java
@@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.shareproducts.serialization;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -29,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
+import org.apache.fineract.accounting.common.AccountingConstants;
import org.apache.fineract.accounting.common.AccountingRuleType;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -39,7 +41,6 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
-import org.apache.fineract.portfolio.accounts.constants.ShareAccountApiConstants;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
@@ -67,6 +68,31 @@ public class ShareProductDataSerializer {
private final ChargeRepositoryWrapper chargeRepository;
private final PlatformSecurityContext platformSecurityContext;
+ private static final Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(
+ ShareProductApiConstants.locale_paramname, ShareProductApiConstants.name_paramname,
+ ShareProductApiConstants.shortname_paramname, ShareProductApiConstants.shortname_paramname,
+ ShareProductApiConstants.description_paramname, ShareProductApiConstants.externalid_paramname,
+ ShareProductApiConstants.totalshares_paramname, ShareProductApiConstants.currency_paramname,
+ ShareProductApiConstants.digitsafterdecimal_paramname,
+ ShareProductApiConstants.digitsafterdecimal_paramname, ShareProductApiConstants.inmultiplesof_paramname,
+ ShareProductApiConstants.totalsharesissued_paramname, ShareProductApiConstants.unitprice_paramname,
+ ShareProductApiConstants.minimumshares_paramname, ShareProductApiConstants.nominaltshares_paramname,
+ ShareProductApiConstants.maximumshares_paramname, ShareProductApiConstants.marketprice_paramname,
+ ShareProductApiConstants.charges_paramname,
+ ShareProductApiConstants.allowdividendcalculationforinactiveclients_paramname,
+ ShareProductApiConstants.lockperiod_paramname, ShareProductApiConstants.lockinperiodfrequencytype_paramname,
+ ShareProductApiConstants.minimumactiveperiodfordividends_paramname,
+ ShareProductApiConstants.minimumactiveperiodfrequencytype_paramname,
+ ShareProductApiConstants.sharecapital_paramname, ShareProductApiConstants.accountingRuleParamName,
+ AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
+ AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
+ AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
+ AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue()));
+
+ private static final Set<String> supportedParametersForDivident = new HashSet<>(Arrays.asList(
+ ShareProductApiConstants.locale_paramname, ShareProductApiConstants.dateFormatParamName,
+ ShareProductApiConstants.dividendPeriodStartDateParamName,
+ ShareProductApiConstants.dividendPeriodEndDateParamName, ShareProductApiConstants.dividendAmountParamName));
@Autowired
public ShareProductDataSerializer(final FromJsonHelper fromApiJsonHelper, final ChargeRepositoryWrapper chargeRepository,
@@ -79,8 +105,8 @@ public class ShareProductDataSerializer {
public ShareProduct validateAndCreate(JsonCommand jsonCommand) {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareProductApiConstants.supportedParametersForCreate);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
+ supportedParametersForCreate);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesproduct");
@@ -248,8 +274,8 @@ public class ShareProductDataSerializer {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareProductApiConstants.supportedParametersForCreate);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
+ supportedParametersForCreate);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("sharesproduct");
@@ -447,8 +473,8 @@ public class ShareProductDataSerializer {
public void validateDividendDetails(JsonCommand jsonCommand) {
if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
- ShareProductApiConstants.supportedParametersForDivident);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(),
+ supportedParametersForDivident);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/api/TransferApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/api/TransferApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/api/TransferApiConstants.java
index 0a0376d..0135f00 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/api/TransferApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/api/TransferApiConstants.java
@@ -38,21 +38,4 @@ public class TransferApiConstants {
public static final String destinationOfficeIdParamName = "destinationOfficeId";
public static final String note = "note";
- public static final Set<String> TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, destinationGroupIdParamName, clients, inheritDestinationGroupLoanOfficer, newStaffIdParamName,
- transferActiveLoans));
-
- public static final Set<String> PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, note));
-
- public static final Set<String> ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(newStaffIdParamName,
- destinationGroupIdParamName, note));
-
- public static final Set<String> PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, newStaffIdParamName, destinationGroupIdParamName, note));
-
- public static final Set<String> REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note));
-
- public static final Set<String> WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note));
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java
index 885d737..273e87a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.transfer.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -42,6 +45,32 @@ import com.google.gson.reflect.TypeToken;
public final class TransfersDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
+ TransferApiConstants.destinationGroupIdParamName, TransferApiConstants.clients,
+ TransferApiConstants.inheritDestinationGroupLoanOfficer, TransferApiConstants.newStaffIdParamName,
+ TransferApiConstants.transferActiveLoans));
+
+ private static final Set<String> PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
+ TransferApiConstants.destinationOfficeIdParamName, TransferApiConstants.transferActiveLoans,
+ TransferApiConstants.note));
+
+ private static final Set<String> ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.newStaffIdParamName, TransferApiConstants.destinationGroupIdParamName,
+ TransferApiConstants.note));
+
+ private static final Set<String> PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.localeParamName, TransferApiConstants.dateFormatParamName,
+ TransferApiConstants.destinationOfficeIdParamName, TransferApiConstants.transferActiveLoans,
+ TransferApiConstants.newStaffIdParamName, TransferApiConstants.destinationGroupIdParamName,
+ TransferApiConstants.note));
+
+ private static final Set<String> REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.note));
+
+ private static final Set<String> WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(TransferApiConstants.note));
@Autowired
public TransfersDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -57,8 +86,8 @@ public final class TransfersDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- TransferApiConstants.TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -91,7 +120,7 @@ public final class TransfersDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -113,7 +142,7 @@ public final class TransfersDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -142,8 +171,7 @@ public final class TransfersDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- TransferApiConstants.PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -177,7 +205,7 @@ public final class TransfersDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.REJECT_CLIENT_TRANSFER_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REJECT_CLIENT_TRANSFER_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -194,7 +222,7 @@ public final class TransfersDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper
- .checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeOfMap, json, WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java
index 97c80fd..60efe17 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java
@@ -37,8 +37,7 @@ public class PasswordPreferencesApiConstants {
// request parameters
public static final String VALIDATION_POLICY_ID = "validationPolicyId";
- public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(VALIDATION_POLICY_ID));
-
- public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID_PARAM_NAME, ACTIVE, DESCRIPTION));
+ protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID_PARAM_NAME, ACTIVE,
+ DESCRIPTION));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java
index 0a893c3..38d7509 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java
@@ -20,8 +20,11 @@ package org.apache.fineract.useradministration.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -39,7 +42,9 @@ import com.google.gson.reflect.TypeToken;
@Component
public class PasswordPreferencesDataValidator {
- private final FromJsonHelper fromApiJsonHelper;
+ private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(PasswordPreferencesApiConstants.VALIDATION_POLICY_ID));
@Autowired
public PasswordPreferencesDataValidator(FromJsonHelper fromApiJsonHelper) {
@@ -50,7 +55,7 @@ public class PasswordPreferencesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PasswordPreferencesApiConstants.REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
[5/6] fineract git commit: Resolving merge conflicts
Posted by na...@apache.org.
Resolving merge conflicts
Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/d0fa56dd
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/d0fa56dd
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/d0fa56dd
Branch: refs/heads/develop
Commit: d0fa56dd00d174001d6aad0e4e61e221f83acd72
Parents: 5004815 cbfdfa0
Author: ThisuraThejith <tt...@gmail.com>
Authored: Tue Jun 13 06:20:34 2017 +0530
Committer: ThisuraThejith <tt...@gmail.com>
Committed: Tue Jun 13 06:20:34 2017 +0530
----------------------------------------------------------------------
docs/system-architecture/404.css | 154 ++++++++++++
docs/system-architecture/404.html | 146 +----------
.../WebContent/META-INF/MANIFEST.MF | 3 +
fineract-provider/build.gradle | 1 +
.../service/AccountingProcessorHelper.java | 57 +++--
.../internal/ApplyLoanCommandStrategy.java | 4 +-
.../internal/ApplySavingsCommandStrategy.java | 4 +-
.../internal/ApproveLoanCommandStrategy.java | 4 +-
.../internal/CollectChargesCommandStrategy.java | 4 +-
.../internal/CreateChargeCommandStrategy.java | 4 +-
.../internal/DisburseLoanCommandStrategy.java | 4 +-
.../serialization/BatchRequestJsonHelper.java | 2 +-
.../fineract/batch/service/BatchApiService.java | 4 +-
.../batch/service/ResolutionHelper.java | 4 +-
.../commands/annotation/CommandType.java | 4 +-
.../fineract/commands/domain/CommandSource.java | 23 ++
.../commands/domain/CommandWrapper.java | 27 ++-
.../provider/CommandHandlerProvider.java | 9 +-
.../commands/service/CommandWrapperBuilder.java | 38 ++-
...ioCommandSourceWritePlatformServiceImpl.java | 7 +-
.../core/api/ApiRequestParameterHelper.java | 2 +-
.../infrastructure/core/api/JsonCommand.java | 29 ++-
.../boot/AbstractApplicationConfiguration.java | 2 +-
.../core/boot/WarWebApplicationInitializer.java | 2 +-
.../core/data/DataValidatorBuilder.java | 23 +-
.../CommandProcessingResultJsonSerializer.java | 2 +-
...ettyPrintingOffJsonSerializerGoogleGson.java | 2 +-
...rettyPrintingOnJsonSerializerGoogleGson.java | 2 +-
.../core/serialization/FromJsonHelper.java | 2 +-
.../api/CreditBureauConfigurationAPI.java | 239 +++++++++++++++++++
.../data/CreditBureauConfigurationData.java | 68 ++++++
.../creditbureau/data/CreditBureauData.java | 77 ++++++
.../CreditBureauLoanProductMappingData.java | 112 +++++++++
.../data/CreditBureauMasterData.java | 52 ++++
.../creditbureau/data/CreditBureauProduct.java | 53 ++++
.../data/OrganisationCreditBureauData.java | 91 +++++++
.../creditbureau/domain/CreditBureau.java | 112 +++++++++
.../domain/CreditBureauConfiguration.java | 101 ++++++++
.../domain/CreditBureauLoanProductMapping.java | 150 ++++++++++++
...reditBureauLoanProductMappingRepository.java | 27 +++
.../domain/CreditBureauRepository.java | 30 +++
.../domain/OrganisationCreditBureau.java | 100 ++++++++
.../OrganisationCreditBureauRepository.java | 27 +++
...dOrganisationCreditBureauCommandHandler.java | 45 ++++
...tBureauLoanProductMappingCommandHandler.java | 46 ++++
.../UpdateCreditBureauCommandHandler.java | 48 ++++
...tBureauLoanProductMappingCommandHandler.java | 49 ++++
...ditBureauCommandFromApiJsonDeserializer.java | 90 +++++++
...anProductCommandFromApiJsonDeserializer.java | 137 +++++++++++
...auLoanProductMappingReadPlatformService.java | 33 +++
...anProductMappingReadPlatformServiceImpl.java | 122 ++++++++++
...uLoanProductMappingWritePlatformService.java | 30 +++
...nProductMappingWritePlatformServiceImpl.java | 96 ++++++++
.../CreditBureauMasterReadPlatformService.java | 31 +++
.../CreditBureauReadConfigurationService.java | 33 +++
...reditBureauReadConfigurationServiceImpl.java | 102 ++++++++
.../CreditBureauReadPlatformService.java | 29 +++
.../CreditBureauReadPlatformServiceImpl.java | 77 ++++++
...nisationCreditBureauReadPlatformService.java | 29 +++
...tionCreditBureauReadPlatformServiceImpl.java | 93 ++++++++
...sationCreditBureauWritePlatflormService.java | 29 +++
...onCreditBureauWritePlatflormServiceImpl.java | 94 ++++++++
.../ReadWriteNonCoreDataServiceImpl.java | 22 +-
.../ContentRepositoryUtils.java | 2 +-
.../domain/ReportMailingJob.java | 16 +-
...eportMailingJobWritePlatformServiceImpl.java | 6 +-
.../validation/ReportMailingJobValidator.java | 6 +-
.../InvalidTenantIdentiferException.java | 2 +-
.../sms/data/SmsMessageApiResponseData.java | 4 +-
.../sms/data/SmsMessageDeliveryReportData.java | 4 +-
.../organisation/teller/data/CashierData.java | 37 +--
.../organisation/teller/data/TellerData.java | 2 +-
.../teller/data/TellerJournalData.java | 2 +-
.../teller/data/TellerTransactionData.java | 2 +-
.../organisation/teller/domain/Cashier.java | 22 +-
.../teller/domain/CashierTransaction.java | 4 +-
.../calendar/domain/CalendarFrequencyType.java | 4 +-
.../client/domain/ClientTransaction.java | 4 +-
.../CollectionSheetConstants.java | 1 +
...CollectionSheetTransactionDataValidator.java | 3 +-
.../collectionsheet/data/SavingsDueData.java | 13 +-
.../CollectionSheetReadPlatformServiceImpl.java | 22 +-
.../common/domain/DaysInMonthType.java | 3 +-
.../portfolio/common/domain/DaysInYearType.java | 3 +-
.../service/CenterReadPlatformServiceImpl.java | 24 --
.../loanaccount/api/LoansApiResource.java | 11 +-
.../portfolio/loanaccount/domain/Loan.java | 7 +-
.../loanaccount/domain/LoanCharge.java | 8 +-
.../loanaccount/domain/LoanSummary.java | 2 +-
.../loanaccount/domain/LoanTransaction.java | 5 +
...ingBalanceInterestLoanScheduleGenerator.java | 2 +-
.../LoanRescheduleRequestDataValidator.java | 6 +-
.../domain/LoanRescheduleRequest.java | 4 +-
.../LoanRescheduleRequestNotFoundException.java | 2 +-
...scheduleRequestWritePlatformServiceImpl.java | 4 +-
.../service/LoanReadPlatformService.java | 2 +
.../service/LoanReadPlatformServiceImpl.java | 18 ++
...anWritePlatformServiceJpaRepositoryImpl.java | 4 +-
.../InterestRecalculationCompoundingMethod.java | 3 +-
.../InterestRecalculationPeriodMethod.java | 3 +-
.../domain/LoanRescheduleStrategyMethod.java | 4 +-
.../savings/DepositAccountOnClosureType.java | 2 +-
...avingsInterestCalculationDaysInYearType.java | 3 +-
.../savings/SavingsInterestCalculationType.java | 3 +-
.../data/SavingsAccountTransactionDTO.java | 13 +-
.../savings/data/SavingsProductData.java | 11 +
.../savings/domain/DepositAccountAssembler.java | 5 +-
.../domain/DepositAccountDomainService.java | 3 +
.../domain/DepositAccountDomainServiceJpa.java | 17 +-
.../savings/domain/RecurringDepositAccount.java | 2 +-
.../domain/SavingsAccountDomainServiceJpa.java | 6 +-
...ntWritePlatformServiceJpaRepositoryImpl.java | 28 ++-
...ntWritePlatformServiceJpaRepositoryImpl.java | 5 +-
.../ShareAccountCommandsServiceImpl.java | 2 +-
.../ShareProductCommandsServiceImpl.java | 2 +-
...erWritePlatformServiceJpaRepositoryImpl.java | 12 +-
.../resources/META-INF/spring/appContext.xml | 2 +-
.../V327__creditbureau_configuration.sql | 89 +++++++
.../provider/CommandHandlerProviderTest.java | 2 +-
119 files changed, 3155 insertions(+), 366 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/fineract/blob/d0fa56dd/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
----------------------------------------------------------------------
diff --cc fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
index 9b8ca2f,bb4e9b0..5ce58e4
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
@@@ -50,4 -50,20 +50,5 @@@ public class CollectionSheetConstants
public static final String loanIdParamName = "loanId";
public static final String savingsIdParamName = "savingsId";
public static final String transactionAmountParamName = "transactionAmount";
+ public static final String depositAccountTypeParamName = "depositAccountType";
-
- public static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
- bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName,
- bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
- PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
- PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
- PaymentDetailConstants.bankNumberParamName, isTransactionDateOnNonMeetingDateParamName));
-
- public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
- bulkDisbursementTransactionsParamName, noteParamName, bulkSavingsDueTransactionsParamName));
-
- public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(transactionDateParamName,
- localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/d0fa56dd/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
----------------------------------------------------------------------
diff --cc fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
index 826f4a3,56edceb..ec6192e
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
@@@ -35,7 -48,7 +35,8 @@@ import org.apache.fineract.infrastructu
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
+ import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
@@@ -135,15 -119,12 +136,15 @@@ public class CollectionSheetTransaction
final JsonElement element = this.fromApiJsonHelper.parse(json);
- final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element);
- baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
+ final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
+ .transactionDateParamName, element);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
- .notNull();
++ .notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
- final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
+ final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
if (StringUtils.isNotBlank(note)) {
- baseDataValidator.reset().parameter(noteParamName).value(note).notExceedingLengthOf(1000);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.noteParamName).value(note)
+ .notExceedingLengthOf(1000);
}
validateDisbursementTransactions(element, baseDataValidator);
http://git-wip-us.apache.org/repos/asf/fineract/blob/d0fa56dd/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java
----------------------------------------------------------------------
[6/6] fineract git commit: Merge branch 'FINERACT-470' into develop
Posted by na...@apache.org.
Merge branch 'FINERACT-470' into develop
Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/0cd1e396
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/0cd1e396
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/0cd1e396
Branch: refs/heads/develop
Commit: 0cd1e396559a9fc5277195d2369411594b01f8fa
Parents: 17ff4b5 d0fa56d
Author: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Authored: Fri Jun 16 20:10:54 2017 +0530
Committer: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Committed: Fri Jun 16 20:10:54 2017 +0530
----------------------------------------------------------------------
.../api/ProvisioningEntriesApiResource.java | 15 +-
.../ProvisioningEntriesApiConstants.java | 7 -
...ioningEntriesDefinitionJsonDeserializer.java | 6 +
.../holiday/api/HolidayApiConstants.java | 10 +-
.../holiday/data/HolidayDataValidator.java | 14 +-
.../api/ProvisioningCriteriaApiResource.java | 22 +-
.../ProvisioningCriteriaConstants.java | 75 ++-----
...oningCriteriaDefinitionJsonDeserializer.java | 21 +-
.../teller/domain/CashierTxnType.java | 8 +-
.../api/WorkingDaysApiConstants.java | 9 +-
.../workingdays/data/WorkingDayValidator.java | 11 +-
.../api/AccountTransfersApiConstants.java | 12 +-
.../api/StandingInstructionApiConstants.java | 18 +-
.../data/AccountTransfersDataValidator.java | 40 ++--
.../data/StandingInstructionDataValidator.java | 219 +++++++++++--------
.../constants/ShareAccountApiConstants.java | 7 -
.../client/api/ClientApiConstants.java | 56 +----
.../data/ClientApiCollectionConstants.java | 86 ++++++++
.../client/data/ClientChargeDataValidator.java | 6 +-
.../client/data/ClientDataValidator.java | 49 +++--
.../CollectionSheetConstants.java | 15 --
...CollectionSheetTransactionDataValidator.java | 140 +++++++-----
...tGenerateCommandFromApiJsonDeserializer.java | 8 +-
.../group/api/GroupingTypesApiConstants.java | 30 +--
.../serialization/GroupRolesDataValidator.java | 9 +-
.../GroupingTypesDataValidator.java | 42 +++-
.../InterestIncentiveApiConstants.java | 8 -
.../InterestRateChartApiConstants.java | 16 +-
.../InterestRateChartSlabApiConstants.java | 14 --
.../api/InterestRateChartSlabsApiResource.java | 21 +-
.../api/InterestRateChartsApiResource.java | 23 +-
.../data/InterestIncentiveDataValidator.java | 14 +-
.../data/InterestRateChartDataValidator.java | 15 +-
.../InterestRateChartSlabDataValidator.java | 17 +-
.../guarantor/api/GuarantorsApiResource.java | 10 +-
.../RescheduleLoansApiConstants.java | 11 -
.../LoanRescheduleRequestDataValidator.java | 30 ++-
.../LoanProductConfigurableAttributes.java | 9 +-
.../serialization/LoanProductDataValidator.java | 15 +-
.../portfolio/meeting/MeetingApiConstants.java | 6 -
.../meeting/api/MeetingsApiResource.java | 9 +-
.../meeting/data/MeetingDataValidator.java | 11 +-
.../paymentdetail/PaymentDetailConstants.java | 4 -
.../api/PaymentTypeApiResourceConstants.java | 9 +-
.../data/PaymentTypeDataValidator.java | 17 +-
.../portfolio/savings/DepositsApiConstants.java | 55 ++---
.../portfolio/savings/SavingsApiConstants.java | 145 ++----------
...ccountOnHoldFundTransactionsApiResource.java | 4 +-
...edDepositAccountTransactionsApiResource.java | 2 +-
...ngDepositAccountTransactionsApiResource.java | 2 +-
.../api/SavingsAccountChargesApiResource.java | 9 +-
.../SavingsAccountTransactionsApiResource.java | 4 +-
.../savings/api/SavingsAccountsApiResource.java | 8 +-
.../savings/api/SavingsApiSetConstants.java | 84 +++++++
.../savings/api/SavingsProductsApiResource.java | 10 +-
.../DepositAccountTransactionDataValidator.java | 39 +++-
.../data/SavingsAccountChargeDataValidator.java | 9 +-
.../savings/data/SavingsAccountConstant.java | 76 +++++++
.../data/SavingsAccountDataValidator.java | 7 +-
.../SavingsAccountTransactionDataValidator.java | 6 +-
.../data/SavingsProductDataValidator.java | 33 ++-
.../search/data/AdHocQueryDataValidator.java | 41 +++-
.../search/data/AdHocQuerySearchConstants.java | 23 +-
.../api/SelfBeneficiariesTPTApiConstants.java | 14 --
.../api/SelfBeneficiariesTPTApiResource.java | 15 +-
.../data/SelfBeneficiariesTPTDataValidator.java | 13 +-
.../ShareAccountDataSerializer.java | 37 +++-
.../constants/ShareProductApiConstants.java | 15 --
.../ShareProductDataSerializer.java | 40 +++-
.../transfer/api/TransferApiConstants.java | 17 --
.../transfer/data/TransfersDataValidator.java | 44 +++-
.../api/PasswordPreferencesApiConstants.java | 5 +-
.../data/PasswordPreferencesDataValidator.java | 9 +-
73 files changed, 1166 insertions(+), 794 deletions(-)
----------------------------------------------------------------------
[2/6] fineract git commit: Completed the sonar fixes in FINERATC-436
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
index 2d0893a..e982b92 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java
@@ -60,9 +60,12 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
@Column(name = "grace_on_arrears_ageing", nullable = true)
private Boolean graceOnArrearsAgeing;
- public static String[] supportedloanConfigurableAttributes = { "amortizationType", "interestType", "transactionProcessingStrategyId",
- "interestCalculationPeriodType", "inArrearsTolerance", "repaymentEvery", "graceOnPrincipalAndInterestPayment",
- "graceOnArrearsAgeing" };
+ private static final String[] supportedloanConfigurableAttributes = {LoanProductConstants.amortizationTypeParamName,
+ LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyIdParamName,
+ LoanProductConstants.interestCalculationPeriodTypeParamName,
+ LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
+ LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
+ LoanProductConstants.graceOnArrearsAgeingParameterName};
public static LoanProductConfigurableAttributes createFrom(JsonCommand command) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
index e0a3f2e..8eb132c 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
@@ -110,6 +110,13 @@ public final class LoanProductDataValidator {
LoanProductConstants.isCompoundingToBePostedAsTransactionParamName, LoanProductConstants.allowCompoundingOnEodParamName,
LoanProductConstants.canUseForTopup));
+ private static final String[] supportedloanConfigurableAttributes = {LoanProductConstants.amortizationTypeParamName,
+ LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyIdParamName,
+ LoanProductConstants.interestCalculationPeriodTypeParamName,
+ LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
+ LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
+ LoanProductConstants.graceOnArrearsAgeingParameterName};
+
private final FromJsonHelper fromApiJsonHelper;
@Autowired
@@ -686,18 +693,18 @@ public final class LoanProductDataValidator {
// Validate that parameter names are allowed
Set<String> supportedConfigurableAttributes = new HashSet<>();
- Collections.addAll(supportedConfigurableAttributes, LoanProductConfigurableAttributes.supportedloanConfigurableAttributes);
+ Collections.addAll(supportedConfigurableAttributes, supportedloanConfigurableAttributes);
this.fromApiJsonHelper.checkForUnsupportedNestedParameters(LoanProductConstants.allowAttributeOverridesParamName, object,
supportedConfigurableAttributes);
- Integer length = LoanProductConfigurableAttributes.supportedloanConfigurableAttributes.length;
+ Integer length = supportedloanConfigurableAttributes.length;
for (int i = 0; i < length; i++) {
/* Validate the attribute names */
if (this.fromApiJsonHelper
- .parameterExists(LoanProductConfigurableAttributes.supportedloanConfigurableAttributes[i], object)) {
+ .parameterExists(supportedloanConfigurableAttributes[i], object)) {
Boolean loanConfigurationAttributeValue = this.fromApiJsonHelper.extractBooleanNamed(
- LoanProductConfigurableAttributes.supportedloanConfigurableAttributes[i], object);
+ supportedloanConfigurableAttributes[i], object);
/* Validate the boolean value */
baseDataValidator.reset().parameter(LoanProductConstants.allowAttributeOverridesParamName)
.value(loanConfigurationAttributeValue).notNull().validateForBooleanValue();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
index 51e281c..5d2ad97 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/MeetingApiConstants.java
@@ -48,10 +48,4 @@ public class MeetingApiConstants {
public static final String calendarData = "calendarData";
public static final String attendanceTypeOptions = "attendanceTypeOptions";
- public static final Set<String> MEETING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(meetingDateParamName,
- localeParamName, dateFormatParamName, calendarIdParamName, clientsAttendanceParamName));
-
- public static final Set<String> MEETING_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, meetingDateParamName,
- clientsAttendance, clients, calendarData, attendanceTypeOptions));
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
index b3d551d..4614dba 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
@@ -19,9 +19,11 @@
package org.apache.fineract.portfolio.meeting.api;
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESPONSE_DATA_PARAMETERS;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -53,6 +55,7 @@ import org.apache.fineract.portfolio.calendar.exception.CalendarEntityTypeNotSup
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
+import org.apache.fineract.portfolio.meeting.MeetingApiConstants;
import org.apache.fineract.portfolio.meeting.attendance.data.ClientAttendanceData;
import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService;
import org.apache.fineract.portfolio.meeting.attendance.service.ClientAttendanceReadPlatformService;
@@ -78,6 +81,10 @@ public class MeetingsApiResource {
private final DefaultToApiJsonSerializer<MeetingData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ private static final Set<String> MEETING_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(MeetingApiConstants.idParamName, MeetingApiConstants.meetingDateParamName,
+ MeetingApiConstants.clientsAttendance, MeetingApiConstants.clients,
+ MeetingApiConstants.calendarData, MeetingApiConstants.attendanceTypeOptions));
@Autowired
public MeetingsApiResource(final PlatformSecurityContext context, final MeetingReadPlatformService readPlatformService,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
index abbd12e..63b04e9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.portfolio.meeting.data;
-import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.MEETING_RESOURCE_NAME;
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.attendanceTypeParamName;
import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.calendarIdParamName;
@@ -28,8 +27,11 @@ import static org.apache.fineract.portfolio.meeting.MeetingApiConstants.meetingD
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -38,6 +40,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.meeting.MeetingApiConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,7 +53,11 @@ import com.google.gson.reflect.TypeToken;
@Component
public class MeetingDataValidator {
- private final FromJsonHelper fromApiJsonHelper;
+ private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> MEETING_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(MeetingApiConstants.meetingDateParamName, MeetingApiConstants.localeParamName,
+ MeetingApiConstants.dateFormatParamName, MeetingApiConstants.calendarIdParamName,
+ MeetingApiConstants.clientsAttendanceParamName));
@Autowired
public MeetingDataValidator(final FromJsonHelper fromApiJsonHelper) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
index cf8e081..e284ebf 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/PaymentDetailConstants.java
@@ -37,8 +37,4 @@ public class PaymentDetailConstants {
// template related part of response
public static final String officeOptionsParamName = "paymentTypeOptions";
-
- public static final Set<String> PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(accountNumberParamName,
- checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
index a3e67ff..25a5261 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java
@@ -34,11 +34,6 @@ public class PaymentTypeApiResourceConstants {
public static final String ISCASHPAYMENT = "isCashPayment";
public static final String POSITION = "position";
- public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID, NAME, DESCRIPTION, ISCASHPAYMENT));
-
- public static final Set<String> CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(NAME, DESCRIPTION,
- ISCASHPAYMENT, POSITION));
-
- public static final Set<String> UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(NAME, DESCRIPTION,
- ISCASHPAYMENT, POSITION));
+ protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ID, NAME, DESCRIPTION,
+ ISCASHPAYMENT));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
index a476849..dd79f9d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.paymenttype.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -40,6 +43,13 @@ import com.google.gson.reflect.TypeToken;
public class PaymentTypeDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
+ PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION));
+
+ private static final Set<String> UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(PaymentTypeApiResourceConstants.NAME, PaymentTypeApiResourceConstants.DESCRIPTION,
+ PaymentTypeApiResourceConstants.ISCASHPAYMENT, PaymentTypeApiResourceConstants.POSITION));
@Autowired
public PaymentTypeDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -51,8 +61,7 @@ public class PaymentTypeDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- PaymentTypeApiResourceConstants.CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -96,8 +105,8 @@ public class PaymentTypeDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- PaymentTypeApiResourceConstants.UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
index 7bebd27..c886128 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java
@@ -39,28 +39,28 @@ public class DepositsApiConstants {
public static final String SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME = "savingsaccountcharge";
// deposit product actions
- public static String summitalAction = ".summital";
- public static String approvalAction = ".approval";
- public static String undoApprovalAction = ".undoApproval";
- public static String rejectAction = ".reject";
- public static String withdrawnByApplicantAction = ".withdrawnByApplicant";
- public static String activateAction = ".activate";
- public static String modifyApplicationAction = ".modify";
- public static String deleteApplicationAction = ".delete";
- public static String undoTransactionAction = ".undotransaction";
- public static String applyAnnualFeeTransactionAction = ".applyannualfee";
- public static String adjustTransactionAction = ".adjusttransaction";
- public static String closeAction = ".close";
- public static String preMatureCloseAction = ".preMatureClose";
- public static String payChargeTransactionAction = ".paycharge";
- public static String waiveChargeTransactionAction = ".waivecharge";
+ public static final String summitalAction = ".summital";
+ public static final String approvalAction = ".approval";
+ public static final String undoApprovalAction = ".undoApproval";
+ public static final String rejectAction = ".reject";
+ public static final String withdrawnByApplicantAction = ".withdrawnByApplicant";
+ public static final String activateAction = ".activate";
+ public static final String modifyApplicationAction = ".modify";
+ public static final String deleteApplicationAction = ".delete";
+ public static final String undoTransactionAction = ".undotransaction";
+ public static final String applyAnnualFeeTransactionAction = ".applyannualfee";
+ public static final String adjustTransactionAction = ".adjusttransaction";
+ public static final String closeAction = ".close";
+ public static final String preMatureCloseAction = ".preMatureClose";
+ public static final String payChargeTransactionAction = ".paycharge";
+ public static final String waiveChargeTransactionAction = ".waivecharge";
// command
- public static String COMMAND_UNDO_TRANSACTION = "undo";
- public static String COMMAND_ADJUST_TRANSACTION = "modify";
- public static String COMMAND_WAIVE_CHARGE = "waive";
- public static String COMMAND_PAY_CHARGE = "paycharge";
- public static String UPDATE_DEPOSIT_AMOUNT = "updateDepositAmount";
+ public static final String COMMAND_UNDO_TRANSACTION = "undo";
+ public static final String COMMAND_ADJUST_TRANSACTION = "modify";
+ public static final String COMMAND_WAIVE_CHARGE = "waive";
+ public static final String COMMAND_PAY_CHARGE = "paycharge";
+ public static final String UPDATE_DEPOSIT_AMOUNT = "updateDepositAmount";
// general
public static final String localeParamName = "locale";
@@ -345,13 +345,6 @@ public class DepositsApiConstants {
return recurringDepositResponseData;
}
- public static final Set<String> DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName,
- transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
-
- public static final Set<String> DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, mandatoryRecommendedDepositAmountParamName, effectiveDateParamName));
-
public static final Set<String> FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
"accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, runningBalanceParamName,
reversedParamName));
@@ -363,14 +356,6 @@ public class DepositsApiConstants {
public static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
dateFormatParamName, activatedOnDateParamName));
- public static final Set<String> DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, closedOnDateParamName, noteParamName, onAccountClosureIdParamName, paymentTypeIdParamName,
- transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName,
- transferDescriptionParamName, toSavingsAccountIdParamName));
-
- public static final Set<String> DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- localeParamName, dateFormatParamName, closedOnDateParamName));
-
public static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
index 6efa899..7416831 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
@@ -35,28 +35,28 @@ public class SavingsApiConstants {
// actions
public static final String postInterestValidationOnClosure = "postInterestValidationOnClosure";
- public static String summitalAction = ".summital";
- public static String approvalAction = ".approval";
- public static String undoApprovalAction = ".undoApproval";
- public static String rejectAction = ".reject";
- public static String withdrawnByApplicantAction = ".withdrawnByApplicant";
- public static String activateAction = ".activate";
- public static String modifyApplicationAction = ".modify";
- public static String deleteApplicationAction = ".delete";
- public static String undoTransactionAction = ".undotransaction";
- public static String applyAnnualFeeTransactionAction = ".applyannualfee";
- public static String adjustTransactionAction = ".adjusttransaction";
- public static String closeAction = ".close";
- public static String payChargeTransactionAction = ".paycharge";
- public static String waiveChargeTransactionAction = ".waivecharge";
- public static String updateMaturityDetailsAction = ".updateMaturityDetails";
+ public static final String summitalAction = ".summital";
+ public static final String approvalAction = ".approval";
+ public static final String undoApprovalAction = ".undoApproval";
+ public static final String rejectAction = ".reject";
+ public static final String withdrawnByApplicantAction = ".withdrawnByApplicant";
+ public static final String activateAction = ".activate";
+ public static final String modifyApplicationAction = ".modify";
+ public static final String deleteApplicationAction = ".delete";
+ public static final String undoTransactionAction = ".undotransaction";
+ public static final String applyAnnualFeeTransactionAction = ".applyannualfee";
+ public static final String adjustTransactionAction = ".adjusttransaction";
+ public static final String closeAction = ".close";
+ public static final String payChargeTransactionAction = ".paycharge";
+ public static final String waiveChargeTransactionAction = ".waivecharge";
+ public static final String updateMaturityDetailsAction = ".updateMaturityDetails";
// command
- public static String COMMAND_UNDO_TRANSACTION = "undo";
- public static String COMMAND_ADJUST_TRANSACTION = "modify";
- public static String COMMAND_WAIVE_CHARGE = "waive";
- public static String COMMAND_PAY_CHARGE = "paycharge";
- public static String COMMAND_INACTIVATE_CHARGE = "inactivate";
+ public static final String COMMAND_UNDO_TRANSACTION = "undo";
+ public static final String COMMAND_ADJUST_TRANSACTION = "modify";
+ public static final String COMMAND_WAIVE_CHARGE = "waive";
+ public static final String COMMAND_PAY_CHARGE = "paycharge";
+ public static final String COMMAND_INACTIVATE_CHARGE = "inactivate";
// general
public static final String localeParamName = "locale";
@@ -169,109 +169,4 @@ public class SavingsApiConstants {
public static final String daysToEscheatParamName = "daysToEscheat";
public static final String datatables = "datatables";
-
-
- public static final Set<String> SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- monthDayFormatParamName, nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName,
- digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
- interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
- interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
- lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
- withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, accountingRuleParamName, chargesParamName,
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
- SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(),
- isDormancyTrackingActiveParamName, daysToDormancyParamName, daysToInactiveParamName, daysToEscheatParamName,
- allowOverdraftParamName, overdraftLimitParamName,
- nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, minRequiredBalanceParamName,
- enforceMinRequiredBalanceParamName, minBalanceForInterestCalculationParamName, withHoldTaxParamName, taxGroupIdParamName));
-
- /**
- * These parameters will match the class level parameters of
- * {@link SavingsProductData}. Where possible, we try to get response
- * parameters to match those of request parameters.
- */
- public static final Set<String> SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
- shortNameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, inMultiplesOfParamName,
- nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
- interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
- lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
- withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, "currencyOptions",
- "interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions",
- "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions",
- nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, withHoldTaxParamName,
- taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName, daysToDormancyParamName,
- daysToInactiveParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName, externalIdParamName, clientIdParamName,
- groupIdParamName, productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName,
- interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
- interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
- lockinPeriodFrequencyParamName,
- lockinPeriodFrequencyTypeParamName,
- // withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
- withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, chargesParamName, allowOverdraftParamName,
- overdraftLimitParamName, minRequiredBalanceParamName, enforceMinRequiredBalanceParamName,
- nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, withHoldTaxParamName,datatables));
-
- /**
- * These parameters will match the class level parameters of
- * {@link SavingsAccountData}. Where possible, we try to get response
- * parameters to match those of request parameters.
- */
- public static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName,
- externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName, clientIdParamName, "clientName",
- groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency", nominalAnnualInterestRateParamName,
- interestCompoundingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
- minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
- withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName, feeAmountParamName,
- feeOnMonthDayParamName, "summary", "transactions", "productOptions", "interestCompoundingPeriodTypeOptions",
- "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions",
- "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "annualFee", onHoldFundsParamName,
- nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName, datatables));
-
- public static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName,
- transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
-
- public static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName,
- runningBalanceParamName, reversedParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
- accountNoParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, activatedOnDateParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, closedOnDateParamName, noteParamName, paymentTypeIdParamName, withdrawBalanceParamName,
- transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName,
- postInterestValidationOnClosure));
-
- public static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
- savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
- chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName,
- amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName,
- amountPaidParamName, chargeOptionsParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
- amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName, feeOnMonthDayParamName, monthDayFormatParamName,
- feeIntervalParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
-
- public static final Set<String> SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
- amountParamName, onHoldTransactionTypeParamName, onHoldTransactionDateParamName, onHoldReversedParamName));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
index 8f7ae4f..f84eb19 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
@@ -78,8 +78,8 @@ public class DepositAccountOnHoldFundTransactionsApiResource {
savingsId, guarantorFundingId, searchParameters);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer
- .serialize(settings, transfers, SavingsApiConstants.SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, transfers,
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
index 354ffae..fadf019 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
@@ -101,7 +101,7 @@ public class FixedDepositAccountTransactionsApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
- SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
}
@GET
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
index 13ba320..24353c7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
@@ -122,7 +122,7 @@ public class RecurringDepositAccountTransactionsApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
- SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
}
@GET
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
index ae767ac..78bd349 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.savings.api;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_INACTIVATE_CHARGE;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_PAY_CHARGE;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.COMMAND_WAIVE_CHARGE;
-import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME;
import java.util.Collection;
@@ -106,7 +105,7 @@ public class SavingsAccountChargesApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, savingsAccountCharges,
- SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -121,7 +120,8 @@ public class SavingsAccountChargesApiResource {
final SavingsAccountChargeData savingsAccountChargeTemplate = SavingsAccountChargeData.template(chargeOptions);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, savingsAccountChargeTemplate, SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingsAccountChargeTemplate,
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -137,7 +137,8 @@ public class SavingsAccountChargesApiResource {
.retrieveSavingsAccountChargeDetails(savingsAccountChargeId, savingsAccountId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, savingsAccountCharge, SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingsAccountCharge,
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS);
}
@POST
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
index db2bfd6..5204db2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
@@ -104,7 +104,7 @@ public class SavingsAccountTransactionsApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
- SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -124,7 +124,7 @@ public class SavingsAccountTransactionsApiResource {
}
return this.toApiJsonSerializer.serialize(settings, transactionData,
- SavingsApiConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
}
@POST
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
index dadcdca..8a3ecc1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
@@ -103,7 +103,8 @@ public class SavingsAccountsApiResource {
staffInSelectedOfficeOnly);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingsAccount,
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -122,7 +123,8 @@ public class SavingsAccountsApiResource {
final Page<SavingsAccountData> products = this.savingsAccountReadPlatformService.retrieveAll(searchParameters);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, products,
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
}
@POST
@@ -159,7 +161,7 @@ public class SavingsAccountsApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters(),
mandatoryResponseParameters);
return this.toApiJsonSerializer.serialize(settings, savingsAccountTemplate,
- SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
}
private SavingsAccountData populateTemplateAndAssociations(final Long accountId, final SavingsAccountData savingsAccount,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
new file mode 100644
index 0000000..70ac7b4
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsApiSetConstants.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.savings.api;
+
+import org.apache.fineract.portfolio.savings.SavingsApiConstants;
+import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
+import org.apache.fineract.portfolio.savings.data.SavingsProductData;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class SavingsApiSetConstants extends SavingsApiConstants {
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsProductData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+ protected static final Set<String> SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ idParamName, nameParamName, shortNameParamName, descriptionParamName, "currency",
+ digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
+ interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
+ interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
+ minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
+ withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
+ feeAmountParamName, feeOnMonthDayParamName, "currencyOptions", "interestCompoundingPeriodTypeOptions",
+ "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions",
+ "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions",
+ nominalAnnualInterestRateOverdraftParamName, minOverdraftForInterestCalculationParamName,
+ withHoldTaxParamName, taxGroupIdParamName, isDormancyTrackingActiveParamName, daysToInactiveParamName,
+ daysToDormancyParamName, daysToInactiveParamName));
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsAccountData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+
+ protected static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ accountNoParamName, externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName,
+ clientIdParamName, "clientName", groupIdParamName, "groupName", "savingsProductId", "savingsProductName",
+ "currency", nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName,
+ interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
+ minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
+ withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
+ feeAmountParamName, feeOnMonthDayParamName, "summary", "transactions", "productOptions",
+ "interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions",
+ "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions",
+ "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "annualFee",
+ onHoldFundsParamName, nominalAnnualInterestRateOverdraftParamName,
+ minOverdraftForInterestCalculationParamName, datatables));
+
+ protected static final Set<String> SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName,
+ paymentDetailDataParamName, runningBalanceParamName, reversedParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(chargeIdParamName, savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName,
+ chargeTimeTypeParamName, dueAsOfDateParamName, chargeCalculationTypeParamName, percentageParamName,
+ amountPercentageAppliedToParamName, currencyParamName, amountWaivedParamName,
+ amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName,
+ amountPaidParamName, chargeOptionsParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_ON_HOLD_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(idParamName, amountParamName, onHoldTransactionTypeParamName, onHoldTransactionDateParamName,
+ onHoldReversedParamName));
+}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
index 843013a..016aaae 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
@@ -153,7 +153,8 @@ public class SavingsProductsApiResource {
final Collection<SavingsProductData> products = this.savingProductReadPlatformService.retrieveAll();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, products,
+ SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -189,8 +190,8 @@ public class SavingsProductsApiResource {
savingProductData = handleTemplateRelatedData(savingProductData);
}
- return this.toApiJsonSerializer
- .serialize(settings, savingProductData, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingProductData,
+ SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -204,7 +205,8 @@ public class SavingsProductsApiResource {
final SavingsProductData savingProduct = handleTemplateRelatedData(null);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, savingProduct, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingProduct,
+ SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
private SavingsProductData handleTemplateRelatedData(final SavingsProductData savingsProduct) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
index 7353083..e20641a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java
@@ -63,6 +63,27 @@ public class DepositAccountTransactionDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName, transactionDateParamName,
+ transactionAmountParamName, paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName,
+ routingCodeParamName, receiptNumberParamName, bankNumberParamName));
+
+ private static final Set<String> DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName,
+ DepositsApiConstants.mandatoryRecommendedDepositAmountParamName,
+ DepositsApiConstants.effectiveDateParamName));
+
+ private static final Set<String> DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName, closedOnDateParamName,
+ DepositsApiConstants.noteParamName, onAccountClosureIdParamName, paymentTypeIdParamName,
+ transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName,
+ bankNumberParamName, DepositsApiConstants.transferDescriptionParamName, toSavingsAccountIdParamName));
+
+ private static final Set<String> DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(DepositsApiConstants.localeParamName, DepositsApiConstants.dateFormatParamName,
+ closedOnDateParamName));
+
+
@Autowired
public DepositAccountTransactionDataValidator(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
@@ -75,8 +96,8 @@ public class DepositAccountTransactionDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- DepositsApiConstants.DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
@@ -110,8 +131,8 @@ public class DepositAccountTransactionDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- DepositsApiConstants.DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ DEPOSIT_ACCOUNT_RECOMMENDED_DEPOSIT_AMOUNT_UPDATE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -137,7 +158,7 @@ public class DepositAccountTransactionDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
+ SavingsAccountConstant.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -156,8 +177,8 @@ public class DepositAccountTransactionDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- DepositsApiConstants.DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
@@ -177,8 +198,8 @@ public class DepositAccountTransactionDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- DepositsApiConstants.DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
index 3c3c6dc..69d5d62 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java
@@ -18,8 +18,6 @@
*/
package org.apache.fineract.portfolio.savings.data;
-import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.amountParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.chargeIdParamName;
@@ -62,7 +60,8 @@ public class SavingsAccountChargeDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -92,7 +91,7 @@ public class SavingsAccountChargeDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -128,7 +127,7 @@ public class SavingsAccountChargeDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsAccountConstant.SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
new file mode 100644
index 0000000..7325966
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountConstant.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.savings.data;
+
+import org.apache.fineract.portfolio.savings.SavingsApiConstants;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class SavingsAccountConstant extends SavingsApiConstants {
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsProductData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+ protected static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ localeParamName, dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName,
+ externalIdParamName, clientIdParamName, groupIdParamName, productIdParamName, fieldOfficerIdParamName,
+ submittedOnDateParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName,
+ interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
+ interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
+ lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
+ // withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
+ withdrawalFeeForTransfersParamName, feeAmountParamName, feeOnMonthDayParamName, chargesParamName,
+ allowOverdraftParamName, overdraftLimitParamName, minRequiredBalanceParamName,
+ enforceMinRequiredBalanceParamName, nominalAnnualInterestRateOverdraftParamName,
+ minOverdraftForInterestCalculationParamName, withHoldTaxParamName, datatables));
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsAccountData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+
+ protected static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, transactionDateParamName, transactionAmountParamName,
+ paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName,
+ routingCodeParamName, receiptNumberParamName, bankNumberParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(idParamName, accountNoParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, activatedOnDateParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ localeParamName, dateFormatParamName, closedOnDateParamName, noteParamName, paymentTypeIdParamName,
+ withdrawBalanceParamName, transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName,
+ receiptNumberParamName, bankNumberParamName, postInterestValidationOnClosure));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName,
+ localeParamName, feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName));
+
+ protected static final Set<String> SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
+
+}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
index 4cc6e89..a84cb29 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java
@@ -66,6 +66,7 @@ import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodTyp
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
import org.apache.fineract.portfolio.savings.SavingsPostingInterestPeriodType;
+import org.apache.fineract.portfolio.savings.api.SavingsApiSetConstants;
import org.joda.time.LocalDate;
import org.joda.time.MonthDay;
import org.springframework.beans.factory.annotation.Autowired;
@@ -91,7 +92,8 @@ public class SavingsAccountDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ SavingsAccountConstant.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -267,7 +269,8 @@ public class SavingsAccountDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ SavingsAccountConstant.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
index ca855b6..936ba9d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java
@@ -72,7 +72,7 @@ public class SavingsAccountTransactionDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- SavingsApiConstants.SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
+ SavingsAccountConstant.SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -98,7 +98,7 @@ public class SavingsAccountTransactionDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
+ SavingsAccountConstant.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -119,7 +119,7 @@ public class SavingsAccountTransactionDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- SavingsApiConstants.SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
+ SavingsAccountConstant.SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
index 94f0252..4422fd0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.portfolio.savings.data;
-import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.allowOverdraftParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
@@ -52,9 +51,12 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.daysToEs
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.accounting.common.AccountingRuleType;
@@ -64,6 +66,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
@@ -82,6 +85,34 @@ import com.google.gson.reflect.TypeToken;
public class SavingsProductDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(SavingsApiConstants.localeParamName, SavingsApiConstants.monthDayFormatParamName,
+ nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName,
+ digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
+ interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
+ interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
+ minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
+ lockinPeriodFrequencyTypeParamName, SavingsApiConstants.withdrawalFeeAmountParamName,
+ SavingsApiConstants.withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
+ feeAmountParamName, feeOnMonthDayParamName, SavingsApiConstants.accountingRuleParamName,
+ SavingsApiConstants.chargesParamName, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), isDormancyTrackingActiveParamName,
+ daysToDormancyParamName, daysToInactiveParamName, daysToEscheatParamName, allowOverdraftParamName,
+ overdraftLimitParamName, nominalAnnualInterestRateOverdraftParamName,
+ minOverdraftForInterestCalculationParamName, SavingsApiConstants.minRequiredBalanceParamName,
+ SavingsApiConstants.enforceMinRequiredBalanceParamName, minBalanceForInterestCalculationParamName,
+ withHoldTaxParamName, taxGroupIdParamName));
@Autowired
public SavingsProductDataValidator(final FromJsonHelper fromApiJsonHelper) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
index efa8ea8..29d8f10 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java
@@ -22,8 +22,10 @@ import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -42,6 +44,34 @@ import com.google.gson.reflect.TypeToken;
public class AdHocQueryDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(AdHocQuerySearchConstants.entitiesParamName, AdHocQuerySearchConstants.loanStatusParamName,
+ AdHocQuerySearchConstants.loanProductsParamName, AdHocQuerySearchConstants.officesParamName,
+ AdHocQuerySearchConstants.loanDateOptionParamName, AdHocQuerySearchConstants.loanFromDateParamName,
+ AdHocQuerySearchConstants.loanToDateParamName,
+ AdHocQuerySearchConstants.includeOutStandingAmountPercentageParamName,
+ AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName,
+ AdHocQuerySearchConstants.minOutStandingAmountPercentageParamName,
+ AdHocQuerySearchConstants.maxOutStandingAmountPercentageParamName,
+ AdHocQuerySearchConstants.outStandingAmountPercentageParamName,
+ AdHocQuerySearchConstants.includeOutstandingAmountParamName,
+ AdHocQuerySearchConstants.outstandingAmountConditionParamName,
+ AdHocQuerySearchConstants.minOutstandingAmountParamName,
+ AdHocQuerySearchConstants.maxOutstandingAmountParamName,
+ AdHocQuerySearchConstants.outstandingAmountParamName, AdHocQuerySearchConstants.localeParamName,
+ AdHocQuerySearchConstants.dateFormatParamName));
+
+ private static final Set<String> AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet<>(
+ Arrays.asList("between", "<=", ">=", "<", ">", "="));
+
+ private static final Object[] loanDateOptions = { AdHocQuerySearchConstants.approvalDateOption,
+ AdHocQuerySearchConstants.createDateOption,
+ AdHocQuerySearchConstants.disbursalDateOption };
+
+ private static final Object[] loanStatusOptions = {AdHocQuerySearchConstants.allLoanStatusOption,
+ AdHocQuerySearchConstants.activeLoanStatusOption, AdHocQuerySearchConstants.overpaidLoanStatusOption,
+ AdHocQuerySearchConstants.arrearsLoanStatusOption, AdHocQuerySearchConstants.closedLoanStatusOption,
+ AdHocQuerySearchConstants.writeoffLoanStatusOption};
@Autowired
public AdHocQueryDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -53,8 +83,7 @@ public class AdHocQueryDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
@@ -71,7 +100,7 @@ public class AdHocQueryDataValidator {
if (loanStatus != null && loanStatus.length > 0) {
for (String status : loanStatus) {
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.loanStatusParamName).value(status)
- .isOneOfTheseValues(AdHocQuerySearchConstants.loanStatusOptions);
+ .isOneOfTheseValues(loanStatusOptions);
}
}
}
@@ -91,7 +120,7 @@ public class AdHocQueryDataValidator {
final String loanDateOption = this.fromApiJsonHelper.extractStringNamed(AdHocQuerySearchConstants.loanDateOptionParamName,
element);
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.loanDateOptionParamName).value(loanDateOption)
- .isOneOfTheseValues(AdHocQuerySearchConstants.loanDateOptions);
+ .isOneOfTheseValues(loanDateOptions);
}
if (this.fromApiJsonHelper.parameterExists(AdHocQuerySearchConstants.loanFromDateParamName, element)) {
@@ -118,7 +147,7 @@ public class AdHocQueryDataValidator {
AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName, element);
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.outStandingAmountPercentageConditionParamName)
.value(outStandingAmountPercentageCondition)
- .isNotOneOfTheseValues(AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_CONDITIONS);
+ .isNotOneOfTheseValues(AD_HOC_SEARCH_QUERY_CONDITIONS);
if (outStandingAmountPercentageCondition.equals("between")) {
final BigDecimal minOutStandingAmountPercentage = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
AdHocQuerySearchConstants.minOutStandingAmountPercentageParamName, element);
@@ -151,7 +180,7 @@ public class AdHocQueryDataValidator {
final String outstandingAmountCondition = this.fromApiJsonHelper.extractStringNamed(
AdHocQuerySearchConstants.outstandingAmountConditionParamName, element);
baseDataValidator.reset().parameter(AdHocQuerySearchConstants.outstandingAmountConditionParamName)
- .value(outstandingAmountCondition).isNotOneOfTheseValues(AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_CONDITIONS);
+ .value(outstandingAmountCondition).isNotOneOfTheseValues(AD_HOC_SEARCH_QUERY_CONDITIONS);
if (outstandingAmountCondition.equals("between")) {
final BigDecimal minOutstandingAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
AdHocQuerySearchConstants.minOutstandingAmountParamName, element);
[3/6] fineract git commit: Completed the sonar fixes in FINERATC-436
Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
index 51f4e95..7af776e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
@@ -36,6 +36,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.core.service.DateUtils;
+import org.apache.fineract.portfolio.client.data.ClientApiCollectionConstants;
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,19 +60,19 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CREATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_CREATE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
if(clientNonPersonJson != null)
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS);
}
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final Long officeId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.officeIdParamName, element);
baseDataValidator.reset().parameter(ClientApiConstants.officeIdParamName).value(officeId).notNull().integerGreaterThanZero();
@@ -228,7 +229,7 @@ public final class ClientDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.incorpNumberParamName, element)) {
final String incorpNumber = this.fromApiJsonHelper.extractStringNamed(ClientApiConstants.incorpNumberParamName, element);
@@ -332,19 +333,19 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_UPDATE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
if(clientNonPersonJson != null)
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS);
}
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
boolean atLeastOneParameterPassedForUpdate = false;
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.accountNoParamName, element)) {
@@ -509,7 +510,7 @@ public final class ClientDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.incorpNumberParamName, element)) {
atLeastOneParameterPassedForUpdate = true;
@@ -555,11 +556,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -614,7 +615,7 @@ public final class ClientDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final String staffIdParameterName = ClientApiConstants.staffIdParamName;
final Long staffId = this.fromApiJsonHelper.extractLongNamed(staffIdParameterName, element);
@@ -631,11 +632,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CLOSE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_CLOSE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -663,7 +664,7 @@ public final class ClientDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final String savingsIdParameterName = ClientApiConstants.savingsAccountIdParamName;
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParameterName, element);
@@ -680,11 +681,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_REJECT_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_REJECT_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -706,11 +707,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_WITHDRAW_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_WITHDRAW_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -732,11 +733,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.REACTIVATION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.REACTIVATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -756,11 +757,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.UNDOREJECTION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.UNDOREJECTION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
@@ -779,11 +780,11 @@ public final class ClientDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ClientApiConstants.CLIENT_RESOURCE_NAME);
+ .resource(ClientApiCollectionConstants.CLIENT_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
index 7021849..9b8ca2f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
@@ -50,19 +50,4 @@ public class CollectionSheetConstants {
public static final String loanIdParamName = "loanId";
public static final String savingsIdParamName = "savingsId";
public static final String transactionAmountParamName = "transactionAmount";
-
- public static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
- bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName,
- bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
- PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
- PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
- PaymentDetailConstants.bankNumberParamName, isTransactionDateOnNonMeetingDateParamName));
-
- public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName,
- bulkDisbursementTransactionsParamName, noteParamName, bulkSavingsDueTransactionsParamName));
-
- public static final Set<String> INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(transactionDateParamName,
- localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
index 39200e7..826f4a3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
@@ -18,28 +18,15 @@
*/
package org.apache.fineract.portfolio.collectionsheet.data;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.COLLECTIONSHEET_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.attendanceTypeParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkDisbursementTransactionsParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkRepaymentTransactionsParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.bulkSavingsDueTransactionsParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.calendarIdParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.clientIdParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.clientsAttendanceParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.loanIdParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.noteParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.savingsIdParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.transactionAmountParamName;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.transactionDateParamName;
-
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -48,6 +35,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,6 +50,30 @@ import com.google.gson.reflect.TypeToken;
public class CollectionSheetTransactionDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList
+ (CollectionSheetConstants.localeParamName,
+ CollectionSheetConstants.dateFormatParamName, CollectionSheetConstants.transactionDateParamName,
+ CollectionSheetConstants.actualDisbursementDateParamName,
+ CollectionSheetConstants.bulkRepaymentTransactionsParamName,
+ CollectionSheetConstants.bulkDisbursementTransactionsParamName, CollectionSheetConstants.noteParamName,
+ CollectionSheetConstants.calendarIdParamName,
+ CollectionSheetConstants.clientsAttendanceParamName,
+ CollectionSheetConstants.bulkSavingsDueTransactionsParamName, PaymentDetailConstants.paymentTypeParamName,
+ PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
+ PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
+ PaymentDetailConstants.bankNumberParamName, CollectionSheetConstants.isTransactionDateOnNonMeetingDateParamName));
+
+ private static final Set<String> INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ CollectionSheetConstants.localeParamName, CollectionSheetConstants.dateFormatParamName,
+ CollectionSheetConstants.transactionDateParamName, CollectionSheetConstants.actualDisbursementDateParamName,
+ CollectionSheetConstants.bulkRepaymentTransactionsParamName,
+ CollectionSheetConstants.bulkDisbursementTransactionsParamName, CollectionSheetConstants.noteParamName,
+ CollectionSheetConstants.bulkSavingsDueTransactionsParamName));
+
+ private static final Set<String> PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(PaymentDetailConstants.accountNumberParamName, PaymentDetailConstants.checkNumberParamName,
+ PaymentDetailConstants.routingCodeParamName, PaymentDetailConstants.receiptNumberParamName,
+ PaymentDetailConstants.bankNumberParamName));
@Autowired
public CollectionSheetTransactionDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -77,20 +89,24 @@ public class CollectionSheetTransactionDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(COLLECTIONSHEET_RESOURCE_NAME);
+ .resource(CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME);
final JsonElement element = this.fromApiJsonHelper.parse(json);
- final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element);
- baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull();
+ final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
+ .transactionDateParamName, element);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
+ .notNull();
- final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
+ final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
if (StringUtils.isNotBlank(note)) {
- baseDataValidator.reset().parameter(noteParamName).value(note).notExceedingLengthOf(1000);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.noteParamName).value(note)
+ .notExceedingLengthOf(1000);
}
- final Long calendarId = this.fromApiJsonHelper.extractLongNamed(calendarIdParamName, element);
- baseDataValidator.reset().parameter(calendarIdParamName).value(calendarId).notNull();
+ final Long calendarId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants.calendarIdParamName,
+ element);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.calendarIdParamName).value(calendarId).notNull();
validateAttendanceDetails(element, baseDataValidator);
@@ -110,20 +126,24 @@ public class CollectionSheetTransactionDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(COLLECTIONSHEET_RESOURCE_NAME);
+ .resource(CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME);
final JsonElement element = this.fromApiJsonHelper.parse(json);
- final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element);
- baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull();
+ final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(CollectionSheetConstants
+ .transactionDateParamName, element);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.transactionDateParamName).value(transactionDate)
+ .notNull();
- final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
+ final String note = this.fromApiJsonHelper.extractStringNamed(CollectionSheetConstants.noteParamName, element);
if (StringUtils.isNotBlank(note)) {
- baseDataValidator.reset().parameter(noteParamName).value(note).notExceedingLengthOf(1000);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.noteParamName).value(note)
+ .notExceedingLengthOf(1000);
}
validateDisbursementTransactions(element, baseDataValidator);
@@ -138,15 +158,21 @@ public class CollectionSheetTransactionDataValidator {
private void validateAttendanceDetails(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
final JsonObject topLevelJsonElement = element.getAsJsonObject();
if (element.isJsonObject()) {
- if (topLevelJsonElement.has(clientsAttendanceParamName) && topLevelJsonElement.get(clientsAttendanceParamName).isJsonArray()) {
- final JsonArray array = topLevelJsonElement.get(clientsAttendanceParamName).getAsJsonArray();
+ if (topLevelJsonElement.has(CollectionSheetConstants.clientsAttendanceParamName) && topLevelJsonElement
+ .get(CollectionSheetConstants.clientsAttendanceParamName).isJsonArray()) {
+ final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants.clientsAttendanceParamName)
+ .getAsJsonArray();
for (int i = 0; i < array.size(); i++) {
final JsonObject attendanceElement = array.get(i).getAsJsonObject();
- final Long clientId = this.fromApiJsonHelper.extractLongNamed(clientIdParamName, attendanceElement);
- final Long attendanceType = this.fromApiJsonHelper.extractLongNamed(attendanceTypeParamName, attendanceElement);
- baseDataValidator.reset().parameter(clientsAttendanceParamName + "[" + i + "]." + clientIdParamName).value(clientId)
+ final Long clientId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
+ .clientIdParamName, attendanceElement);
+ final Long attendanceType = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
+ .attendanceTypeParamName, attendanceElement);
+ baseDataValidator.reset().parameter(CollectionSheetConstants.clientsAttendanceParamName + "[" + i
+ + "]." + CollectionSheetConstants.clientIdParamName).value(clientId)
.notNull().integerGreaterThanZero();
- baseDataValidator.reset().parameter(clientsAttendanceParamName + "[" + i + "]." + attendanceTypeParamName)
+ baseDataValidator.reset().parameter(CollectionSheetConstants.clientsAttendanceParamName + "[" + i
+ + "]." + CollectionSheetConstants.attendanceTypeParamName)
.value(attendanceType).notNull().integerGreaterThanZero();
}
}
@@ -157,14 +183,18 @@ public class CollectionSheetTransactionDataValidator {
final JsonObject topLevelJsonElement = element.getAsJsonObject();
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
if (element.isJsonObject()) {
- if (topLevelJsonElement.has(bulkDisbursementTransactionsParamName)
- && topLevelJsonElement.get(bulkDisbursementTransactionsParamName).isJsonArray()) {
- final JsonArray array = topLevelJsonElement.get(bulkDisbursementTransactionsParamName).getAsJsonArray();
+ if (topLevelJsonElement.has(CollectionSheetConstants.bulkDisbursementTransactionsParamName)
+ && topLevelJsonElement.get(CollectionSheetConstants.bulkDisbursementTransactionsParamName)
+ .isJsonArray()) {
+ final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
+ .bulkDisbursementTransactionsParamName).getAsJsonArray();
for (int i = 0; i < array.size(); i++) {
final JsonObject loanTransactionElement = array.get(i).getAsJsonObject();
- final Long loanId = this.fromApiJsonHelper.extractLongNamed(loanIdParamName, loanTransactionElement);
- final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
+ final Long loanId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
+ .loanIdParamName, loanTransactionElement);
+ final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed
+ (CollectionSheetConstants.transactionAmountParamName,
loanTransactionElement, locale);
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].loan.id").value(loanId).notNull()
@@ -180,14 +210,18 @@ public class CollectionSheetTransactionDataValidator {
final JsonObject topLevelJsonElement = element.getAsJsonObject();
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
if (element.isJsonObject()) {
- if (topLevelJsonElement.has(bulkRepaymentTransactionsParamName)
- && topLevelJsonElement.get(bulkRepaymentTransactionsParamName).isJsonArray()) {
- final JsonArray array = topLevelJsonElement.get(bulkRepaymentTransactionsParamName).getAsJsonArray();
+ if (topLevelJsonElement.has(CollectionSheetConstants.bulkRepaymentTransactionsParamName)
+ && topLevelJsonElement.get(CollectionSheetConstants.bulkRepaymentTransactionsParamName)
+ .isJsonArray()) {
+ final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
+ .bulkRepaymentTransactionsParamName).getAsJsonArray();
for (int i = 0; i < array.size(); i++) {
final JsonObject loanTransactionElement = array.get(i).getAsJsonObject();
- final Long loanId = this.fromApiJsonHelper.extractLongNamed(loanIdParamName, loanTransactionElement);
- final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
+ final Long loanId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
+ .loanIdParamName, loanTransactionElement);
+ final BigDecimal disbursementAmount = this.fromApiJsonHelper.extractBigDecimalNamed
+ (CollectionSheetConstants.transactionAmountParamName,
loanTransactionElement, locale);
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].loan.id").value(loanId).notNull()
@@ -205,14 +239,18 @@ public class CollectionSheetTransactionDataValidator {
final JsonObject topLevelJsonElement = element.getAsJsonObject();
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
if (element.isJsonObject()) {
- if (topLevelJsonElement.has(bulkSavingsDueTransactionsParamName)
- && topLevelJsonElement.get(bulkSavingsDueTransactionsParamName).isJsonArray()) {
- final JsonArray array = topLevelJsonElement.get(bulkSavingsDueTransactionsParamName).getAsJsonArray();
+ if (topLevelJsonElement.has(CollectionSheetConstants.bulkSavingsDueTransactionsParamName)
+ && topLevelJsonElement.get(CollectionSheetConstants.bulkSavingsDueTransactionsParamName)
+ .isJsonArray()) {
+ final JsonArray array = topLevelJsonElement.get(CollectionSheetConstants
+ .bulkSavingsDueTransactionsParamName).getAsJsonArray();
for (int i = 0; i < array.size(); i++) {
final JsonObject savingsTransactionElement = array.get(i).getAsJsonObject();
- final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParamName, savingsTransactionElement);
- final BigDecimal dueAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
+ final Long savingsId = this.fromApiJsonHelper.extractLongNamed(CollectionSheetConstants
+ .savingsIdParamName, savingsTransactionElement);
+ final BigDecimal dueAmount = this.fromApiJsonHelper.extractBigDecimalNamed
+ (CollectionSheetConstants.transactionAmountParamName,
savingsTransactionElement, locale);
baseDataValidator.reset().parameter("bulktransaction" + "[" + i + "].savings.id").value(savingsId).notNull()
@@ -231,7 +269,7 @@ public class CollectionSheetTransactionDataValidator {
locale);
baseDataValidator.reset().parameter(PaymentDetailConstants.paymentTypeParamName).value(paymentTypeId).ignoreIfNull()
.integerGreaterThanZero();
- for (final String paymentDetailParameterName : PaymentDetailConstants.PAYMENT_CREATE_REQUEST_DATA_PARAMETERS) {
+ for (final String paymentDetailParameterName : PAYMENT_CREATE_REQUEST_DATA_PARAMETERS) {
final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element);
baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull()
.notExceedingLengthOf(50);
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java
index 29b17fc..6f7f4d6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.portfolio.collectionsheet.serialization;
-import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS;
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.calendarIdParamName;
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.dateFormatParamName;
import static org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants.localeParamName;
@@ -53,8 +52,11 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer {
/**
* The parameters supported for this command.
*/
- final Set<String> supportedParameters = new HashSet<>(Arrays.asList(transactionDateParamName, localeParamName, dateFormatParamName,
- calendarIdParamName));
+ final Set<String> supportedParameters = new HashSet<>(
+ Arrays.asList(transactionDateParamName, localeParamName, dateFormatParamName, calendarIdParamName));
+
+ private static final Set<String> INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS = new HashSet<>(Arrays.asList(
+ transactionDateParamName, localeParamName, dateFormatParamName, officeIdParamName, staffIdParamName));
private final FromJsonHelper fromApiJsonHelper;
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupingTypesApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupingTypesApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupingTypesApiConstants.java
index bc3ebd0..0f6a19f 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupingTypesApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupingTypesApiConstants.java
@@ -89,45 +89,31 @@ public class GroupingTypesApiConstants {
public static final String datatables = "datatables";
- public static final Set<String> CENTER_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, idParamName, nameParamName, externalIdParamName, officeIdParamName, staffIdParamName, activeParamName,
- activationDateParamName, groupMembersParamName, submittedOnDateParamName, datatables));
-
- public static final Set<String> GROUP_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
- idParamName, nameParamName, externalIdParamName, centerIdParamName, officeIdParamName, staffIdParamName, activeParamName,
- activationDateParamName, clientMembersParamName, collectionMeetingCalendar, submittedOnDateParamName, datatables));
-
- public static final Set<String> GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(roleParamName,
- clientIdParamName));
-
/**
* These parameters will match the class level parameters of
* {@link CenterData}. Where possible, we try to get response parameters to
* match those of request parameters.
*/
- public static final Set<String> CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
+ protected static final Set<String> CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ nameParamName,
externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName,
officeOptionsParamName, staffOptionsParamName, statusParamName, activeParamName, activationDateParamName, timeLine,
groupMembersParamName, collectionMeetingCalendar, closureReasons, datatables));
- public static final Set<String> CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
+ protected static final Set<String> CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ nameParamName,
externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName,
officeOptionsParamName, staffOptionsParamName, clientOptionsParamName, datatables));
- public static final Set<String> GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
+ protected static final Set<String> GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ nameParamName,
externalIdParamName, officeIdParamName, officeNameParamName, "parentId", "parentName", staffIdParamName, staffNameParamName,
hierarchyParamName, officeOptionsParamName, statusParamName, activeParamName, activationDateParamName, staffOptionsParamName,
clientOptionsParamName, timeLine, datatables));
- public static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, activationDateParamName));
-
- public static final Set<String> COLLECTIONSHEET_DATA_PARAMETERS = new HashSet<>(
+ protected static final Set<String> COLLECTIONSHEET_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("dueDate", "loanProducts", "groups"));
- public static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, closureDateParamName, closureReasonIdParamName));
-
- public static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(staffIdParamName,
+ protected static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(staffIdParamName,
staffNameParamName, meetingFallCenters, totalCollected, totalOverdue, totaldue, installmentDue));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java
index 8478319..68cb0ab 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java
@@ -20,8 +20,11 @@ package org.apache.fineract.portfolio.group.serialization;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -41,6 +44,8 @@ import com.google.gson.reflect.TypeToken;
public class GroupRolesDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(GroupingTypesApiConstants.roleParamName, GroupingTypesApiConstants.clientIdParamName));
@Autowired
public GroupRolesDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -59,7 +64,7 @@ public class GroupRolesDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper
- .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -84,7 +89,7 @@ public class GroupRolesDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper
- .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java
index b30de36..a3184f2 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java
@@ -48,6 +48,32 @@ public final class GroupingTypesDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> CENTER_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
+ GroupingTypesApiConstants.idParamName, GroupingTypesApiConstants.nameParamName,
+ GroupingTypesApiConstants.externalIdParamName, GroupingTypesApiConstants.officeIdParamName,
+ GroupingTypesApiConstants.staffIdParamName, GroupingTypesApiConstants.activeParamName,
+ GroupingTypesApiConstants.activationDateParamName, GroupingTypesApiConstants.groupMembersParamName,
+ GroupingTypesApiConstants.submittedOnDateParamName, GroupingTypesApiConstants.datatables));
+
+ private static final Set<String> GROUP_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
+ GroupingTypesApiConstants.idParamName, GroupingTypesApiConstants.nameParamName,
+ GroupingTypesApiConstants.externalIdParamName, GroupingTypesApiConstants.centerIdParamName,
+ GroupingTypesApiConstants.officeIdParamName, GroupingTypesApiConstants.staffIdParamName,
+ GroupingTypesApiConstants.activeParamName, GroupingTypesApiConstants.activationDateParamName,
+ GroupingTypesApiConstants.clientMembersParamName, GroupingTypesApiConstants.collectionMeetingCalendar,
+ GroupingTypesApiConstants.submittedOnDateParamName, GroupingTypesApiConstants.datatables));
+
+
+ private static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
+ GroupingTypesApiConstants.activationDateParamName));
+
+ private static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ GroupingTypesApiConstants.localeParamName, GroupingTypesApiConstants.dateFormatParamName,
+ GroupingTypesApiConstants.closureDateParamName, GroupingTypesApiConstants.closureReasonIdParamName));
+
@Autowired
public GroupingTypesDataValidator(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
@@ -67,7 +93,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -132,7 +158,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -200,7 +226,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -265,7 +291,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -311,7 +337,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -357,7 +383,7 @@ public final class GroupingTypesDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACTIVATION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(resourceName);
@@ -466,7 +492,7 @@ public final class GroupingTypesDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper
- .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -492,7 +518,7 @@ public final class GroupingTypesDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper
- .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestIncentiveApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestIncentiveApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestIncentiveApiConstants.java
index c8894ac..7a24ae8 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestIncentiveApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestIncentiveApiConstants.java
@@ -35,14 +35,6 @@ public interface InterestIncentiveApiConstants {
public static final String INCENTIVE_RESOURCE_NAME = "interest.rate.incentives";
- public static final Set<String> INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
- entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
- amountParamName));
-
- public static final Set<String> INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
- entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
- amountParamName));
-
public static final Set<String> INTERESTRATE_INCENTIVE_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName,
amountParamName));
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartApiConstants.java
index 20f760b..458fecb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartApiConstants.java
@@ -27,10 +27,10 @@ public class InterestRateChartApiConstants {
public static final String INTERESTRATE_CHART_RESOURCE_NAME = "interestchart";
// actions
- public static String summitalAction = ".summital";
+ public static final String summitalAction = ".summital";
// command
- public static String COMMAND_UNDO_TRANSACTION = "undo";
+ public static final String COMMAND_UNDO_TRANSACTION = "undo";
// general
public static final String localeParamName = "locale";
@@ -62,16 +62,4 @@ public class InterestRateChartApiConstants {
// to delete chart Slabs from chart
public static final String deleteParamName = "delete";
-
- public static final Set<String> INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, productIdParamName, chartSlabs,
- isPrimaryGroupingByAmountParamName));
-
- public static final Set<String> INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
- deleteParamName, isPrimaryGroupingByAmountParamName));
-
- public static final Set<String> INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
- isPrimaryGroupingByAmountParamName));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartSlabApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartSlabApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartSlabApiConstants.java
index b25c185..2be8eb7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartSlabApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/InterestRateChartSlabApiConstants.java
@@ -45,18 +45,4 @@ public class InterestRateChartSlabApiConstants {
public static final String annualInterestRateParamName = "annualInterestRate";
public static final String currencyCodeParamName = "currencyCode";
public static final String incentivesParamName = "incentives";
-
- // associations
-
- public static final Set<String> INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName,
- amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
-
- public static final Set<String> INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName,
- amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
-
- public static final Set<String> INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
- amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
index e5b1b1c..d62878d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
@@ -19,9 +19,22 @@
package org.apache.fineract.portfolio.interestratechart.api;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS;
+
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeFromParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeToParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.annualInterestRateParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.currencyCodeParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.descriptionParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.fromPeriodParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.incentivesParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.periodTypeParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName;
+
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -43,6 +56,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +73,11 @@ public class InterestRateChartSlabsApiResource {
private final DefaultToApiJsonSerializer<InterestRateChartSlabData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
+ private static final Set<String> INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ InterestRateChartSlabApiConstants.localeParamName, InterestRateChartSlabApiConstants.idParamName,
+ descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
+ amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
+
@Autowired
public InterestRateChartSlabsApiResource(final InterestRateChartSlabReadPlatformService interestRateChartSlabReadPlatformService,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
index e0279c6..cf54a3a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
@@ -18,7 +18,9 @@
*/
package org.apache.fineract.portfolio.interestratechart.api;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
@@ -50,6 +52,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.chartSlabs;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.descriptionParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.endDateParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.fromDateParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.idParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.isPrimaryGroupingByAmountParamName;
+import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.nameParamName;
+
@Path("/interestratecharts")
@Component
@Scope("singleton")
@@ -60,6 +70,10 @@ public class InterestRateChartsApiResource {
private final DefaultToApiJsonSerializer<InterestRateChartData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
+ private static final Set<String> INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(InterestRateChartApiConstants.localeParamName,
+ InterestRateChartApiConstants.dateFormatParamName, idParamName, nameParamName, descriptionParamName,
+ fromDateParamName, endDateParamName, chartSlabs, isPrimaryGroupingByAmountParamName));
@Autowired
public InterestRateChartsApiResource(final InterestRateChartReadPlatformService chartReadPlatformService,
@@ -84,8 +98,7 @@ public class InterestRateChartsApiResource {
InterestRateChartData chartData = this.chartReadPlatformService.template();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, chartData,
- InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, chartData, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -98,8 +111,7 @@ public class InterestRateChartsApiResource {
Collection<InterestRateChartData> chartDatas = this.chartReadPlatformService.retrieveAllWithSlabs(productId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, chartDatas,
- InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, chartDatas, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
}
@GET
@@ -123,8 +135,7 @@ public class InterestRateChartsApiResource {
chartData = this.chartReadPlatformService.retrieveWithTemplate(chartData);
}
- return this.toApiJsonSerializer.serialize(settings, chartData,
- InterestRateChartApiConstants.INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, chartData, INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS);
}
@POST
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java
index 64f6b79..ab5c3ec 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java
@@ -19,8 +19,6 @@
package org.apache.fineract.portfolio.interestratechart.data;
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INCENTIVE_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.amountParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.attributeNameParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants.attributeValueParamName;
@@ -32,9 +30,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -43,6 +44,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.common.domain.ConditionType;
+import org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants;
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveAttributeName;
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveEntityType;
import org.apache.fineract.portfolio.interestratechart.incentive.InterestIncentiveType;
@@ -58,6 +60,14 @@ public class InterestIncentiveDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(InterestIncentiveApiConstants.idParamName, entityTypeParamName, attributeNameParamName,
+ conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName));
+
+ private static final Set<String> INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(InterestIncentiveApiConstants.idParamName, entityTypeParamName, attributeNameParamName,
+ conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName));
+
@Autowired
public InterestIncentiveDataValidator(final FromJsonHelper fromApiJsonHelper) {
this.fromApiJsonHelper = fromApiJsonHelper;
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java
index a325175..55bc4b3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java
@@ -18,9 +18,7 @@
*/
package org.apache.fineract.portfolio.interestratechart.data;
-import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.chartSlabs;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.descriptionParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.endDateParamName;
@@ -32,9 +30,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -42,6 +43,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -56,6 +58,15 @@ public class InterestRateChartDataValidator {
private final FromJsonHelper fromApiJsonHelper;
private final InterestRateChartSlabDataValidator chartSlabDataValidator;
+ private static final Set<String> INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ InterestRateChartApiConstants.localeParamName, InterestRateChartApiConstants.dateFormatParamName,
+ nameParamName, descriptionParamName, fromDateParamName, endDateParamName, productIdParamName, chartSlabs,
+ isPrimaryGroupingByAmountParamName));
+
+ private static final Set<String> INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ InterestRateChartApiConstants.localeParamName, InterestRateChartApiConstants.dateFormatParamName,
+ idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs,
+ InterestRateChartApiConstants.deleteParamName, isPrimaryGroupingByAmountParamName));
@Autowired
public InterestRateChartDataValidator(final FromJsonHelper fromApiJsonHelper,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java
index fa7f26a..7c7ac38 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java
@@ -18,9 +18,7 @@
*/
package org.apache.fineract.portfolio.interestratechart.data;
-import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeFromParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeToParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.annualInterestRateParamName;
@@ -34,9 +32,12 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -46,6 +47,7 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
import org.apache.fineract.portfolio.interestratechart.InterestIncentiveApiConstants;
+import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -59,6 +61,17 @@ public class InterestRateChartSlabDataValidator {
private final FromJsonHelper fromApiJsonHelper;
private final InterestIncentiveDataValidator interestIncentiveDataValidator;
+ private static final Set<String> INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(InterestRateChartSlabApiConstants.localeParamName,
+ InterestRateChartSlabApiConstants.idParamName, descriptionParamName, periodTypeParamName,
+ fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName,
+ annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
+
+ private static final Set<String> INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(InterestRateChartSlabApiConstants.localeParamName,
+ InterestRateChartSlabApiConstants.idParamName, descriptionParamName, periodTypeParamName,
+ fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName,
+ annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
@Autowired
public InterestRateChartSlabDataValidator(final FromJsonHelper fromApiJsonHelper,
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
index 96060a7..948036e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
@@ -48,6 +48,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.portfolio.account.AccountDetailConstants;
import org.apache.fineract.portfolio.account.PortfolioAccountType;
import org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants;
import org.apache.fineract.portfolio.account.data.PortfolioAccountDTO;
@@ -68,11 +69,16 @@ import org.springframework.stereotype.Component;
@Scope("singleton")
public class GuarantorsApiResource {
- private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "loanId", "clientRelationshipType",
+ private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "loanId",
+ "clientRelationshipType",
"guarantorType", "firstname", "lastname", "entityId", "externalId", "officeName", "joinedDate", "addressLine1", "addressLine2",
"city", "state", "zip", "country", "mobileNumber", "housePhoneNumber", "comment", "dob", "guarantorTypeOptions",
"allowedClientRelationshipTypes"));
+ private static final Set<String> ACCOUNT_TRANSFER_API_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(AccountDetailConstants.idParamName, AccountTransfersApiConstants.transferDescriptionParamName,
+ AccountTransfersApiConstants.currencyParamName));
+
private final String resourceNameForPermission = "GUARANTOR";
private final GuarantorReadPlatformService guarantorReadPlatformService;
@@ -210,6 +216,6 @@ public class GuarantorsApiResource {
}
final GuarantorData guarantorData = GuarantorData.template(null, null, accountLinkingOptions);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.apiJsonSerializerService.serialize(settings, guarantorData, AccountTransfersApiConstants.RESPONSE_DATA_PARAMETERS);
+ return this.apiJsonSerializerService.serialize(settings, guarantorData, ACCOUNT_TRANSFER_API_RESPONSE_DATA_PARAMETERS);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
index 626f84b..3fec406 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
@@ -47,21 +47,10 @@ public class RescheduleLoansApiConstants {
public static final String adjustedDueDateParamName = "adjustedDueDate";
public static final String resheduleForMultiDisbursementNotSupportedErrorCode = "loan.reschedule.multidisbursement.error.code";
public static final String resheduleWithInterestRecalculationNotSupportedErrorCode = "loan.reschedule.interestrecalculation.error.code";
-
- public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
- graceOnPrincipalParamName, recurringMoratoriumOnPrincipalPeriodsParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName,
- newInterestRateParamName, rescheduleReasonIdParamName, rescheduleReasonCommentParamName, submittedOnDateParamName,
- loanIdParamName, adjustedDueDateParamName, recalculateInterestParamName));
// reject action request parameters
public static final String rejectedOnDateParam = "rejectedOnDate";
- public static final Set<String> REJECT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
- rejectedOnDateParam));
-
// approve action request parameters
public static final String approvedOnDateParam = "approvedOnDate";
-
- public static final Set<String> APPROVE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
- approvedOnDateParam));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java
index 1203979..e694714 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java
@@ -20,9 +20,12 @@ package org.apache.fineract.portfolio.loanaccount.rescheduleloan.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -47,6 +50,26 @@ import com.google.gson.reflect.TypeToken;
public class LoanRescheduleRequestDataValidator {
private final FromJsonHelper fromJsonHelper;
+ private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
+ RescheduleLoansApiConstants.graceOnPrincipalParamName,
+ RescheduleLoansApiConstants.recurringMoratoriumOnPrincipalPeriodsParamName,
+ RescheduleLoansApiConstants.graceOnInterestParamName, RescheduleLoansApiConstants.extraTermsParamName,
+ RescheduleLoansApiConstants.rescheduleFromDateParamName,
+ RescheduleLoansApiConstants.newInterestRateParamName,
+ RescheduleLoansApiConstants.rescheduleReasonIdParamName,
+ RescheduleLoansApiConstants.rescheduleReasonCommentParamName,
+ RescheduleLoansApiConstants.submittedOnDateParamName, RescheduleLoansApiConstants.loanIdParamName,
+ RescheduleLoansApiConstants.adjustedDueDateParamName,
+ RescheduleLoansApiConstants.recalculateInterestParamName));
+
+ private static final Set<String> REJECT_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
+ RescheduleLoansApiConstants.rejectedOnDateParam));
+
+ private static final Set<String> APPROVE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(RescheduleLoansApiConstants.localeParamName, RescheduleLoansApiConstants.dateFormatParamName,
+ RescheduleLoansApiConstants.approvedOnDateParam));
@Autowired
public LoanRescheduleRequestDataValidator(FromJsonHelper fromJsonHelper) {
@@ -68,7 +91,7 @@ public class LoanRescheduleRequestDataValidator {
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
this.fromJsonHelper
- .checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.CREATE_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeToken, jsonString, CREATE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
@@ -199,8 +222,7 @@ public class LoanRescheduleRequestDataValidator {
if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); }
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString,
- RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS);
+ this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, APPROVE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
@@ -270,7 +292,7 @@ public class LoanRescheduleRequestDataValidator {
final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
this.fromJsonHelper
- .checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS);
+ .checkForUnsupportedParameters(typeToken, jsonString, REJECT_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils
[4/6] fineract git commit: Completed the sonar fixes in FINERATC-436
Posted by na...@apache.org.
Completed the sonar fixes in FINERATC-436
Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/50048151
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/50048151
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/50048151
Branch: refs/heads/develop
Commit: 50048151a82a966adf45b7f8297a3601e7f69f9f
Parents: 20db9d4
Author: ThisuraThejith <tt...@gmail.com>
Authored: Thu Jun 8 13:27:45 2017 +0530
Committer: ThisuraThejith <tt...@gmail.com>
Committed: Thu Jun 8 13:27:45 2017 +0530
----------------------------------------------------------------------
.../api/ProvisioningEntriesApiResource.java | 15 +-
.../ProvisioningEntriesApiConstants.java | 7 -
...ioningEntriesDefinitionJsonDeserializer.java | 6 +
.../holiday/api/HolidayApiConstants.java | 10 +-
.../holiday/data/HolidayDataValidator.java | 14 +-
.../api/ProvisioningCriteriaApiResource.java | 22 +-
.../ProvisioningCriteriaConstants.java | 75 ++-----
...oningCriteriaDefinitionJsonDeserializer.java | 21 +-
.../teller/domain/CashierTxnType.java | 8 +-
.../api/WorkingDaysApiConstants.java | 9 +-
.../workingdays/data/WorkingDayValidator.java | 11 +-
.../api/AccountTransfersApiConstants.java | 12 +-
.../api/StandingInstructionApiConstants.java | 18 +-
.../data/AccountTransfersDataValidator.java | 40 ++--
.../data/StandingInstructionDataValidator.java | 219 +++++++++++--------
.../constants/ShareAccountApiConstants.java | 7 -
.../client/api/ClientApiConstants.java | 56 +----
.../data/ClientApiCollectionConstants.java | 86 ++++++++
.../client/data/ClientChargeDataValidator.java | 6 +-
.../client/data/ClientDataValidator.java | 49 +++--
.../CollectionSheetConstants.java | 15 --
...CollectionSheetTransactionDataValidator.java | 140 +++++++-----
...tGenerateCommandFromApiJsonDeserializer.java | 8 +-
.../group/api/GroupingTypesApiConstants.java | 30 +--
.../serialization/GroupRolesDataValidator.java | 9 +-
.../GroupingTypesDataValidator.java | 42 +++-
.../InterestIncentiveApiConstants.java | 8 -
.../InterestRateChartApiConstants.java | 16 +-
.../InterestRateChartSlabApiConstants.java | 14 --
.../api/InterestRateChartSlabsApiResource.java | 21 +-
.../api/InterestRateChartsApiResource.java | 23 +-
.../data/InterestIncentiveDataValidator.java | 14 +-
.../data/InterestRateChartDataValidator.java | 15 +-
.../InterestRateChartSlabDataValidator.java | 17 +-
.../guarantor/api/GuarantorsApiResource.java | 10 +-
.../RescheduleLoansApiConstants.java | 11 -
.../LoanRescheduleRequestDataValidator.java | 30 ++-
.../LoanProductConfigurableAttributes.java | 9 +-
.../serialization/LoanProductDataValidator.java | 15 +-
.../portfolio/meeting/MeetingApiConstants.java | 6 -
.../meeting/api/MeetingsApiResource.java | 9 +-
.../meeting/data/MeetingDataValidator.java | 11 +-
.../paymentdetail/PaymentDetailConstants.java | 4 -
.../api/PaymentTypeApiResourceConstants.java | 9 +-
.../data/PaymentTypeDataValidator.java | 17 +-
.../portfolio/savings/DepositsApiConstants.java | 55 ++---
.../portfolio/savings/SavingsApiConstants.java | 145 ++----------
...ccountOnHoldFundTransactionsApiResource.java | 4 +-
...edDepositAccountTransactionsApiResource.java | 2 +-
...ngDepositAccountTransactionsApiResource.java | 2 +-
.../api/SavingsAccountChargesApiResource.java | 9 +-
.../SavingsAccountTransactionsApiResource.java | 4 +-
.../savings/api/SavingsAccountsApiResource.java | 8 +-
.../savings/api/SavingsApiSetConstants.java | 84 +++++++
.../savings/api/SavingsProductsApiResource.java | 10 +-
.../DepositAccountTransactionDataValidator.java | 39 +++-
.../data/SavingsAccountChargeDataValidator.java | 9 +-
.../savings/data/SavingsAccountConstant.java | 76 +++++++
.../data/SavingsAccountDataValidator.java | 7 +-
.../SavingsAccountTransactionDataValidator.java | 6 +-
.../data/SavingsProductDataValidator.java | 33 ++-
.../search/data/AdHocQueryDataValidator.java | 41 +++-
.../search/data/AdHocQuerySearchConstants.java | 23 +-
.../api/SelfBeneficiariesTPTApiConstants.java | 14 --
.../api/SelfBeneficiariesTPTApiResource.java | 15 +-
.../data/SelfBeneficiariesTPTDataValidator.java | 13 +-
.../ShareAccountDataSerializer.java | 37 +++-
.../constants/ShareProductApiConstants.java | 15 --
.../ShareProductDataSerializer.java | 40 +++-
.../transfer/api/TransferApiConstants.java | 17 --
.../transfer/data/TransfersDataValidator.java | 44 +++-
.../api/PasswordPreferencesApiConstants.java | 5 +-
.../data/PasswordPreferencesDataValidator.java | 9 +-
73 files changed, 1166 insertions(+), 794 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
index 1a7b4a5..d5369c2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
@@ -48,6 +48,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
@Path("/provisioningentries")
@Component
@Scope("singleton")
@@ -59,7 +63,10 @@ public class ProvisioningEntriesApiResource {
private final DefaultToApiJsonSerializer<Object> entriesApiJsonSerializer;
private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
-
+ private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(
+ ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
+ private static final Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList
+ (ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM));
@Autowired
public ProvisioningEntriesApiResource(final PlatformSecurityContext platformSecurityContext,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
@@ -115,7 +122,7 @@ public class ProvisioningEntriesApiResource {
platformSecurityContext.authenticatedUser();
ProvisioningEntryData data = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryData(entryId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, data, ProvisioningEntriesApiConstants.PROVISIONING_ENTRY_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, data, PROVISIONING_ENTRY_PARAMETERS);
}
@GET
@@ -129,7 +136,7 @@ public class ProvisioningEntriesApiResource {
SearchParameters params = SearchParameters.forProvisioningEntries(entryId, officeId, productId, categoryId, offset, limit);
Page<LoanProductProvisioningEntryData> entries = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntries(params);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.entriesApiJsonSerializer.serialize(settings, entries, ProvisioningEntriesApiConstants.PROVISIONING_ENTRY_PARAMETERS);
+ return this.entriesApiJsonSerializer.serialize(settings, entries, PROVISIONING_ENTRY_PARAMETERS);
}
@GET
@@ -140,6 +147,6 @@ public class ProvisioningEntriesApiResource {
platformSecurityContext.authenticatedUser();
Page<ProvisioningEntryData> data = this.provisioningEntriesReadPlatformService.retrieveAllProvisioningEntries(offset, limit);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.entriesApiJsonSerializer.serialize(settings, data, ProvisioningEntriesApiConstants.ALL_PROVISIONING_ENTRIES);
+ return this.entriesApiJsonSerializer.serialize(settings, data, ALL_PROVISIONING_ENTRIES);
}
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/constant/ProvisioningEntriesApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/constant/ProvisioningEntriesApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/constant/ProvisioningEntriesApiConstants.java
index 69cfec4..5149c84 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/constant/ProvisioningEntriesApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/constant/ProvisioningEntriesApiConstants.java
@@ -35,12 +35,5 @@ public interface ProvisioningEntriesApiConstants {
public final static String PROVISIONINGENTRY_PARAM = "provisioningentry";
public final static String ENTRIES_PARAM = "entries";
-
- Set<String> supportedParameters = new HashSet<>(
- Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
-
- Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(PROVISIONINGENTRY_PARAM, ENTRIES_PARAM));
-
- Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList(PROVISIONINGENTRY_PARAM));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java
index 4e61c78..43067fb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java
@@ -20,9 +20,12 @@ package org.apache.fineract.accounting.provisioning.serialization;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants;
@@ -43,6 +46,9 @@ import com.google.gson.reflect.TypeToken;
public class ProvisioningEntriesDefinitionJsonDeserializer implements ProvisioningEntriesApiConstants {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> supportedParameters = new HashSet<>(
+ Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
+
@Autowired
public ProvisioningEntriesDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidayApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidayApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidayApiConstants.java
index 5bf2ba7..27fa538 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidayApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidayApiConstants.java
@@ -42,11 +42,7 @@ public class HolidayApiConstants {
public static final String processed = "processed";
public static final String status = "status";
- public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName,
- repaymentsRescheduledToParamName));
-
- public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName,
- fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName,
- dateFormatParamName, status));
+ protected static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(idParamName, nameParamName, fromDateParamName, descriptionParamName, toDateParamName,
+ repaymentsRescheduledToParamName, localeParamName, dateFormatParamName, status));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java
index 264af0e..e99eafb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java
@@ -20,6 +20,7 @@ package org.apache.fineract.organisation.holiday.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -45,6 +46,11 @@ import com.google.gson.reflect.TypeToken;
public class HolidayDataValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(HolidayApiConstants.localeParamName, HolidayApiConstants.dateFormatParamName,
+ HolidayApiConstants.nameParamName, HolidayApiConstants.fromDateParamName,
+ HolidayApiConstants.toDateParamName, HolidayApiConstants.descriptionParamName,
+ HolidayApiConstants.officesParamName, HolidayApiConstants.repaymentsRescheduledToParamName));
@Autowired
public HolidayDataValidator(final FromJsonHelper fromApiJsonHelper) {
@@ -56,8 +62,8 @@ public class HolidayDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -104,8 +110,8 @@ public class HolidayDataValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
index d627d99..46efdb0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
@@ -18,7 +18,10 @@
*/
package org.apache.fineract.organisation.provisioning.api;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -57,6 +60,19 @@ public class ProvisioningCriteriaApiResource {
private final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final DefaultToApiJsonSerializer<ProvisioningCriteriaData> toApiJsonSerializer;
+
+ private static final Set<String> PROVISIONING_CRITERIA_TEMPLATE_PARAMETER = new HashSet<>(
+ Arrays.asList(ProvisioningCriteriaConstants.DEFINITIONS_PARAM,
+ ProvisioningCriteriaConstants.LOANPRODUCTS_PARAM, ProvisioningCriteriaConstants.GLACCOUNTS_PARAM));
+
+ private static final Set<String> PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(
+ Arrays.asList(ProvisioningCriteriaConstants.CRITERIA_PARAM,
+ ProvisioningCriteriaConstants.LOANPRODUCTS_PARAM, ProvisioningCriteriaConstants.DEFINITIONS_PARAM));
+
+ private static final Set<String> ALL_PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(
+ Arrays.asList(ProvisioningCriteriaConstants.CRITERIA_ID_PARAM,
+ ProvisioningCriteriaConstants.CRITERIA_NAME_PARAM, ProvisioningCriteriaConstants.CREATED_BY_PARAM));
+
@Autowired
public ProvisioningCriteriaApiResource(final PlatformSecurityContext platformSecurityContext,
final ApiRequestParameterHelper apiRequestParameterHelper,
@@ -78,7 +94,7 @@ public class ProvisioningCriteriaApiResource {
this.platformSecurityContext.authenticatedUser();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
ProvisioningCriteriaData data = this.provisioningCriteriaReadPlatformService.retrievePrivisiongCriteriaTemplate();
- return this.toApiJsonSerializer.serialize(settings, data, ProvisioningCriteriaConstants.PROVISIONING_CRITERIA_TEMPLATE_PARAMETER);
+ return this.toApiJsonSerializer.serialize(settings, data, PROVISIONING_CRITERIA_TEMPLATE_PARAMETER);
}
@GET
@@ -92,7 +108,7 @@ public class ProvisioningCriteriaApiResource {
if(settings.isTemplate()) {
criteria = this.provisioningCriteriaReadPlatformService.retrievePrivisiongCriteriaTemplate(criteria);
}
- return this.toApiJsonSerializer.serialize(settings, criteria, ProvisioningCriteriaConstants.PROVISIONING_CRITERIA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, criteria, PROVISIONING_CRITERIA_PARAMETERS);
}
@GET
@@ -102,7 +118,7 @@ public class ProvisioningCriteriaApiResource {
platformSecurityContext.authenticatedUser() ;
Collection<ProvisioningCriteriaData> data = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, data, ProvisioningCriteriaConstants.ALL_PROVISIONING_CRITERIA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, data, ALL_PROVISIONING_CRITERIA_PARAMETERS);
}
@POST
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/constants/ProvisioningCriteriaConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/constants/ProvisioningCriteriaConstants.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/constants/ProvisioningCriteriaConstants.java
index 87b6d7d..b0c7898 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/constants/ProvisioningCriteriaConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/constants/ProvisioningCriteriaConstants.java
@@ -23,57 +23,26 @@ import java.util.HashSet;
import java.util.Set;
public interface ProvisioningCriteriaConstants {
-
- public final static String JSON_LOCALE_PARAM = "locale" ;
-
- public final static String JSON_CRITERIAID_PARAM = "criteriaId" ;
-
- public final static String JSON_CRITERIANAME_PARAM = "criteriaName";
-
- public final static String JSON_LOANPRODUCTS_PARAM = "loanProducts";
-
- public final static String JSON_LOAN_PRODUCT_ID_PARAM = "id" ;
-
- public final static String JSON_LOAN_PRODUCTNAME_PARAM = "name" ;
-
- public final static String JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM = "includeInBorrowerCycle" ;
-
- public final static String JSON_PROVISIONING_DEFINITIONS_PARAM = "definitions";
-
- public final static String JSON_CATEOGRYID_PARAM = "categoryId";
-
- public final static String JSON_CATEOGRYNAME_PARAM = "categoryName";
-
- public final static String JSON_MINIMUM_AGE_PARAM = "minAge";
-
- public final static String JSON_MAXIMUM_AGE_PARAM = "maxAge";
-
- public final static String JSON_PROVISIONING_PERCENTAGE_PARAM = "provisioningPercentage";
-
- public final static String JSON_LIABILITY_ACCOUNT_PARAM = "liabilityAccount";
-
- public final static String JSON_EXPENSE_ACCOUNT_PARAM = "expenseAccount";
-
- Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM,
- JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
-
- Set<String> supportedParametersForUpdate = new HashSet<>(Arrays.asList(JSON_CRITERIAID_PARAM, JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM,
- JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
-
- Set<String> loanProductSupportedParams = new HashSet<>(Arrays.asList(JSON_LOAN_PRODUCT_ID_PARAM,
- JSON_LOAN_PRODUCTNAME_PARAM, JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM)) ;
-
- Set<String> provisioningcriteriaSupportedParams = new HashSet<>(Arrays.asList(JSON_CATEOGRYID_PARAM,
- JSON_CATEOGRYNAME_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_MAXIMUM_AGE_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_PROVISIONING_PERCENTAGE_PARAM, JSON_EXPENSE_ACCOUNT_PARAM, JSON_LIABILITY_ACCOUNT_PARAM)) ;
-
-
- Set<String> PROVISIONING_CRITERIA_TEMPLATE_PARAMETER = new HashSet<>(Arrays.asList("definitions", "loanProducts",
- "glAccounts"));
-
- Set<String> PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(Arrays.asList("criteriaName", "loanProducts",
- "definitions"));
-
- Set<String> ALL_PROVISIONING_CRITERIA_PARAMETERS = new HashSet<>(Arrays.asList("criteriaId", "criterianame",
- "createdby"));
-
+ public final static String JSON_LOCALE_PARAM = "locale";
+ public final static String JSON_CRITERIAID_PARAM = "criteriaId";
+ public final static String JSON_CRITERIANAME_PARAM = "criteriaName";
+ public final static String JSON_LOANPRODUCTS_PARAM = "loanProducts";
+ public final static String JSON_LOAN_PRODUCT_ID_PARAM = "id";
+ public final static String JSON_LOAN_PRODUCTNAME_PARAM = "name";
+ public final static String JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM = "includeInBorrowerCycle";
+ public final static String JSON_PROVISIONING_DEFINITIONS_PARAM = "definitions";
+ public final static String JSON_CATEOGRYID_PARAM = "categoryId";
+ public final static String JSON_CATEOGRYNAME_PARAM = "categoryName";
+ public final static String JSON_MINIMUM_AGE_PARAM = "minAge";
+ public final static String JSON_MAXIMUM_AGE_PARAM = "maxAge";
+ public final static String JSON_PROVISIONING_PERCENTAGE_PARAM = "provisioningPercentage";
+ public final static String JSON_LIABILITY_ACCOUNT_PARAM = "liabilityAccount";
+ public final static String JSON_EXPENSE_ACCOUNT_PARAM = "expenseAccount";
+ public final static String DEFINITIONS_PARAM = "definitions";
+ public final static String LOANPRODUCTS_PARAM = "loanProducts";
+ public final static String GLACCOUNTS_PARAM = "glAccounts";
+ public final static String CRITERIA_PARAM = "criteriaName";
+ public final static String CRITERIA_ID_PARAM = "criteriaId";
+ public final static String CRITERIA_NAME_PARAM = "criterianame";
+ public final static String CREATED_BY_PARAM = "createdby";
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java
index 4e7b051..6c0ca78 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java
@@ -21,9 +21,12 @@ package org.apache.fineract.organisation.provisioning.serialization;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -41,9 +44,23 @@ import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
@Component
-public class ProvisioningCriteriaDefinitionJsonDeserializer implements ProvisioningCriteriaConstants{
+public class ProvisioningCriteriaDefinitionJsonDeserializer implements ProvisioningCriteriaConstants {
- private final FromJsonHelper fromApiJsonHelper;
+ private final FromJsonHelper fromApiJsonHelper;
+
+ private final static Set<String> supportedParametersForCreate = new HashSet<>(Arrays.asList(JSON_LOCALE_PARAM,
+ JSON_CRITERIANAME_PARAM, JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
+
+ private final static Set<String> supportedParametersForUpdate = new HashSet<>(Arrays.asList(JSON_CRITERIAID_PARAM,
+ JSON_LOCALE_PARAM, JSON_CRITERIANAME_PARAM, JSON_LOANPRODUCTS_PARAM, JSON_PROVISIONING_DEFINITIONS_PARAM));
+
+ private final static Set<String> loanProductSupportedParams = new HashSet<>(Arrays
+ .asList(JSON_LOAN_PRODUCT_ID_PARAM, JSON_LOAN_PRODUCTNAME_PARAM, JSON_LOAN_PRODUCT_BORROWERCYCLE_PARAM));
+
+ private final static Set<String> provisioningcriteriaSupportedParams = new HashSet<>(
+ Arrays.asList(JSON_CATEOGRYID_PARAM, JSON_CATEOGRYNAME_PARAM, JSON_MINIMUM_AGE_PARAM,
+ JSON_MAXIMUM_AGE_PARAM, JSON_MINIMUM_AGE_PARAM, JSON_PROVISIONING_PERCENTAGE_PARAM,
+ JSON_EXPENSE_ACCOUNT_PARAM, JSON_LIABILITY_ACCOUNT_PARAM));
@Autowired
public ProvisioningCriteriaDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java
index 8b1ddb7..1141deb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java
@@ -25,10 +25,10 @@ public class CashierTxnType {
private Integer id;
private String value;
- public static CashierTxnType ALLOCATE = new CashierTxnType (101, "Allocate Cash");
- public static CashierTxnType SETTLE = new CashierTxnType (102, "Settle Cash");
- public static CashierTxnType INWARD_CASH_TXN = new CashierTxnType (103, "Cash In");
- public static CashierTxnType OUTWARD_CASH_TXN = new CashierTxnType (104, "Cash Out");
+ public static final CashierTxnType ALLOCATE = new CashierTxnType (101, "Allocate Cash");
+ public static final CashierTxnType SETTLE = new CashierTxnType (102, "Settle Cash");
+ public static final CashierTxnType INWARD_CASH_TXN = new CashierTxnType (103, "Cash In");
+ public static final CashierTxnType OUTWARD_CASH_TXN = new CashierTxnType (104, "Cash Out");
private CashierTxnType () {
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
index fda39bb..5cfef90 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
@@ -38,13 +38,10 @@ public class WorkingDaysApiConstants {
public static final String extendTermForDailyRepayments = "extendTermForDailyRepayments";
public static final String extendTermForRepaymentsOnHolidays = "extendTermForRepaymentsOnHolidays";
-
- public static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS =new HashSet<>(Arrays.asList(
- recurrence,repayment_rescheduling_enum,localeParamName,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
- ));
- public static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ protected static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
recurrence,repayment_rescheduling_enum,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
));
- public static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList(rescheduleRepaymentTemplate));
+ protected static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList
+ (rescheduleRepaymentTemplate));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
index 466ca0f..77bd3f7 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
@@ -20,8 +20,11 @@ package org.apache.fineract.organisation.workingdays.data;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -40,6 +43,10 @@ import com.google.gson.reflect.TypeToken;
public class WorkingDayValidator {
private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(WorkingDaysApiConstants.recurrence, WorkingDaysApiConstants.repayment_rescheduling_enum,
+ WorkingDaysApiConstants.localeParamName, WorkingDaysApiConstants.extendTermForDailyRepayments,
+ WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays));
@Autowired
public WorkingDayValidator(FromJsonHelper fromApiJsonHelper) {
@@ -50,8 +57,8 @@ public class WorkingDayValidator {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- WorkingDaysApiConstants.WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
final JsonElement element = this.fromApiJsonHelper.parse(json);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiConstants.java
index 08cc368..84eeba6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiConstants.java
@@ -33,19 +33,13 @@ public class AccountTransfersApiConstants {
public static final String transferDateParamName = "transferDate";
public static final String transferAmountParamName = "transferAmount";
public static final String transferDescriptionParamName = "transferDescription";
-
- public static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.localeParamName,
- AccountDetailConstants.dateFormatParamName, AccountDetailConstants.fromOfficeIdParamName,
- AccountDetailConstants.fromClientIdParamName, AccountDetailConstants.fromAccountTypeParamName,
- AccountDetailConstants.fromAccountIdParamName, AccountDetailConstants.toOfficeIdParamName,
- AccountDetailConstants.toClientIdParamName, AccountDetailConstants.toAccountTypeParamName,
- AccountDetailConstants.toAccountIdParamName, transferDateParamName, transferAmountParamName, transferDescriptionParamName));
+ public static final String currencyParamName = "currency";
/**
* These parameters will match the class level parameters of
* {@link AccountTransferData}. Where possible, we try to get response
* parameters to match those of request parameters.
*/
- public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName,
- transferDescriptionParamName, "currency"));
+ protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(AccountDetailConstants.idParamName, transferDescriptionParamName, currencyParamName));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiConstants.java
index fae6cbd..f29b7f9 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiConstants.java
@@ -41,22 +41,8 @@ public class StandingInstructionApiConstants {
public static final String recurrenceOnMonthDayParamName = "recurrenceOnMonthDay";
public static final String monthDayFormatParamName = "monthDayFormat";
- public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
- AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
- AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
- AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
- AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
- AccountDetailConstants.transferTypeParamName, priorityParamName, instructionTypeParamName, statusParamName, amountParamName,
- validFromParamName, validTillParamName, recurrenceTypeParamName, recurrenceFrequencyParamName, recurrenceIntervalParamName,
- recurrenceOnMonthDayParamName, nameParamName, monthDayFormatParamName));
-
- public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
- AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName, priorityParamName,
- instructionTypeParamName, statusParamName, amountParamName, validFromParamName, validTillParamName, recurrenceTypeParamName,
- recurrenceFrequencyParamName, recurrenceIntervalParamName, recurrenceOnMonthDayParamName, monthDayFormatParamName));
-
- public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName,
+ protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants
+ .idParamName,
nameParamName, priorityParamName, instructionTypeParamName, statusParamName, AccountDetailConstants.transferTypeParamName,
validFromParamName, validTillParamName));
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java
index 0b79597..f7002d1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java
@@ -18,17 +18,14 @@
*/
package org.apache.fineract.portfolio.account.data;
-import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferAmountParamName;
-import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferDateParamName;
-import static org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants.transferDescriptionParamName;
-
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -37,6 +34,8 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.account.AccountDetailConstants;
+import org.apache.fineract.portfolio.account.api.AccountTransfersApiConstants;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -49,6 +48,15 @@ public class AccountTransfersDataValidator {
private final FromJsonHelper fromApiJsonHelper;
private final AccountTransfersDetailDataValidator accountTransfersDetailDataValidator;
+ private static final Set<String> REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
+ AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
+ AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
+ AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
+ AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
+ AccountTransfersApiConstants.transferDateParamName, AccountTransfersApiConstants.transferAmountParamName,
+ AccountTransfersApiConstants.transferDescriptionParamName));
+
@Autowired
public AccountTransfersDataValidator(final FromJsonHelper fromApiJsonHelper,
@@ -68,20 +76,26 @@ public class AccountTransfersDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(ACCOUNT_TRANSFER_RESOURCE_NAME);
+ .resource(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
this.accountTransfersDetailDataValidator.validate(command, baseDataValidator);
- final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transferDateParamName, element);
- baseDataValidator.reset().parameter(transferDateParamName).value(transactionDate).notNull();
+ final LocalDate transactionDate = this.fromApiJsonHelper
+ .extractLocalDateNamed(AccountTransfersApiConstants.transferDateParamName, element);
+ baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferDateParamName).value
+ (transactionDate).notNull();
- final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(transferAmountParamName, element);
- baseDataValidator.reset().parameter(transferAmountParamName).value(transactionAmount).notNull().positiveAmount();
+ final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed
+ (AccountTransfersApiConstants.transferAmountParamName, element);
+ baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferAmountParamName).value
+ (transactionAmount).notNull().positiveAmount();
- final String transactionDescription = this.fromApiJsonHelper.extractStringNamed(transferDescriptionParamName, element);
- baseDataValidator.reset().parameter(transferDescriptionParamName).value(transactionDescription).notBlank()
+ final String transactionDescription = this.fromApiJsonHelper.extractStringNamed(AccountTransfersApiConstants
+ .transferDescriptionParamName, element);
+ baseDataValidator.reset().parameter(AccountTransfersApiConstants.transferDescriptionParamName).value
+ (transactionDescription).notBlank()
.notExceedingLengthOf(200);
throwExceptionIfValidationWarningsExist(dataValidationErrors);
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java
index 92e6042..ccdba4c 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java
@@ -21,27 +21,16 @@ package org.apache.fineract.portfolio.account.data;
import static org.apache.fineract.portfolio.account.AccountDetailConstants.fromAccountTypeParamName;
import static org.apache.fineract.portfolio.account.AccountDetailConstants.toAccountTypeParamName;
import static org.apache.fineract.portfolio.account.AccountDetailConstants.transferTypeParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.CREATE_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.UPDATE_REQUEST_DATA_PARAMETERS;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.amountParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.instructionTypeParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.nameParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.priorityParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceFrequencyParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceIntervalParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceOnMonthDayParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.recurrenceTypeParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.statusParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.validFromParamName;
-import static org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants.validTillParamName;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -50,7 +39,9 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.portfolio.account.AccountDetailConstants;
import org.apache.fineract.portfolio.account.PortfolioAccountType;
+import org.apache.fineract.portfolio.account.api.StandingInstructionApiConstants;
import org.apache.fineract.portfolio.account.domain.AccountTransferRecurrenceType;
import org.apache.fineract.portfolio.account.domain.AccountTransferType;
import org.apache.fineract.portfolio.account.domain.StandingInstructionType;
@@ -64,10 +55,36 @@ import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
@Component
-public class StandingInstructionDataValidator {
+ public class StandingInstructionDataValidator {
private final FromJsonHelper fromApiJsonHelper;
private final AccountTransfersDetailDataValidator accountTransfersDetailDataValidator;
+ private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
+ AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName,
+ AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName,
+ AccountDetailConstants.toOfficeIdParamName, AccountDetailConstants.toClientIdParamName,
+ AccountDetailConstants.toAccountTypeParamName, AccountDetailConstants.toAccountIdParamName,
+ AccountDetailConstants.transferTypeParamName, StandingInstructionApiConstants.priorityParamName,
+ StandingInstructionApiConstants.instructionTypeParamName, StandingInstructionApiConstants.statusParamName,
+ StandingInstructionApiConstants.amountParamName, StandingInstructionApiConstants.validFromParamName,
+ StandingInstructionApiConstants.validTillParamName, StandingInstructionApiConstants.recurrenceTypeParamName,
+ StandingInstructionApiConstants.recurrenceFrequencyParamName,
+ StandingInstructionApiConstants.recurrenceIntervalParamName,
+ StandingInstructionApiConstants.recurrenceOnMonthDayParamName,
+ StandingInstructionApiConstants.nameParamName, StandingInstructionApiConstants.monthDayFormatParamName));
+
+ private static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
+ AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName,
+ StandingInstructionApiConstants.priorityParamName, StandingInstructionApiConstants.instructionTypeParamName,
+ StandingInstructionApiConstants.statusParamName, StandingInstructionApiConstants.amountParamName,
+ StandingInstructionApiConstants.validFromParamName, StandingInstructionApiConstants.validTillParamName,
+ StandingInstructionApiConstants.recurrenceTypeParamName,
+ StandingInstructionApiConstants.recurrenceFrequencyParamName,
+ StandingInstructionApiConstants.recurrenceIntervalParamName,
+ StandingInstructionApiConstants.recurrenceOnMonthDayParamName,
+ StandingInstructionApiConstants.monthDayFormatParamName));
+
@Autowired
public StandingInstructionDataValidator(final FromJsonHelper fromApiJsonHelper,
@@ -86,71 +103,82 @@ public class StandingInstructionDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(STANDING_INSTRUCTION_RESOURCE_NAME);
+ .resource(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME);
this.accountTransfersDetailDataValidator.validate(command, baseDataValidator);
final JsonElement element = command.parsedJson();
- final Integer status = this.fromApiJsonHelper.extractIntegerNamed(statusParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(statusParamName).value(status).notNull().inMinMaxRange(1, 2);
+ final Integer status = this.fromApiJsonHelper
+ .extractIntegerNamed(StandingInstructionApiConstants.statusParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.statusParamName).value(status).notNull()
+ .inMinMaxRange(1, 2);
- final LocalDate validFrom = this.fromApiJsonHelper.extractLocalDateNamed(validFromParamName, element);
- baseDataValidator.reset().parameter(validFromParamName).value(validFrom).notNull();
+ final LocalDate validFrom = this.fromApiJsonHelper
+ .extractLocalDateNamed(StandingInstructionApiConstants.validFromParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.validFromParamName).value(validFrom)
+ .notNull();
- final LocalDate validTill = this.fromApiJsonHelper.extractLocalDateNamed(validTillParamName, element);
- baseDataValidator.reset().parameter(validTillParamName).value(validTill).validateDateAfter(validFrom);
+ final LocalDate validTill = this.fromApiJsonHelper
+ .extractLocalDateNamed(StandingInstructionApiConstants.validTillParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.validTillParamName).value(validTill)
+ .validateDateAfter(validFrom);
- final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(amountParamName, element);
- baseDataValidator.reset().parameter(amountParamName).value(transferAmount).positiveAmount();
+ final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(StandingInstructionApiConstants.amountParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount).positiveAmount();
final Integer transferType = this.fromApiJsonHelper.extractIntegerNamed(transferTypeParamName, element, Locale.getDefault());
baseDataValidator.reset().parameter(transferTypeParamName).value(transferType).notNull().inMinMaxRange(1, 3);
- final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(priorityParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
+ final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.priorityParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
- final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(instructionTypeParamName, element,
+ final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.instructionTypeParamName, element,
Locale.getDefault());
- baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
- final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(recurrenceTypeParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
+ final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(StandingInstructionApiConstants.recurrenceTypeParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
boolean isPeriodic = false;
if (recurrenceType != null) {
isPeriodic = AccountTransferRecurrenceType.fromInt(recurrenceType).isPeriodicRecurrence();
}
- final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(recurrenceFrequencyParamName, element,
+ final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.recurrenceFrequencyParamName, element,
Locale.getDefault());
- baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).inMinMaxRange(0, 3);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName)
+ .value(recurrenceFrequency).inMinMaxRange(0, 3);
if (recurrenceFrequency != null) {
PeriodFrequencyType frequencyType = PeriodFrequencyType.fromInt(recurrenceFrequency);
if (frequencyType.isMonthly() || frequencyType.isYearly()) {
- final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed(recurrenceOnMonthDayParamName, element);
- baseDataValidator.reset().parameter(recurrenceOnMonthDayParamName).value(monthDay).notNull();
+ final MonthDay monthDay = this.fromApiJsonHelper
+ .extractMonthDayNamed(StandingInstructionApiConstants.recurrenceOnMonthDayParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceOnMonthDayParamName)
+ .value(monthDay).notNull();
}
}
- final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(recurrenceIntervalParamName, element,
+ final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.recurrenceIntervalParamName, element,
Locale.getDefault());
if (isPeriodic) {
- baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).notNull();
- baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).notNull();
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval).notNull();
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName).value(recurrenceFrequency).notNull();
}
- baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
- final String name = this.fromApiJsonHelper.extractStringNamed(nameParamName, element);
- baseDataValidator.reset().parameter(nameParamName).value(name).notNull();
+ final String name = this.fromApiJsonHelper.extractStringNamed(StandingInstructionApiConstants.nameParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.nameParamName).value(name).notNull();
final Integer toAccountType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(toAccountTypeParamName, element);
if (toAccountType != null && PortfolioAccountType.fromInt(toAccountType).isSavingsAccount()) {
- baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 1);
- baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 1);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 1);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 1);
}
if (standingInstructionType != null && StandingInstructionType.fromInt(standingInstructionType).isFixedAmoutTransfer()) {
- baseDataValidator.reset().parameter(amountParamName).value(transferAmount).notNull();
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount).notNull();
}
String errorCode = null;
@@ -184,62 +212,79 @@ public class StandingInstructionDataValidator {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(STANDING_INSTRUCTION_RESOURCE_NAME);
+ .resource(StandingInstructionApiConstants.STANDING_INSTRUCTION_RESOURCE_NAME);
final JsonElement element = command.parsedJson();
- if (this.fromApiJsonHelper.parameterExists(validFromParamName, element)) {
- final LocalDate validFrom = this.fromApiJsonHelper.extractLocalDateNamed(validFromParamName, element);
- baseDataValidator.reset().parameter(validFromParamName).value(validFrom).notNull();
- }
-
- if (this.fromApiJsonHelper.parameterExists(validTillParamName, element)) {
- final LocalDate validTill = this.fromApiJsonHelper.extractLocalDateNamed(validTillParamName, element);
- baseDataValidator.reset().parameter(validTillParamName).value(validTill).notNull();
- }
-
- if (this.fromApiJsonHelper.parameterExists(amountParamName, element)) {
- final BigDecimal transferAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(amountParamName, element);
- baseDataValidator.reset().parameter(amountParamName).value(transferAmount).positiveAmount();
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.validFromParamName, element)) {
+ final LocalDate validFrom = this.fromApiJsonHelper
+ .extractLocalDateNamed(StandingInstructionApiConstants.validFromParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.validFromParamName).value(validFrom)
+ .notNull();
}
- if (this.fromApiJsonHelper.parameterExists(statusParamName, element)) {
- final Integer status = this.fromApiJsonHelper.extractIntegerNamed(statusParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(statusParamName).value(status).notNull().inMinMaxRange(1, 2);
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.validTillParamName, element)) {
+ final LocalDate validTill = this.fromApiJsonHelper
+ .extractLocalDateNamed(StandingInstructionApiConstants.validTillParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.validTillParamName).value(validTill)
+ .notNull();
}
- if (this.fromApiJsonHelper.parameterExists(priorityParamName, element)) {
- final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(priorityParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(priorityParamName).value(priority).notNull().inMinMaxRange(1, 4);
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.amountParamName, element)) {
+ final BigDecimal transferAmount = this.fromApiJsonHelper
+ .extractBigDecimalWithLocaleNamed(StandingInstructionApiConstants.amountParamName, element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.amountParamName).value(transferAmount)
+ .positiveAmount();
}
- if (this.fromApiJsonHelper.parameterExists(instructionTypeParamName, element)) {
- final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(instructionTypeParamName, element,
- Locale.getDefault());
- baseDataValidator.reset().parameter(instructionTypeParamName).value(standingInstructionType).notNull().inMinMaxRange(1, 2);
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.statusParamName, element)) {
+ final Integer status = this.fromApiJsonHelper
+ .extractIntegerNamed(StandingInstructionApiConstants.statusParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.statusParamName).value(status).notNull()
+ .inMinMaxRange(1, 2);
}
- if (this.fromApiJsonHelper.parameterExists(recurrenceTypeParamName, element)) {
- final Integer recurrenceType = this.fromApiJsonHelper
- .extractIntegerNamed(recurrenceTypeParamName, element, Locale.getDefault());
- baseDataValidator.reset().parameter(recurrenceTypeParamName).value(recurrenceType).notNull().inMinMaxRange(1, 2);
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.priorityParamName, element)) {
+ final Integer priority = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.priorityParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.priorityParamName).value(priority)
+ .notNull().inMinMaxRange(1, 4);
}
- if (this.fromApiJsonHelper.parameterExists(recurrenceFrequencyParamName, element)) {
- final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(recurrenceFrequencyParamName, element,
- Locale.getDefault());
- baseDataValidator.reset().parameter(recurrenceFrequencyParamName).value(recurrenceFrequency).inMinMaxRange(0, 3);
- }
-
- if (this.fromApiJsonHelper.parameterExists(recurrenceIntervalParamName, element)) {
- final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(recurrenceIntervalParamName, element,
- Locale.getDefault());
- baseDataValidator.reset().parameter(recurrenceIntervalParamName).value(recurrenceInterval).integerGreaterThanZero();
- }
-
- if (this.fromApiJsonHelper.parameterExists(nameParamName, element)) {
- final String name = this.fromApiJsonHelper.extractStringNamed(nameParamName, element);
- baseDataValidator.reset().parameter(nameParamName).value(name).notNull();
- }
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.instructionTypeParamName, element)) {
+ final Integer standingInstructionType = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.instructionTypeParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.instructionTypeParamName)
+ .value(standingInstructionType).notNull().inMinMaxRange(1, 2);
+ }
+
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceTypeParamName, element)) {
+ final Integer recurrenceType = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.recurrenceTypeParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceTypeParamName)
+ .value(recurrenceType).notNull().inMinMaxRange(1, 2);
+ }
+
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceFrequencyParamName,
+ element)) {
+ final Integer recurrenceFrequency = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.recurrenceFrequencyParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName)
+ .value(recurrenceFrequency).inMinMaxRange(0, 3);
+ }
+
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.recurrenceIntervalParamName,
+ element)) {
+ final Integer recurrenceInterval = this.fromApiJsonHelper.extractIntegerNamed(
+ StandingInstructionApiConstants.recurrenceIntervalParamName, element, Locale.getDefault());
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName)
+ .value(recurrenceInterval).integerGreaterThanZero();
+ }
+
+ if (this.fromApiJsonHelper.parameterExists(StandingInstructionApiConstants.nameParamName, element)) {
+ final String name = this.fromApiJsonHelper.extractStringNamed(StandingInstructionApiConstants.nameParamName,
+ element);
+ baseDataValidator.reset().parameter(StandingInstructionApiConstants.nameParamName).value(name).notNull();
+ }
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/constants/ShareAccountApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/constants/ShareAccountApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/constants/ShareAccountApiConstants.java
index bbfe50e..7ab98a1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/constants/ShareAccountApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/constants/ShareAccountApiConstants.java
@@ -104,11 +104,4 @@ public interface ShareAccountApiConstants {
allowdividendcalculationforinactiveclients_paramname, charges_paramname, applicationdate_param,
purchaseddate_paramname,numberofshares_paramname,purchasedprice_paramname));
- Set<String> approvalParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, approveddate_paramname, note_paramname));
-
- Set<String> activateParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, activatedate_paramname));
-
- Set<String> closeParameters = new HashSet<>(Arrays.asList(locale_paramname, dateformat_paramname, closeddate_paramname, note_paramname));
-
- Set<String> addtionalSharesParameters = new HashSet<>(Arrays.asList(locale_paramname, requesteddate_paramname, requestedshares_paramname, purchasedprice_paramname, dateformat_paramname));
}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java
index bae61d5..b4d248c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java
@@ -180,33 +180,14 @@ public class ClientApiConstants {
public static final String datatables = "datatables";
- public static final Set<String> CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(address,localeParamName, dateFormatParamName, groupIdParamName, accountNoParamName, externalIdParamName,
- mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, officeIdParamName,
- activeParamName, activationDateParamName, staffIdParamName, submittedOnDateParamName, savingsProductIdParamName,
- dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName,
- clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, datatables, isStaffParamName));
-
- public static final Set<String> CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(address,localeParamName, dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
- constitutionIdParamName, mainBusinessLineIdParamName, datatables));
-
- public static final Set<String> CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName,
-
- lastnameParamName, fullnameParamName, activeParamName, activationDateParamName, staffIdParamName, savingsProductIdParamName,
- dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName, submittedOnDateParamName, clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, isStaffParamName));
-
- public static final Set<String> CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
- dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
- constitutionIdParamName, mainBusinessLineIdParamName));
/**
* These parameters will match the class level parameters of
* {@link ClientData}. Where possible, we try to get response parameters to
* match those of request parameters.
*/
- public static final Set<String> CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName,
+ protected static final Set<String> CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ accountNoParamName,
externalIdParamName, statusParamName, activeParamName, activationDateParamName, firstnameParamName, middlenameParamName,
lastnameParamName, fullnameParamName, displayNameParamName, mobileNoParamName, officeIdParamName, officeNameParamName,
transferToOfficeIdParamName, transferToOfficeNameParamName, hierarchyParamName, imageIdParamName, imagePresentParamName,
@@ -214,39 +195,14 @@ public class ClientApiConstants {
dateOfBirthParamName, genderParamName, clientTypeParamName, clientClassificationParamName, legalFormParamName,
clientNonPersonDetailsParamName, isStaffParamName));
- public static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName));
- public static final Set<String> REACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, reactivationDateParamName));
-
- public static final Set<String> CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName));
-
- public static final Set<String> CLIENT_REJECT_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, rejectionDateParamName, rejectionReasonIdParamName));
-
- public static final Set<String> CLIENT_WITHDRAW_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, withdrawalDateParamName, withdrawalReasonIdParamName));
-
- public static final Set<String> UNDOREJECTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
-
- public static final Set<String> UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
-
- public static final Set<String> CLIENT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName,
+ protected static final Set<String> CLIENT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
+ (chargeIdParamName,
clientIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName,
chargeCalculationTypeParamName, currencyParamName, amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName,
amountOrPercentageParamName, amountParamName, amountPaidParamName, chargeOptionsParamName, transactionsParamName));
- public static final Set<String> CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
-
- public static final Set<String> CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(amountParamName,
- transactionDateParamName, dateFormatParamName, localeParamName, paymentTypeIdParamName, transactionAccountNumberParamName,
- checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
-
- public static final Set<String> CLIENT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ protected static final Set<String> CLIENT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
+ (idParamName,
transactionAmountParamName, paymentDetailDataParamName, reversedParamName, dateParamName, officeIdParamName,
officeNameParamName, transactionTypeParamName, transactionCurrencyParamName, externalIdParamName, submittedOnDateParamName));
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientApiCollectionConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientApiCollectionConstants.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientApiCollectionConstants.java
new file mode 100644
index 0000000..bf60ba8
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientApiCollectionConstants.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.client.data;
+
+import org.apache.fineract.portfolio.client.api.ClientApiConstants;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class ClientApiCollectionConstants extends ClientApiConstants{
+
+ protected static final Set<String> CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(address,localeParamName, dateFormatParamName, groupIdParamName, accountNoParamName, externalIdParamName,
+ mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, officeIdParamName,
+ activeParamName, activationDateParamName, staffIdParamName, submittedOnDateParamName, savingsProductIdParamName,
+ dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName,
+ clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, datatables, isStaffParamName));
+
+ protected static final Set<String> CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(address,localeParamName, dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
+ constitutionIdParamName, mainBusinessLineIdParamName, datatables));
+
+ protected static final Set<String> CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
+ dateFormatParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName,
+
+ lastnameParamName, fullnameParamName, activeParamName, activationDateParamName, staffIdParamName, savingsProductIdParamName,
+ dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName, submittedOnDateParamName, clientNonPersonDetailsParamName, displaynameParamName, legalFormIdParamName, isStaffParamName));
+
+ protected static final Set<String> CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
+ dateFormatParamName, incorpNumberParamName, remarksParamName, incorpValidityTillParamName,
+ constitutionIdParamName, mainBusinessLineIdParamName));
+
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link ClientData}. Where possible, we try to get response parameters to
+ * match those of request parameters.
+ */
+
+ protected static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName));
+ protected static final Set<String> REACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, reactivationDateParamName));
+
+ protected static final Set<String> CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName));
+
+ protected static final Set<String> CLIENT_REJECT_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, rejectionDateParamName, rejectionReasonIdParamName));
+
+ protected static final Set<String> CLIENT_WITHDRAW_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, withdrawalDateParamName, withdrawalReasonIdParamName));
+
+ protected static final Set<String> UNDOREJECTION_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
+
+ protected static final Set<String> UNDOWITHDRAWN_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(localeParamName, dateFormatParamName, reopenedDateParamName));
+
+ protected static final Set<String> CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName));
+
+ protected static final Set<String> CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(amountParamName,
+ transactionDateParamName, dateFormatParamName, localeParamName, paymentTypeIdParamName, transactionAccountNumberParamName,
+ checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName));
+
+
+}
http://git-wip-us.apache.org/repos/asf/fineract/blob/50048151/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java
index 9310c76..6bd87d2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java
@@ -53,7 +53,7 @@ public class ClientChargeDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- ClientApiConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
+ ClientApiCollectionConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -75,7 +75,7 @@ public class ClientChargeDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- ClientApiConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
+ ClientApiCollectionConstants.CLIENT_CHARGES_ADD_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -100,7 +100,7 @@ public class ClientChargeDataValidator {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- ClientApiConstants.CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
+ ClientApiCollectionConstants.CLIENT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)