Class DefaultEndpointRestrictionsConfigStrategy
- java.lang.Object
-
- de.hybris.platform.webservicescommons.api.restrictions.strategies.impl.DefaultEndpointRestrictionsConfigStrategy
-
- All Implemented Interfaces:
EndpointRestrictionsConfigStrategy
public class DefaultEndpointRestrictionsConfigStrategy extends java.lang.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
Constructors Constructor Description DefaultEndpointRestrictionsConfigStrategy(ConfigurationService configurationService)Strategy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConfigurationServicegetConfigurationService()protected java.lang.String[]getDisabledEndpoints(java.lang.String configKeyPrefix)Reads array of disabled endpoint identifiers from the configuration file.protected java.lang.StringgetDisabledEndpointsPropertyKey(java.lang.String configKeyPrefix)Creates configuration property key based on a given configuration prefix.protected java.lang.StringgetPropertyKey(java.lang.String configKeyPrefix, java.lang.String propertyKey)Creates configuration property key based on a given configuration prefix and key postfix.booleanisDisabledEndpointListEmpty(java.lang.String configKeyPrefix)Verifies whether the configuration list of disabled endpoints is empty for the given config prefix.booleanisEndpointDisabled(java.lang.String configKeyPrefix, java.lang.String endpointId)Verifies whether the endpoint is disabled in the configuration, based on given configuration key prefix and endpoint identifier.protected booleanisEndpointIdDisabled(java.lang.String endpointId, java.lang.String[] disabledEndpoints)Verifies whether endpoint identifier exists in the disabled endpoints array.
-
-
-
Constructor Detail
-
DefaultEndpointRestrictionsConfigStrategy
public DefaultEndpointRestrictionsConfigStrategy(ConfigurationService configurationService)
Strategy constructor- Parameters:
configurationService- configuration service
-
-
Method Detail
-
isEndpointDisabled
public boolean isEndpointDisabled(java.lang.String configKeyPrefix, java.lang.String endpointId)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
public boolean isDisabledEndpointListEmpty(java.lang.String configKeyPrefix)
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
protected boolean isEndpointIdDisabled(java.lang.String endpointId, java.lang.String[] disabledEndpoints)Verifies whether endpoint identifier exists in the disabled endpoints array.- Parameters:
endpointId- endpoint identifierdisabledEndpoints- array of disabled endpoint identifiers- Returns:
-
getDisabledEndpoints
protected java.lang.String[] getDisabledEndpoints(java.lang.String configKeyPrefix)
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
protected java.lang.String getDisabledEndpointsPropertyKey(java.lang.String configKeyPrefix)
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
protected java.lang.String getPropertyKey(java.lang.String configKeyPrefix, java.lang.String propertyKey)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
protected ConfigurationService getConfigurationService()
-
-