Class ValidationContext
java.lang.Object
de.captaingoldfish.scim.sdk.server.endpoints.validation.ValidationContext
- Since:
- 07.04.2021
- Author:
- Pascal Knueppel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadds an error that is not bound to a specific resource fieldvoidadds an error that is bound to a specific resource fieldvoidadds other more unspecific error messages to the context that are not directly related to any fieldsvoidadds specific field errors to the validation contextcontains errors that are not bound to any specific fieldscontains all error messages that are bound to a specific fieldintthe response status that should be returned to the client.the endpoint definition of the resource to validateadditional headers that may be returned in case of validation errorbooleanvoidlogs all reported errors on debug levelvoidsetHttpResponseStatus(int httpResponseStatus) the response status that should be returned to the client.voidwriteToErrorResponse(ErrorResponse errorResponse) adds the current errors of this validation context to the given error response
-
Constructor Details
-
ValidationContext
-
-
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
adds an error that is not bound to a specific resource field- Parameters:
errorMessage- the error message
-
addError
adds an error that is bound to a specific resource field- Parameters:
fieldName- the name of the field to which the error is bounderrorMessage- the error message
-
addExceptionMessages
adds specific field errors to the validation context- Parameters:
ex- the definition of the error that occurred
-
addExceptionMessages
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
adds the current errors of this validation context to the given error response -
getErrors
contains errors that are not bound to any specific fields -
getFieldErrors
contains all error messages that are bound to a specific field -
getResourceType
the endpoint definition of the resource to validate -
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
-