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 Details

    • DefaultEndpointRestrictionsConfigStrategy

      public DefaultEndpointRestrictionsConfigStrategy(ConfigurationService configurationService)
      Strategy constructor
      Parameters:
      configurationService - configuration service
  • Method Details

    • isEndpointDisabled

      public boolean isEndpointDisabled(String configKeyPrefix, String endpointId)
      Verifies whether the endpoint is disabled in the configuration, based on given configuration key prefix and endpoint identifier.

      Throws IllegalArgumentException in case the configKeyPrefix or the endpointId argument is null.

      Specified by:
      isEndpointDisabled in interface EndpointRestrictionsConfigStrategy
      Parameters:
      configKeyPrefix - configuration key prefix
      endpointId - endpoint identifier
      Returns:
      true - means the endpoint is disabled
    • isDisabledEndpointListEmpty

      public boolean isDisabledEndpointListEmpty(String configKeyPrefix)
      Verifies whether the configuration list of disabled endpoints is empty for the given config prefix.

      Throws IllegalArgumentException in case the config prefix is null.

      Specified by:
      isDisabledEndpointListEmpty in interface EndpointRestrictionsConfigStrategy
      Parameters:
      configKeyPrefix - configuration key prefix used to create configuration property key
      Returns:
      true if the list is empty
    • isEndpointIdDisabled

      protected boolean isEndpointIdDisabled(String endpointId, String[] disabledEndpoints)
      Verifies whether endpoint identifier exists in the disabled endpoints array.
      Parameters:
      endpointId - endpoint identifier
      disabledEndpoints - array of disabled endpoint identifiers
      Returns:
    • getDisabledEndpoints

      protected String[] getDisabledEndpoints(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 String getDisabledEndpointsPropertyKey(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 String getPropertyKey(String configKeyPrefix, String propertyKey)
      Creates configuration property key based on a given configuration prefix and key postfix.
      Parameters:
      configKeyPrefix - prefix used to create configuration key
      propertyKey - key postfix, that defines specified property
      Returns:
      property key
    • getConfigurationService

      protected ConfigurationService getConfigurationService()