Class DefaultEndpointRestrictionsConfigStrategy
java.lang.Object
de.hybris.platform.webservicescommons.api.restrictions.strategies.impl.DefaultEndpointRestrictionsConfigStrategy
- All Implemented Interfaces:
EndpointRestrictionsConfigStrategy
public class DefaultEndpointRestrictionsConfigStrategy
extends Object
implements EndpointRestrictionsConfigStrategy
Strategy used to determine whether the API endpoint is disabled, based on property in the configuration.
The endpoint is disabled if its ID exists in the identifier list of the configuration property.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultEndpointRestrictionsConfigStrategy(ConfigurationService configurationService) Strategy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected ConfigurationServiceprotected String[]getDisabledEndpoints(String configKeyPrefix) Reads array of disabled endpoint identifiers from the configuration file.protected StringgetDisabledEndpointsPropertyKey(String configKeyPrefix) Creates configuration property key based on a given configuration prefix.protected StringgetPropertyKey(String configKeyPrefix, String propertyKey) Creates configuration property key based on a given configuration prefix and key postfix.booleanisDisabledEndpointListEmpty(String configKeyPrefix) Verifies whether the configuration list of disabled endpoints is empty for the given config prefix.booleanisEndpointDisabled(String configKeyPrefix, String endpointId) Verifies whether the endpoint is disabled in the configuration, based on given configuration key prefix and endpoint identifier.protected booleanisEndpointIdDisabled(String endpointId, String[] disabledEndpoints) Verifies whether endpoint identifier exists in the disabled endpoints array.
-
Constructor Details
-
DefaultEndpointRestrictionsConfigStrategy
Strategy constructor- Parameters:
configurationService- configuration service
-
-
Method Details
-
isEndpointDisabled
Verifies whether the endpoint is disabled in the configuration, based on given configuration key prefix and endpoint identifier.Throws
IllegalArgumentExceptionin case theconfigKeyPrefixor theendpointIdargument is null.- Specified by:
isEndpointDisabledin interfaceEndpointRestrictionsConfigStrategy- Parameters:
configKeyPrefix- configuration key prefixendpointId- endpoint identifier- Returns:
true- means the endpoint is disabled
-
isDisabledEndpointListEmpty
Verifies whether the configuration list of disabled endpoints is empty for the given config prefix.Throws
IllegalArgumentExceptionin case the config prefix is null.- Specified by:
isDisabledEndpointListEmptyin interfaceEndpointRestrictionsConfigStrategy- Parameters:
configKeyPrefix- configuration key prefix used to create configuration property key- Returns:
trueif the list is empty
-
isEndpointIdDisabled
Verifies whether endpoint identifier exists in the disabled endpoints array.- Parameters:
endpointId- endpoint identifierdisabledEndpoints- array of disabled endpoint identifiers- Returns:
-
getDisabledEndpoints
Reads array of disabled endpoint identifiers from the configuration file.Returns empty array if there is no property in the configuration.
- Parameters:
configKeyPrefix- prefix used to create configuration key- Returns:
- array of disabled endpoint identifiers or empty array
-
getDisabledEndpointsPropertyKey
Creates configuration property key based on a given configuration prefix.The key is used to read array of disabled endpoint identifiers.
- Parameters:
configKeyPrefix- prefix used to create configuration key- Returns:
- configuration property key
-
getPropertyKey
Creates configuration property key based on a given configuration prefix and key postfix.- Parameters:
configKeyPrefix- prefix used to create configuration keypropertyKey- key postfix, that defines specified property- Returns:
- property key
-
getConfigurationService
-