Package fr.gouv.vitam.common.error
Class VitamError
- java.lang.Object
-
- fr.gouv.vitam.common.model.RequestResponse
-
- fr.gouv.vitam.common.error.VitamError
-
public class VitamError extends RequestResponse
VitamError class
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VitamError()
VitamError(java.lang.String code)
VitamError constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VitamError
addAllErrors(java.util.List<VitamError> errors)
VitamError
addToErrors(VitamError error)
java.lang.String
getCode()
java.lang.String
getContext()
java.lang.String
getDescription()
java.util.List<VitamError>
getErrors()
static VitamError
getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node)
java.lang.String
getMessage()
java.lang.String
getState()
VitamError
setCode(java.lang.String code)
VitamError
setContext(java.lang.String context)
VitamError
setDescription(java.lang.String description)
VitamError
setHttpCode(int httpCode)
VitamError
setMessage(java.lang.String message)
VitamError
setState(java.lang.String state)
javax.ws.rs.core.Response
toResponse()
transform a RequestResponse to a standard responsejavax.ws.rs.core.Response
toStreamResponse()
transform a RequestResponse to a stream response-
Methods inherited from class fr.gouv.vitam.common.model.RequestResponse
addHeader, getHeaderString, getHttpCode, getStatus, getVitamHeaders, isOk, isRequestResponseOk, parseFromResponse, parseFromResponse, parseHeadersFromResponse, parseRequestResponseOk, parseVitamError, toJsonNode, toString, unSetVitamHeaders
-
-
-
-
Method Detail
-
setCode
public VitamError setCode(java.lang.String code)
- Parameters:
code
- of error as integer- Returns:
- the VitamError object with the code is setted
-
setHttpCode
public VitamError setHttpCode(int httpCode)
- Overrides:
setHttpCode
in classRequestResponse
- Parameters:
httpCode
- the httpCode to set- Returns:
- this
-
setContext
public VitamError setContext(java.lang.String context)
- Parameters:
context
- of error as String- Returns:
- the VitamError object with the context is setted
-
setState
public VitamError setState(java.lang.String state)
- Parameters:
state
- of error as String- Returns:
- the VitamError object with the error state is setted
-
setMessage
public VitamError setMessage(java.lang.String message)
- Parameters:
message
- of error as String- Returns:
- the VitamError object with the error message is setted
-
setDescription
public VitamError setDescription(java.lang.String description)
- Parameters:
description
- of error as String- Returns:
- the VitamError object with the description error is setted
-
addAllErrors
public VitamError addAllErrors(java.util.List<VitamError> errors)
- Parameters:
errors
- errors as List- Returns:
- the VitamError object with the list of errors is setted
-
addToErrors
public VitamError addToErrors(VitamError error)
- Parameters:
error
- one error- Returns:
- the VitamError object with the list of errors is setted
-
getCode
public java.lang.String getCode()
- Returns:
- the code of the VitamError object
-
getContext
public java.lang.String getContext()
- Returns:
- the context of the VitamError object
-
getState
public java.lang.String getState()
- Returns:
- the state of the VitamError object
-
getMessage
public java.lang.String getMessage()
- Returns:
- the message of the VitamError object
-
getDescription
public java.lang.String getDescription()
- Returns:
- the description of the VitamError object
-
getErrors
public java.util.List<VitamError> getErrors()
- Returns:
- the errors list of the VitamError object
-
getFromJsonNode
public static VitamError getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node) throws InvalidParseOperationException
- Parameters:
node
- of vitam error in format JsonNode- Returns:
- the corresponding VitamError
- Throws:
InvalidParseOperationException
- if parse JsonNode node exception occurred
-
toResponse
public javax.ws.rs.core.Response toResponse()
transform a RequestResponse to a standard response- Specified by:
toResponse
in classRequestResponse
- Returns:
- Response
-
toStreamResponse
public javax.ws.rs.core.Response toStreamResponse()
transform a RequestResponse to a stream response- Returns:
- Response
-
-