Package fr.gouv.vitam.common.error
Class VitamError<T>
- java.lang.Object
-
- fr.gouv.vitam.common.model.RequestResponse<T>
-
- fr.gouv.vitam.common.error.VitamError<T>
-
public class VitamError<T> extends RequestResponse<T>
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<T>
addAllErrors(java.util.List<VitamError<T>> errors)
VitamError<T>
addToErrors(VitamError<T> error)
java.lang.String
getCode()
java.lang.String
getContext()
java.lang.String
getDescription()
java.util.List<VitamError<T>>
getErrors()
static VitamError<com.fasterxml.jackson.databind.JsonNode>
getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node)
static <T> VitamError<T>
getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node, java.lang.Class<T> clasz)
java.lang.String
getMessage()
java.lang.String
getState()
static <T> VitamError<T>
newVitamError(java.lang.Class<T> clasz)
VitamError<T>
setCode(java.lang.String code)
VitamError<T>
setContext(java.lang.String context)
VitamError<T>
setDescription(java.lang.String description)
VitamError<T>
setHttpCode(int httpCode)
VitamError<T>
setMessage(java.lang.String message)
VitamError<T>
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, parseRequestResponseOk, parseVitamError, parseVitamError, toJsonNode, toString, unSetVitamHeaders
-
-
-
-
Method Detail
-
newVitamError
public static <T> VitamError<T> newVitamError(java.lang.Class<T> clasz)
-
setCode
public VitamError<T> setCode(java.lang.String code)
- Parameters:
code
- of error as integer- Returns:
- the VitamError object with the code is setted
-
setHttpCode
public VitamError<T> setHttpCode(int httpCode)
- Overrides:
setHttpCode
in classRequestResponse<T>
- Parameters:
httpCode
- the httpCode to set- Returns:
- this
-
setContext
public VitamError<T> setContext(java.lang.String context)
- Parameters:
context
- of error as String- Returns:
- the VitamError object with the context is setted
-
setState
public VitamError<T> setState(java.lang.String state)
- Parameters:
state
- of error as String- Returns:
- the VitamError object with the error state is setted
-
setMessage
public VitamError<T> setMessage(java.lang.String message)
- Parameters:
message
- of error as String- Returns:
- the VitamError object with the error message is setted
-
setDescription
public VitamError<T> setDescription(java.lang.String description)
- Parameters:
description
- of error as String- Returns:
- the VitamError object with the description error is setted
-
addAllErrors
public VitamError<T> addAllErrors(java.util.List<VitamError<T>> errors)
- Parameters:
errors
- errors as List- Returns:
- the VitamError object with the list of errors is setted
-
addToErrors
public VitamError<T> addToErrors(VitamError<T> 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<T>> getErrors()
- Returns:
- the errors list of the VitamError object
-
getFromJsonNode
public static <T> VitamError<T> getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node, java.lang.Class<T> clasz) throws InvalidParseOperationException
- Parameters:
node
- of vitam error in format JsonNode- Returns:
- the corresponding VitamError
- Throws:
InvalidParseOperationException
- if parse JsonNode node exception occurred
-
getFromJsonNode
public static VitamError<com.fasterxml.jackson.databind.JsonNode> 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<T>
- Returns:
- Response
-
toStreamResponse
public javax.ws.rs.core.Response toStreamResponse()
transform a RequestResponse to a stream response- Returns:
- Response
-
-