org.apache.sling.validation.impl

## Class ValidationServiceImpl

- java.lang.Object
- - org.apache.sling.validation.impl.ValidationServiceImpl

All Implemented Interfaces:
  org.apache.sling.validation.ValidationService

    public class ValidationServiceImpl
    extends Object
    implements org.apache.sling.validation.ValidationService

### Field Summary

Fields
`protected static String` `I18N_KEY_EXPECTED_MULTIVALUE_PROPERTY`
`protected static String` `I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_MATCHING_PATTERN`
`protected static String` `I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_WITH_NAME`
`protected static String` `I18N_KEY_MISSING_REQUIRED_PROPERTY_MATCHING_PATTERN`
`protected static String` `I18N_KEY_MISSING_REQUIRED_PROPERTY_WITH_NAME`
`protected static String` `I18N_KEY_WRONG_PROPERTY_TYPE` Keys whose values are defined in the JCR resource bundle contained in the content-repository section of this bundle

### Constructor Summary

Constructors
Constructor and Description
`ValidationServiceImpl()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `activate(ValidationServiceConfiguration configuration)`
`protected void` `addValidator(org.apache.sling.validation.spi.Validator<?> validator, Map<String,Object> properties, org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)`
`protected String` `getRelativeResourceType(String resourceType)` If the given resourceType is starting with a "/", it will strip out the leading search path from the given resource type.
`org.apache.sling.validation.model.ValidationModel` `getValidationModel(org.apache.sling.api.resource.Resource resource, boolean considerResourceSuperTypeModels)`
`org.apache.sling.validation.model.ValidationModel` `getValidationModel(String validatedResourceType, String resourcePath, boolean considerResourceSuperTypeModels)`
`protected void` `removeValidator(org.apache.sling.validation.spi.Validator<?> validator, Map<String,Object> properties, org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)`
`protected void` `updatedValidator(org.apache.sling.validation.spi.Validator<?> validator, Map<String,Object> properties, org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)` Necessary to deal with property changes which do not lead to service restarts (when a modified method is provided)
`org.apache.sling.validation.ValidationResult` `validate(org.apache.sling.api.resource.Resource resource, org.apache.sling.validation.model.ValidationModel model)`
`protected org.apache.sling.validation.ValidationResult` `validate(org.apache.sling.api.resource.Resource resource, org.apache.sling.validation.model.ValidationModel model, String relativePath)`
`org.apache.sling.validation.ValidationResult` `validate(org.apache.sling.api.resource.ValueMap valueMap, org.apache.sling.validation.model.ValidationModel model)`
`org.apache.sling.validation.ValidationResult` `validateResourceRecursively(org.apache.sling.api.resource.Resource resource, boolean enforceValidation, Predicate<org.apache.sling.api.resource.Resource> filter, boolean considerResourceSuperTypeModels)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### I18N_KEY_WRONG_PROPERTY_TYPE

    @Nonnull
    protected static final String I18N_KEY_WRONG_PROPERTY_TYPE

Keys whose values are defined in the JCR resource bundle contained in the content-repository section of this bundle

See Also:
  Constant Field Values

#### I18N_KEY_EXPECTED_MULTIVALUE_PROPERTY

    @Nonnull
    protected static final String I18N_KEY_EXPECTED_MULTIVALUE_PROPERTY

See Also:
  Constant Field Values

#### I18N_KEY_MISSING_REQUIRED_PROPERTY_WITH_NAME

    @Nonnull
    protected static final String I18N_KEY_MISSING_REQUIRED_PROPERTY_WITH_NAME

See Also:
  Constant Field Values

#### I18N_KEY_MISSING_REQUIRED_PROPERTY_MATCHING_PATTERN

    @Nonnull
    protected static final String I18N_KEY_MISSING_REQUIRED_PROPERTY_MATCHING_PATTERN

See Also:
  Constant Field Values

#### I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_WITH_NAME

    @Nonnull
    protected static final String I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_WITH_NAME

See Also:
  Constant Field Values

#### I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_MATCHING_PATTERN

    @Nonnull
    protected static final String I18N_KEY_MISSING_REQUIRED_CHILD_RESOURCE_MATCHING_PATTERN

See Also:
  Constant Field Values

### Constructor Detail

#### ValidationServiceImpl

    public ValidationServiceImpl()

### Method Detail

#### activate

    protected void activate(ValidationServiceConfiguration configuration)

#### addValidator

    protected void addValidator(@Nonnull
                                org.apache.sling.validation.spi.Validator<?> validator,
                                Map<String,Object> properties,
                                org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)

#### removeValidator

    protected void removeValidator(@Nonnull
                                   org.apache.sling.validation.spi.Validator<?> validator,
                                   Map<String,Object> properties,
                                   org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)

#### updatedValidator

    protected void updatedValidator(@Nonnull
                                    org.apache.sling.validation.spi.Validator<?> validator,
                                    Map<String,Object> properties,
                                    org.osgi.framework.ServiceReference<org.apache.sling.validation.spi.Validator<?>> serviceReference)

Necessary to deal with property changes which do not lead to service restarts (when a modified method is provided)

#### getValidationModel

    @CheckForNull
    public org.apache.sling.validation.model.ValidationModel getValidationModel(@Nonnull
                                                                                              String validatedResourceType,
                                                                                              String resourcePath,
                                                                                              boolean considerResourceSuperTypeModels)

Specified by:
  `getValidationModel` in interface `org.apache.sling.validation.ValidationService`

#### getRelativeResourceType

    @Nonnull
    protected String getRelativeResourceType(@Nonnull
                                                      String resourceType)
                                               throws IllegalArgumentException

If the given resourceType is starting with a "/", it will strip out the leading search path from the given resource type. Otherwise it will just return the given resource type (as this is already relative).

Parameters:
  `resourceType` - the resource type to convert
Returns:
  a relative resource type (without the leading search path)
Throws:
  `IllegalArgumentException` - in case the resource type is starting with a "/" but not with any of the search paths.

#### getValidationModel

    @CheckForNull
    public org.apache.sling.validation.model.ValidationModel getValidationModel(@Nonnull
                                                                                              org.apache.sling.api.resource.Resource resource,
                                                                                              boolean considerResourceSuperTypeModels)

Specified by:
  `getValidationModel` in interface `org.apache.sling.validation.ValidationService`

#### validate

    @Nonnull
    public org.apache.sling.validation.ValidationResult validate(@Nonnull
                                                                          org.apache.sling.api.resource.Resource resource,
                                                                          @Nonnull
                                                                          org.apache.sling.validation.model.ValidationModel model)

Specified by:
  `validate` in interface `org.apache.sling.validation.ValidationService`

#### validate

    @Nonnull
    protected org.apache.sling.validation.ValidationResult validate(@Nonnull
                                                                             org.apache.sling.api.resource.Resource resource,
                                                                             @Nonnull
                                                                             org.apache.sling.validation.model.ValidationModel model,
                                                                             @Nonnull
                                                                             String relativePath)

#### validate

    @Nonnull
    public org.apache.sling.validation.ValidationResult validate(@Nonnull
                                                                          org.apache.sling.api.resource.ValueMap valueMap,
                                                                          @Nonnull
                                                                          org.apache.sling.validation.model.ValidationModel model)

Specified by:
  `validate` in interface `org.apache.sling.validation.ValidationService`

#### validateResourceRecursively

    @Nonnull
    public org.apache.sling.validation.ValidationResult validateResourceRecursively(@Nonnull
                                                                                             org.apache.sling.api.resource.Resource resource,
                                                                                             boolean enforceValidation,
                                                                                             Predicate<org.apache.sling.api.resource.Resource> filter,
                                                                                             boolean considerResourceSuperTypeModels)
                                                                                      throws IllegalStateException,
                                                                                             IllegalArgumentException,
                                                                                             org.apache.sling.validation.SlingValidationException

Specified by:
  `validateResourceRecursively` in interface `org.apache.sling.validation.ValidationService`
Throws:
  `IllegalStateException`
  `IllegalArgumentException`
  `org.apache.sling.validation.SlingValidationException`