Fixing Fixed CWE582,CWE607 issues in account and infrastructure modules
This commit is contained in:
+1
@@ -28,6 +28,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.fineract.accounting.accrual.api.AccrualAccountingConstants;
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||||
|
|||||||
+8
-4
@@ -23,9 +23,13 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class FinancialActivityAccountsConstants {
|
public class FinancialActivityAccountsConstants {
|
||||||
|
private static final String idParamName = "id";
|
||||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "financialActivityData",
|
private static final String factivityDataParamName = "financialActivityData";
|
||||||
"glAccountData", "glAccountOptions", "financialActivityOptions"));
|
private static final String glAccountDataParamName = "glAccountData";
|
||||||
|
private static final String glAccountOptionsParamName = "glAccountOptions";
|
||||||
|
private static final String financialActivityOptionsParamName = "financialActivityOptions";
|
||||||
public static final String resourceNameForPermission = "FINANCIALACTIVITYACCOUNT";
|
public static final String resourceNameForPermission = "FINANCIALACTIVITYACCOUNT";
|
||||||
|
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||||
|
Arrays.asList(idParamName, factivityDataParamName, glAccountDataParamName, glAccountOptionsParamName,
|
||||||
|
financialActivityOptionsParamName));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ public class JournalEntryDataValidator {
|
|||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
|
||||||
public static final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
private final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(JournalEntryJsonInputParams.OFFICE_ID.getValue()));
|
Arrays.asList(JournalEntryJsonInputParams.OFFICE_ID.getValue()));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
+8
-4
@@ -32,11 +32,15 @@ public interface ProvisioningEntriesApiConstants {
|
|||||||
|
|
||||||
public final static String JSON_CREATEJOURNALENTRIES_PARAM = "createjournalentries" ;
|
public final static String JSON_CREATEJOURNALENTRIES_PARAM = "createjournalentries" ;
|
||||||
|
|
||||||
Set<String> supportedParameters = new HashSet<>(Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM,JSON_LOCALE_PARAM,
|
public final static String PROVISIONINGENTRY_PARAM = "provisioningentry";
|
||||||
JSON_CREATEJOURNALENTRIES_PARAM));
|
|
||||||
|
|
||||||
Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList("provisioningentry", "entries"));
|
public final static String ENTRIES_PARAM = "entries";
|
||||||
|
|
||||||
Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList("provisioningentry"));
|
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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -70,22 +70,26 @@ public class SmsCampaignValidator {
|
|||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
|
||||||
public static final Set<String> supportedParams = new HashSet<>(Arrays.asList(campaignName, campaignType, localeParamName,
|
protected static final Set<String> supportedParams = new HashSet<>(Arrays.asList(campaignName, campaignType,
|
||||||
|
localeParamName,
|
||||||
dateFormatParamName, runReportId, paramValue, message, recurrenceStartDate, activationDateParamName, submittedOnDateParamName,
|
dateFormatParamName, runReportId, paramValue, message, recurrenceStartDate, activationDateParamName, submittedOnDateParamName,
|
||||||
closureDateParamName, recurrenceParamName, providerId, triggerType, frequencyParamName, intervalParamName,
|
closureDateParamName, recurrenceParamName, providerId, triggerType, frequencyParamName, intervalParamName,
|
||||||
repeatsOnDayParamName, triggerEntityType, triggerActionType, dateTimeFormat));
|
repeatsOnDayParamName, triggerEntityType, triggerActionType, dateTimeFormat));
|
||||||
|
|
||||||
public static final Set<String> supportedParamsForUpdate = new HashSet<>(Arrays.asList(campaignName, campaignType, localeParamName,
|
protected static final Set<String> supportedParamsForUpdate = new HashSet<>(Arrays.asList(campaignName, campaignType,
|
||||||
|
localeParamName,
|
||||||
dateFormatParamName, runReportId, paramValue, message, recurrenceStartDate, activationDateParamName, recurrenceParamName,
|
dateFormatParamName, runReportId, paramValue, message, recurrenceStartDate, activationDateParamName, recurrenceParamName,
|
||||||
providerId, triggerType, triggerEntityType, triggerActionType, dateTimeFormat));
|
providerId, triggerType, triggerEntityType, triggerActionType, dateTimeFormat));
|
||||||
|
|
||||||
public static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
protected static final Set<String> ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||||
|
dateFormatParamName,
|
||||||
activationDateParamName));
|
activationDateParamName));
|
||||||
|
|
||||||
public static final Set<String> CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
protected static final Set<String> CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
||||||
|
dateFormatParamName,
|
||||||
closureDateParamName));
|
closureDateParamName));
|
||||||
|
|
||||||
public static final Set<String> PREVIEW_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(paramValue, message));
|
protected static final Set<String> PREVIEW_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(paramValue, message));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SmsCampaignValidator(FromJsonHelper fromApiJsonHelper) {
|
public SmsCampaignValidator(FromJsonHelper fromApiJsonHelper) {
|
||||||
|
|||||||
+2
-1
@@ -28,5 +28,6 @@ public class ExternalServiceConfigurationApiConstant {
|
|||||||
public static final String VALUE = "value";
|
public static final String VALUE = "value";
|
||||||
public static final String EXTERNAL_SERVICE_RESOURCE_NAME = "externalServiceConfiguration";
|
public static final String EXTERNAL_SERVICE_RESOURCE_NAME = "externalServiceConfiguration";
|
||||||
|
|
||||||
public static final Set<String> EXTERNAL_SERVICE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList(NAME, VALUE));
|
protected static final Set<String> EXTERNAL_SERVICE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||||
|
(NAME, VALUE));
|
||||||
}
|
}
|
||||||
|
|||||||
-3
@@ -32,7 +32,4 @@ public class GlobalConfigurationApiConstant {
|
|||||||
public static final String localeParamName = "locale";
|
public static final String localeParamName = "locale";
|
||||||
public static final String dateFormatParamName = "dateFormat";
|
public static final String dateFormatParamName = "dateFormat";
|
||||||
|
|
||||||
public static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
|
|
||||||
ENABLED, VALUE, DATE_VALUE));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-19
@@ -18,16 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.configuration.data;
|
package org.apache.fineract.infrastructure.configuration.data;
|
||||||
|
|
||||||
import static org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant.CONFIGURATION_RESOURCE_NAME;
|
|
||||||
import static org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant.ENABLED;
|
|
||||||
import static org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant.UPDATE_CONFIGURATION_DATA_PARAMETERS;
|
|
||||||
import static org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant.VALUE;
|
|
||||||
import static org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant.DATE_VALUE;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
@@ -36,6 +33,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
|||||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
|
import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationApiConstant;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -47,6 +45,10 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
public class GlobalConfigurationDataValidator {
|
public class GlobalConfigurationDataValidator {
|
||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
private static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(
|
||||||
|
Arrays.asList(GlobalConfigurationApiConstant.localeParamName,
|
||||||
|
GlobalConfigurationApiConstant.dateFormatParamName, GlobalConfigurationApiConstant.ENABLED,
|
||||||
|
GlobalConfigurationApiConstant.VALUE, GlobalConfigurationApiConstant.DATE_VALUE));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GlobalConfigurationDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
public GlobalConfigurationDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||||
@@ -61,23 +63,29 @@ public class GlobalConfigurationDataValidator {
|
|||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CONFIGURATION_RESOURCE_NAME);
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||||
|
.resource(GlobalConfigurationApiConstant.CONFIGURATION_RESOURCE_NAME);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ENABLED, element)) {
|
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.ENABLED, element)) {
|
||||||
final boolean enabledBool = this.fromApiJsonHelper.extractBooleanNamed(ENABLED, element);
|
final boolean enabledBool = this.fromApiJsonHelper
|
||||||
baseDataValidator.reset().parameter(ENABLED).value(enabledBool).validateForBooleanValue();
|
.extractBooleanNamed(GlobalConfigurationApiConstant.ENABLED, element);
|
||||||
}
|
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(enabledBool)
|
||||||
|
.validateForBooleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(VALUE, element)) {
|
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.VALUE, element)) {
|
||||||
final Long valueStr = this.fromApiJsonHelper.extractLongNamed(VALUE, element);
|
final Long valueStr = this.fromApiJsonHelper.extractLongNamed(GlobalConfigurationApiConstant.VALUE,
|
||||||
baseDataValidator.reset().parameter(ENABLED).value(valueStr).zeroOrPositiveAmount();
|
element);
|
||||||
}
|
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(valueStr)
|
||||||
|
.zeroOrPositiveAmount();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(DATE_VALUE, element)) {
|
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.DATE_VALUE, element)) {
|
||||||
final LocalDate dateValue = this.fromApiJsonHelper.extractLocalDateNamed(DATE_VALUE, element);
|
final LocalDate dateValue = this.fromApiJsonHelper
|
||||||
baseDataValidator.reset().parameter(DATE_VALUE).value(dateValue).notNull();
|
.extractLocalDateNamed(GlobalConfigurationApiConstant.DATE_VALUE, element);
|
||||||
}
|
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull();
|
||||||
|
}
|
||||||
|
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class PaginationParametersDataValidator {
|
public class PaginationParametersDataValidator {
|
||||||
|
|
||||||
public static Set<String> sortOrderValues = new HashSet<>(Arrays.asList("ASC", "DESC"));
|
private final Set<String> sortOrderValues = new HashSet<>(Arrays.asList("ASC", "DESC"));
|
||||||
|
|
||||||
public void validateParameterValues(PaginationParameters parameters, final Set<String> supportedOrdeByValues, final String resourceName) {
|
public void validateParameterValues(PaginationParameters parameters, final Set<String> supportedOrdeByValues, final String resourceName) {
|
||||||
|
|
||||||
|
|||||||
-2
@@ -32,8 +32,6 @@ public class DataTableApiConstant {
|
|||||||
|
|
||||||
public static final String categoryParamName ="category";
|
public static final String categoryParamName ="category";
|
||||||
public static final String localParamName = "locale";
|
public static final String localParamName = "locale";
|
||||||
public static final Set<String> REGISTER_PARAMS = new HashSet<>(Arrays.asList(categoryParamName,localParamName));
|
|
||||||
|
|
||||||
public static final String DATATABLE_RESOURCE_NAME ="dataTables";
|
public static final String DATATABLE_RESOURCE_NAME ="dataTables";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -18,20 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.dataqueries.data;
|
package org.apache.fineract.infrastructure.dataqueries.data;
|
||||||
|
|
||||||
import static org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant.CATEGORY_DEFAULT;
|
|
||||||
import static org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant.CATEGORY_PPI;
|
|
||||||
import static org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant.DATATABLE_RESOURCE_NAME;
|
|
||||||
import static org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant.REGISTER_PARAMS;
|
|
||||||
import static org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant.categoryParamName;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
|
import org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -43,6 +41,8 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
public class DataTableValidator {
|
public class DataTableValidator {
|
||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
private final Set<String> REGISTER_PARAMS = new HashSet<>(
|
||||||
|
Arrays.asList(DataTableApiConstant.categoryParamName, DataTableApiConstant.localParamName));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DataTableValidator(final FromJsonHelper fromApiJsonHelper) {
|
public DataTableValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||||
@@ -55,14 +55,14 @@ public class DataTableValidator {
|
|||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REGISTER_PARAMS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REGISTER_PARAMS);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(DATATABLE_RESOURCE_NAME);
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(DataTableApiConstant.DATATABLE_RESOURCE_NAME);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(categoryParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(DataTableApiConstant.categoryParamName, element)) {
|
||||||
|
|
||||||
final Integer category = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(categoryParamName, element);
|
final Integer category = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(DataTableApiConstant.categoryParamName, element);
|
||||||
Object[] objectArray = new Integer[] { CATEGORY_PPI, CATEGORY_DEFAULT };
|
Object[] objectArray = new Integer[] { DataTableApiConstant.CATEGORY_PPI, DataTableApiConstant.CATEGORY_DEFAULT };
|
||||||
baseDataValidator.reset().parameter(categoryParamName).value(category).isOneOfTheseValues(objectArray);
|
baseDataValidator.reset().parameter(DataTableApiConstant.categoryParamName).value(category).isOneOfTheseValues(objectArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ import org.apache.fineract.infrastructure.documentmanagement.exception.ContentMa
|
|||||||
|
|
||||||
public class ContentRepositoryUtils {
|
public class ContentRepositoryUtils {
|
||||||
|
|
||||||
public static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
|
||||||
public static enum IMAGE_MIME_TYPE {
|
public static enum IMAGE_MIME_TYPE {
|
||||||
GIF("image/gif"), JPEG("image/jpeg"), PNG("image/png");
|
GIF("image/gif"), JPEG("image/jpeg"), PNG("image/png");
|
||||||
|
|||||||
+3
-8
@@ -41,14 +41,9 @@ public class FineractEntityApiResourceConstants {
|
|||||||
public static final String ROLE_ACCESS_TO_LOAN_PRODUCTS = " role_access_to_loan_products ";
|
public static final String ROLE_ACCESS_TO_LOAN_PRODUCTS = " role_access_to_loan_products ";
|
||||||
public static final String ROLE_ACCESS_TO_SAVINGS_PRODUCTS = " role_access_to_savings_products ";
|
public static final String ROLE_ACCESS_TO_SAVINGS_PRODUCTS = " role_access_to_savings_products ";
|
||||||
|
|
||||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(mappingTypes));
|
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(mappingTypes));
|
||||||
|
|
||||||
public static final Set<String> FETCH_ENTITY_TO_ENTITY_MAPPINGS = new HashSet<>(Arrays.asList(mapId,relId,fromEnityType, toEntityType));
|
protected static final Set<String> FETCH_ENTITY_TO_ENTITY_MAPPINGS = new HashSet<>(Arrays.asList(mapId,relId,
|
||||||
|
fromEnityType, toEntityType));
|
||||||
public static final Set<String> CREATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(fromEnityType,
|
|
||||||
toEntityType, startDate, LOCALE, DATE_FORMAT, endDate));
|
|
||||||
|
|
||||||
public static final Set<String> UPDATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(relId,fromEnityType,
|
|
||||||
toEntityType, startDate,LOCALE, DATE_FORMAT, endDate));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-4
@@ -20,8 +20,11 @@ package org.apache.fineract.infrastructure.entityaccess.data;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
@@ -41,6 +44,7 @@ import org.apache.fineract.portfolio.savings.exception.SavingsProductNotFoundExc
|
|||||||
import org.apache.fineract.useradministration.domain.Role;
|
import org.apache.fineract.useradministration.domain.Role;
|
||||||
import org.apache.fineract.useradministration.domain.RoleRepository;
|
import org.apache.fineract.useradministration.domain.RoleRepository;
|
||||||
import org.apache.fineract.useradministration.exception.RoleNotFoundException;
|
import org.apache.fineract.useradministration.exception.RoleNotFoundException;
|
||||||
|
import org.apache.fineract.infrastructure.entityaccess.api.FineractEntityApiResourceConstants;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -48,6 +52,8 @@ import org.springframework.stereotype.Component;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FineractEntityDataValidator {
|
public class FineractEntityDataValidator {
|
||||||
|
|
||||||
@@ -57,6 +63,16 @@ public class FineractEntityDataValidator {
|
|||||||
private final SavingsProductRepository savingsProductRepository;
|
private final SavingsProductRepository savingsProductRepository;
|
||||||
private final ChargeRepositoryWrapper chargeRepositoryWrapper;
|
private final ChargeRepositoryWrapper chargeRepositoryWrapper;
|
||||||
private final RoleRepository roleRepository;
|
private final RoleRepository roleRepository;
|
||||||
|
private static final Set<String> CREATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||||
|
FineractEntityApiResourceConstants.fromEnityType, FineractEntityApiResourceConstants.toEntityType,
|
||||||
|
FineractEntityApiResourceConstants.startDate, FineractEntityApiResourceConstants.LOCALE,
|
||||||
|
FineractEntityApiResourceConstants.DATE_FORMAT, FineractEntityApiResourceConstants.endDate));
|
||||||
|
|
||||||
|
private static final Set<String> UPDATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
|
Arrays.asList(FineractEntityApiResourceConstants.relId, FineractEntityApiResourceConstants.fromEnityType,
|
||||||
|
FineractEntityApiResourceConstants.toEntityType, FineractEntityApiResourceConstants.startDate,
|
||||||
|
FineractEntityApiResourceConstants.LOCALE, FineractEntityApiResourceConstants.DATE_FORMAT,
|
||||||
|
FineractEntityApiResourceConstants.endDate));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public FineractEntityDataValidator(final FromJsonHelper fromApiJsonHelper, final OfficeRepositoryWrapper officeRepositoryWrapper,
|
public FineractEntityDataValidator(final FromJsonHelper fromApiJsonHelper, final OfficeRepositoryWrapper officeRepositoryWrapper,
|
||||||
@@ -75,8 +91,8 @@ public class FineractEntityDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||||
FineractEntityApiResourceConstants.CREATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS);
|
CREATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
@@ -172,8 +188,8 @@ public class FineractEntityDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||||
FineractEntityApiResourceConstants.UPDATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS);
|
UPDATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
|
|||||||
+2
-2
@@ -62,12 +62,12 @@ public class HookApiConstants {
|
|||||||
|
|
||||||
public static final String templateNameParamName = "templateName";
|
public static final String templateNameParamName = "templateName";
|
||||||
|
|
||||||
public static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(nameParamName, displayNameParamName,
|
Arrays.asList(nameParamName, displayNameParamName,
|
||||||
templateIdParamName, isActiveParamName, configParamName,
|
templateIdParamName, isActiveParamName, configParamName,
|
||||||
eventsParamName, templateNameParamName));
|
eventsParamName, templateNameParamName));
|
||||||
|
|
||||||
public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
protected static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(nameParamName, displayNameParamName,
|
Arrays.asList(nameParamName, displayNameParamName,
|
||||||
templateIdParamName, isActiveParamName, configParamName,
|
templateIdParamName, isActiveParamName, configParamName,
|
||||||
eventsParamName, templateNameParamName));
|
eventsParamName, templateNameParamName));
|
||||||
|
|||||||
+13
-13
@@ -45,19 +45,6 @@ public class SchedulerJobApiConstants {
|
|||||||
public static final String cronExpressionParamName = "cronExpression";
|
public static final String cronExpressionParamName = "cronExpression";
|
||||||
public static final String schedulerStatusParamName = "active";
|
public static final String schedulerStatusParamName = "active";
|
||||||
|
|
||||||
public static final Set<String> JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(jobIdentifierParamName,
|
|
||||||
displayNameParamName, nextRunTimeParamName, initializingErrorParamName, cronExpressionParamName, jobActiveStatusParamName,
|
|
||||||
currentlyRunningParamName, lastRunHistoryObjParamName));
|
|
||||||
|
|
||||||
public static final Set<String> JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(versionParamName,
|
|
||||||
jobRunStartTimeParamName, jobRunEndTimeParamName, statusParamName, jobRunErrorMessageParamName, triggerTypeParamName,
|
|
||||||
jobRunErrorLogParamName));
|
|
||||||
|
|
||||||
public static final Set<String> JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(displayNameParamName,
|
|
||||||
jobActiveStatusParamName, cronExpressionParamName));
|
|
||||||
|
|
||||||
public static final Set<String> SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(schedulerStatusParamName));
|
|
||||||
|
|
||||||
public static final String COMMAND_EXECUTE_JOB = "executeJob";
|
public static final String COMMAND_EXECUTE_JOB = "executeJob";
|
||||||
public static final String COMMAND_STOP_SCHEDULER = "stop";
|
public static final String COMMAND_STOP_SCHEDULER = "stop";
|
||||||
public static final String COMMAND_START_SCHEDULER = "start";
|
public static final String COMMAND_START_SCHEDULER = "start";
|
||||||
@@ -65,4 +52,17 @@ public class SchedulerJobApiConstants {
|
|||||||
public static final String JOB_ID = "jobId";
|
public static final String JOB_ID = "jobId";
|
||||||
public static final String JOB_RUN_HISTORY = "runhistory";
|
public static final String JOB_RUN_HISTORY = "runhistory";
|
||||||
public static final String SCHEDULER_STATUS_PATH = "scheduler";
|
public static final String SCHEDULER_STATUS_PATH = "scheduler";
|
||||||
|
|
||||||
|
protected static final Set<String> JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||||
|
(jobIdentifierParamName,
|
||||||
|
displayNameParamName, nextRunTimeParamName, initializingErrorParamName, cronExpressionParamName, jobActiveStatusParamName,
|
||||||
|
currentlyRunningParamName, lastRunHistoryObjParamName));
|
||||||
|
|
||||||
|
protected static final Set<String> JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||||
|
(versionParamName,
|
||||||
|
jobRunStartTimeParamName, jobRunEndTimeParamName, statusParamName, jobRunErrorMessageParamName, triggerTypeParamName,
|
||||||
|
jobRunErrorLogParamName));
|
||||||
|
|
||||||
|
protected static final Set<String> SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList
|
||||||
|
(schedulerStatusParamName));
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -20,8 +20,11 @@ package org.apache.fineract.infrastructure.jobs.data;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
@@ -40,6 +43,9 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
public class JobDetailDataValidator {
|
public class JobDetailDataValidator {
|
||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
private static final Set<String> JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||||
|
SchedulerJobApiConstants.displayNameParamName, SchedulerJobApiConstants.jobActiveStatusParamName,
|
||||||
|
SchedulerJobApiConstants.cronExpressionParamName));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public JobDetailDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
public JobDetailDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||||
@@ -51,7 +57,7 @@ public class JobDetailDataValidator {
|
|||||||
|
|
||||||
boolean atLeastOneParameterPassedForUpdate = false;
|
boolean atLeastOneParameterPassedForUpdate = false;
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SchedulerJobApiConstants.JOB_UPDATE_REQUEST_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, JOB_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo
|
|||||||
|
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
|
|
||||||
public static final List<CommandWrapper> EXEMPT_FROM_PASSWORD_RESET_CHECK = new ArrayList<CommandWrapper>() {
|
protected static final List<CommandWrapper> EXEMPT_FROM_PASSWORD_RESET_CHECK = new ArrayList<CommandWrapper>() {
|
||||||
|
|
||||||
{
|
{
|
||||||
add(new CommandWrapperBuilder().updateUser(null).build());
|
add(new CommandWrapperBuilder().updateUser(null).build());
|
||||||
|
|||||||
-5
@@ -42,9 +42,4 @@ public class SmsApiConstants {
|
|||||||
// response parameters
|
// response parameters
|
||||||
public static final String statusParamName = "status";
|
public static final String statusParamName = "status";
|
||||||
|
|
||||||
public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
|
|
||||||
dateFormatParamName, groupIdParamName, clientIdParamName, staffIdParamName, messageParamName, campaignIdParamName));
|
|
||||||
|
|
||||||
public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(messageParamName, campaignIdParamName));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+12
-2
@@ -20,8 +20,11 @@ package org.apache.fineract.infrastructure.sms.data;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
@@ -40,6 +43,13 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
public final class SmsDataValidator {
|
public final class SmsDataValidator {
|
||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
private static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||||
|
SmsApiConstants.localeParamName, SmsApiConstants.dateFormatParamName, SmsApiConstants.groupIdParamName,
|
||||||
|
SmsApiConstants.clientIdParamName, SmsApiConstants.staffIdParamName, SmsApiConstants.messageParamName,
|
||||||
|
SmsApiConstants.campaignIdParamName));
|
||||||
|
|
||||||
|
public static final Set<String> UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
|
Arrays.asList(SmsApiConstants.messageParamName, SmsApiConstants.campaignIdParamName));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SmsDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
public SmsDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||||
@@ -51,7 +61,7 @@ public final class SmsDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsApiConstants.CREATE_REQUEST_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
@@ -115,7 +125,7 @@ public final class SmsDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsApiConstants.UPDATE_REQUEST_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
|
|||||||
+2
-4
@@ -30,8 +30,6 @@ public class LikelihoodApiConstants {
|
|||||||
|
|
||||||
public static final String LIKELIHOOD_RESOURCE_NAME = "likelihood";
|
public static final String LIKELIHOOD_RESOURCE_NAME = "likelihood";
|
||||||
|
|
||||||
public static final Set<String> UPDATE_LIKELIHOOD_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ACTIVE));
|
protected static final Set<Long> VALID_LIKELIHOOD_ENABLED_VALUES = new HashSet<>(
|
||||||
|
Arrays.asList(LikelihoodStatus.DISABLED, LikelihoodStatus.ENABLED));
|
||||||
public static final Set<Long> VALID_LIKELIHOOD_ENABLED_VALUES = new HashSet<>(Arrays.asList(LikelihoodStatus.DISABLED,
|
|
||||||
LikelihoodStatus.ENABLED));
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -33,8 +33,11 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Cieyou on 3/12/14.
|
* Created by Cieyou on 3/12/14.
|
||||||
@@ -44,6 +47,8 @@ import java.util.Map;
|
|||||||
public class LikelihoodDataValidator {
|
public class LikelihoodDataValidator {
|
||||||
|
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
private static final Set<String> UPDATE_LIKELIHOOD_DATA_PARAMETERS = new HashSet<>(
|
||||||
|
Arrays.asList(LikelihoodApiConstants.ACTIVE));
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public LikelihoodDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
public LikelihoodDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||||
@@ -55,7 +60,7 @@ public class LikelihoodDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, LikelihoodApiConstants.UPDATE_LIKELIHOOD_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_LIKELIHOOD_DATA_PARAMETERS);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(LikelihoodApiConstants.LIKELIHOOD_RESOURCE_NAME);
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(LikelihoodApiConstants.LIKELIHOOD_RESOURCE_NAME);
|
||||||
|
|||||||
+1
@@ -16,5 +16,6 @@
|
|||||||
-- specific language governing permissions and limitations
|
-- specific language governing permissions and limitations
|
||||||
-- under the License.
|
-- under the License.
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE `m_client`
|
ALTER TABLE `m_client`
|
||||||
ADD COLUMN `is_staff` TINYINT(1) NOT NULL DEFAULT '0' AFTER `mobile_no`;
|
ADD COLUMN `is_staff` TINYINT(1) NOT NULL DEFAULT '0' AFTER `mobile_no`;
|
||||||
|
|||||||
Reference in New Issue
Block a user