Class AbstractResourceValidator
java.lang.Object
de.captaingoldfish.scim.sdk.server.schemas.validation.AbstractResourceValidator
- Direct Known Subclasses:
RequestResourceValidator,ResponseResourceValidator
- Since:
- 21.04.2021
- Author:
- Pascal Knueppel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classthe representation of a validated extension -
Constructor Summary
ConstructorsConstructorDescriptionAbstractResourceValidator(ResourceType resourceType, AbstractSchemaValidator schemaValidator) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForMissingRequiredExtensions(List<Schema> requiredExtensionList, List<Schema> inResourcePresentExtensions) checks if the extensions within the documents body are missing a required extensionprotected abstract intthe http status code to use in theDocumentValidationExceptionif the validation fails.protected ResourceTypethe resource type that is the representative for the validation that will be executed on the documentprotected AbstractSchemaValidatorthe schema validator implementation to usevalidateDocument(com.fasterxml.jackson.databind.JsonNode document) checks the given document against the schema definition of theresourceTypeprotected List<AbstractResourceValidator.ValidatedExtension>validateExtensions(List<Schema> extensions, List<Schema> inResourcePresentExtensions, com.fasterxml.jackson.databind.JsonNode resource) validates the extensions that are present within the document that should be validated
-
Constructor Details
-
AbstractResourceValidator
public AbstractResourceValidator(ResourceType resourceType, AbstractSchemaValidator schemaValidator)
-
-
Method Details
-
getHttpStatusCode
protected abstract int getHttpStatusCode()the http status code to use in theDocumentValidationExceptionif the validation fails. Should be 400 (bad request) for requests and 500 (internal server error) for responses -
validateDocument
checks the given document against the schema definition of theresourceType- Parameters:
document- the document that should be validated- Returns:
- the validated resource
-
validateExtensions
protected List<AbstractResourceValidator.ValidatedExtension> validateExtensions(List<Schema> extensions, List<Schema> inResourcePresentExtensions, com.fasterxml.jackson.databind.JsonNode resource) validates the extensions that are present within the document that should be validated- Parameters:
extensions- all extensions that are defined within theresourceTypeinResourcePresentExtensions- all extensions that were found within the documents body- Returns:
- the list of validated extensions. If an extension evaluated to an empty object it will not be present within this list
-
checkForMissingRequiredExtensions
protected void checkForMissingRequiredExtensions(List<Schema> requiredExtensionList, List<Schema> inResourcePresentExtensions) checks if the extensions within the documents body are missing a required extension- Parameters:
requiredExtensionList- the list of extensions that are required for theresourceTypeinResourcePresentExtensions- all extensions that were found within the documents body
-
getResourceType
the resource type that is the representative for the validation that will be executed on the document -
getSchemaValidator
the schema validator implementation to use
-