java.lang.Object
de.captaingoldfish.scim.sdk.server.endpoints.validation.ValidationContext

public class ValidationContext extends Object
Since:
07.04.2021
Author:
Pascal Knueppel
  • Constructor Details

    • ValidationContext

      public ValidationContext(ResourceType resourceType)
  • Method Details

    • hasErrors

      public boolean hasErrors()
      Returns:
      true if any errors have been set, false else
    • logErrors

      public void logErrors()
      logs all reported errors on debug level
    • addError

      public void addError(String errorMessage)
      adds an error that is not bound to a specific resource field
      Parameters:
      errorMessage - the error message
    • addError

      public void addError(String fieldName, String errorMessage)
      adds an error that is bound to a specific resource field
      Parameters:
      fieldName - the name of the field to which the error is bound
      errorMessage - the error message
    • addExceptionMessages

      public void addExceptionMessages(AttributeValidationException ex)
      adds specific field errors to the validation context
      Parameters:
      ex - the definition of the error that occurred
    • addExceptionMessages

      public void addExceptionMessages(ScimException ex)
      adds other more unspecific error messages to the context that are not directly related to any fields
      Parameters:
      ex - the definition of the error that occurred
    • writeToErrorResponse

      public void writeToErrorResponse(ErrorResponse errorResponse)
      adds the current errors of this validation context to the given error response
    • getErrors

      public List<String> getErrors()
      contains errors that are not bound to any specific fields
    • getFieldErrors

      public Map<String,List<String>> getFieldErrors()
      contains all error messages that are bound to a specific field
    • getResourceType

      public ResourceType getResourceType()
      the endpoint definition of the resource to validate
    • getResponseHttpHeaders

      public Map<String,String> getResponseHttpHeaders()
      additional headers that may be returned in case of validation error
    • getHttpResponseStatus

      public int getHttpResponseStatus()
      the response status that should be returned to the client. Is bad request (400) by default
    • setHttpResponseStatus

      public void setHttpResponseStatus(int httpResponseStatus)
      the response status that should be returned to the client. Is bad request (400) by default