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 Details

    • VitamError

      protected VitamError()
    • VitamError

      public VitamError(String code)
      VitamError constructor
      Parameters:
      code - the code used to identify this error object
  • Method Details

    • newVitamError

      public static <T> VitamError<T> newVitamError(Class<T> clasz)
    • setCode

      public VitamError<T> setCode(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 class RequestResponse<T>
      Parameters:
      httpCode - the httpCode to set
      Returns:
      this
    • setContext

      public VitamError<T> setContext(String context)
      Parameters:
      context - of error as String
      Returns:
      the VitamError object with the context is setted
    • setState

      public VitamError<T> setState(String state)
      Parameters:
      state - of error as String
      Returns:
      the VitamError object with the error state is setted
    • setMessage

      public VitamError<T> setMessage(String message)
      Parameters:
      message - of error as String
      Returns:
      the VitamError object with the error message is setted
    • setDescription

      public VitamError<T> setDescription(String description)
      Parameters:
      description - of error as String
      Returns:
      the VitamError object with the description error is setted
    • addAllErrors

      public VitamError<T> addAllErrors(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 String getCode()
      Returns:
      the code of the VitamError object
    • getContext

      public String getContext()
      Returns:
      the context of the VitamError object
    • getState

      public String getState()
      Returns:
      the state of the VitamError object
    • getMessage

      public String getMessage()
      Returns:
      the message of the VitamError object
    • getDescription

      public String getDescription()
      Returns:
      the description of the VitamError object
    • getErrors

      public 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, 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 class RequestResponse<T>
      Returns:
      Response
    • toStreamResponse

      public javax.ws.rs.core.Response toStreamResponse()
      transform a RequestResponse to a stream response
      Returns:
      Response