Class VitamError<T>

    • Constructor Detail

      • VitamError

        protected VitamError()
      • VitamError

        public VitamError​(java.lang.String code)
        VitamError constructor
        Parameters:
        code - the code used to identify this error object
    • 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
      • 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 class RequestResponse<T>
        Returns:
        Response
      • toStreamResponse

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