Class APIOperationResult

  • Direct Known Subclasses:
    APIEntityOperationResult, APIObjectOperationResult

    public class APIOperationResult
    extends Object
    A class representing the result of an API operation. It contains information about the success or failure of the operation, associated error messages, status codes, and reply codes.

    This class helps in encapsulating the result of an API operation and provides mechanisms for adding error and informational messages related to the operation.

    Instances of this class can be used to return a result from API operations that may either succeed or fail, with appropriate status and reply codes, along with messages detailing the result.

    • Constructor Summary

      Constructors 
      Constructor Description
      APIOperationResult​(boolean successfull, com.qivos.util.rest.common.APIStatusCode apiStatusCode)
      Constructs a successful APIOperationResult with a specified API status code.
      APIOperationResult​(boolean successfull, com.qivos.util.rest.common.APIStatusCode apiStatusCode, com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
      Constructs a result with the specified success flag, API status code, and reply code.
      APIOperationResult​(String error)
      Constructs an error result with a specified error message.
      APIOperationResult​(String error, com.qivos.util.rest.common.APIStatusCode errorStatusCode)
      Constructs an error result with a specified error message and API status code.
      APIOperationResult​(String error, com.qivos.util.rest.common.APIStatusCode errorStatusCode, com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
      Constructs an error result with a specified error message, API status code, and reply code.
      APIOperationResult​(String error, com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
      Constructs an error result with a specified error message and reply code.
      APIOperationResult​(List<String> errors)
      Constructs an error result with a list of error messages.
      APIOperationResult​(List<String> errors, com.qivos.util.rest.common.APIStatusCode errorStatusCode)
      Constructs an error result with a list of error messages and a specified error status code.
      APIOperationResult​(List<String> errors, com.qivos.util.rest.common.APIStatusCode errorStatusCode, com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
      Constructs an error result with a list of error messages, an error status code, and a reply code.
      APIOperationResult​(List<String> errors, com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
      Constructs an error result with a list of error messages and a reply code.
    • Constructor Detail

      • APIOperationResult

        public APIOperationResult​(boolean successfull,
                                  com.qivos.util.rest.common.APIStatusCode apiStatusCode)
        Constructs a successful APIOperationResult with a specified API status code.
        Parameters:
        successfull - A flag indicating whether the operation was successful.
        apiStatusCode - The status code of the API response.
      • APIOperationResult

        public APIOperationResult​(boolean successfull,
                                  com.qivos.util.rest.common.APIStatusCode apiStatusCode,
                                  com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Constructs a result with the specified success flag, API status code, and reply code.
        Parameters:
        successfull - A flag indicating whether the operation was successful.
        apiStatusCode - The status code of the API response.
        replyCode - The reply code associated with the API response.
      • APIOperationResult

        public APIOperationResult​(String error)
        Constructs an error result with a specified error message.
        Parameters:
        error - A string describing the error.
      • APIOperationResult

        public APIOperationResult​(String error,
                                  com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Constructs an error result with a specified error message and reply code.
        Parameters:
        error - A string describing the error.
        replyCode - The reply code associated with the error.
      • APIOperationResult

        public APIOperationResult​(List<String> errors)
        Constructs an error result with a list of error messages.
        Parameters:
        errors - A list of error messages describing the failure.
      • APIOperationResult

        public APIOperationResult​(List<String> errors,
                                  com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Constructs an error result with a list of error messages and a reply code.
        Parameters:
        errors - A list of error messages describing the failure.
        replyCode - The reply code associated with the error.
      • APIOperationResult

        public APIOperationResult​(String error,
                                  com.qivos.util.rest.common.APIStatusCode errorStatusCode)
        Constructs an error result with a specified error message and API status code.
        Parameters:
        error - A string describing the error.
        errorStatusCode - The status code of the API response.
      • APIOperationResult

        public APIOperationResult​(String error,
                                  com.qivos.util.rest.common.APIStatusCode errorStatusCode,
                                  com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Constructs an error result with a specified error message, API status code, and reply code.
        Parameters:
        error - A string describing the error.
        errorStatusCode - The status code of the API response.
        replyCode - The reply code associated with the error.
      • APIOperationResult

        public APIOperationResult​(List<String> errors,
                                  com.qivos.util.rest.common.APIStatusCode errorStatusCode)
        Constructs an error result with a list of error messages and a specified error status code.
        Parameters:
        errors - A list of error messages describing the failure.
        errorStatusCode - The status code of the API response.
      • APIOperationResult

        public APIOperationResult​(List<String> errors,
                                  com.qivos.util.rest.common.APIStatusCode errorStatusCode,
                                  com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Constructs an error result with a list of error messages, an error status code, and a reply code.
        Parameters:
        errors - A list of error messages describing the failure.
        errorStatusCode - The status code of the API response.
        replyCode - The reply code associated with the error.
    • Method Detail

      • getErrorMessages

        public List<String> getErrorMessages()
        Returns a list of error messages associated with the API operation.
        Returns:
        A list of error messages.
      • getError

        public String getError()
        Returns the first error message if available. If no errors exist, an empty string is returned.
        Returns:
        The first error message or an empty string if there are no errors.
      • addError

        public void addError​(String message)
        Adds a new error message to the list of error messages.
        Parameters:
        message - The error message to be added.
      • addErrors

        public void addErrors​(List<String> messages)
        Adds a list of error messages to the existing list of error messages.
        Parameters:
        messages - A list of error messages to be added.
      • getInfoMessages

        public List<String> getInfoMessages()
        Returns a list of informational messages associated with the API operation.
        Returns:
        A list of informational messages.
      • addInfoMessage

        public void addInfoMessage​(String message)
        Adds an informational message to the list of informational messages.
        Parameters:
        message - The informational message to be added.
      • addInfoMessages

        public void addInfoMessages​(List<String> messages)
        Adds a list of informational messages to the existing list of informational messages.
        Parameters:
        messages - A list of informational messages to be added.
      • isSuccessfull

        public boolean isSuccessfull()
        Returns whether the operation was successful.
        Returns:
        true if the operation was successful, otherwise false.
      • setSuccessfull

        public void setSuccessfull​(boolean successfull)
        Sets the success flag for the operation.
        Parameters:
        successfull - A flag indicating whether the operation was successful.
      • getErrorStatusCode

        public com.qivos.util.rest.common.APIStatusCode getErrorStatusCode()
        Returns the status code associated with the error, if any.
        Returns:
        The error status code.
      • getReplyCode

        public com.qivos.util.rest.common.envelope.APIReplyCode getReplyCode()
        Returns the reply code associated with the operation, if any.
        Returns:
        The reply code of the operation.
      • setReplyCode

        public void setReplyCode​(com.qivos.util.rest.common.envelope.APIReplyCode replyCode)
        Sets the reply code for the operation result.
        Parameters:
        replyCode - The reply code to be set.