Class RequestResourceValidator
- java.lang.Object
-
- de.captaingoldfish.scim.sdk.server.schemas.validation.RequestResourceValidator
-
public class RequestResourceValidator extends Object
validates a request document against the schema of the currentResourceType- Since:
- 24.02.2021
- Author:
- Pascal Knueppel
-
-
Constructor Summary
Constructors Constructor Description RequestResourceValidator(ResourceType resourceType, HttpMethod httpMethod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckForMissingRequiredExtensions(List<Schema> requiredExtensionList, List<Schema> inResourcePresentExtensions)checks if the extensions within the documents body are missing a required extensionprotected intgetHttpStatusCode()the http status code to use in theDocumentValidationExceptionif the validation fails.protected ResourceTypegetResourceType()the resource type that is the representative for the validation that will be executed on the documentprotected AbstractSchemaValidatorgetSchemaValidator()the schema validator implementation to useValidationContextgetValidationContext()ScimObjectNodevalidateDocument(com.fasterxml.jackson.databind.JsonNode resource)assures that the meta-attribute that is sent by the client is added into the validated document.protected List<de.captaingoldfish.scim.sdk.server.schemas.validation.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 Detail
-
RequestResourceValidator
public RequestResourceValidator(ResourceType resourceType, HttpMethod httpMethod)
-
-
Method Detail
-
getValidationContext
public ValidationContext getValidationContext()
- Returns:
- the validation context on the current schema validation
-
validateDocument
public ScimObjectNode validateDocument(com.fasterxml.jackson.databind.JsonNode resource)
assures that the meta-attribute that is sent by the client is added into the validated document. This meta information might be important to theResourceHandlerimplementation- Parameters:
resource- the document that should be validated- Returns:
- the validated document with the original meta attribute
-
getHttpStatusCode
protected 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
-
validateExtensions
protected List<de.captaingoldfish.scim.sdk.server.schemas.validation.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
protected ResourceType getResourceType()
the resource type that is the representative for the validation that will be executed on the document
-
getSchemaValidator
protected AbstractSchemaValidator getSchemaValidator()
the schema validator implementation to use
-
-