com.isomorphic.rpc

## Class BaseResponse

- java.lang.Object
- - com.isomorphic.base.Base
  - - com.isomorphic.rpc.BaseResponse

- Direct Known Subclasses:
    DSResponse, RPCResponse

      public abstract class BaseResponse
      extends Base

  This is the base for all responses going through the rpc and DataSource layer in Smartclient Server. Both `DSResponse` and `RPCResponse` extend this class in order to function as expected in DataSources as well as other request processing. This class was introduced together with `DSTransaction` in order to ease the relationships between the request/response classes and the transaction layer.
  See Also:
    `BaseRequest`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `STATUS_AUTHORIZATION_FAILURE` Indicates that a authorization attempt failed.
    `static int` | `STATUS_FAILURE` Indicates a failure of some sort (generic).
    `static int` | `STATUS_FILE_NOT_FOUND` Indicates that a file has not been found.
    `static int` | `STATUS_LOGIN_INCORRECT` Indicates that a login attempt failed.
    `static int` | `STATUS_LOGIN_REQUIRED` Indicates that login is required.
    `static int` | `STATUS_LOGIN_SUCCESS` Indicates that a login attempt failed.
    `static int` | `STATUS_MAX_FILE_SIZE_EXCEEDED` Indicates that a maximum file size was exceeded for the request.
    `static int` | `STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED` Indicates that the maximum number of login attempts have been exceeded.
    `static int` | `STATUS_PROCESSING_SKIPPED` Indicates that request processing was skipped.
    `static int` | `STATUS_SUCCESS` Indicates successful completion of the request.
    `static int` | `STATUS_TRANSACTION_FAILED` Indicates a failure during a transactional request.
    `static int` | `STATUS_UPDATE_WITHOUT_PK` Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued.
    `static int` | `STATUS_VALIDATION_ERROR` Indicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors().
    `static int` | `UPDATE_WITHOUT_PK` Deprecated. Use `BaseResponse.STATUS_UPDATE_WITHOUT_PK` instead for naming consistency.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getStatus()` Retrieves the currently set status code for this response.
    `BaseResponse` | `setFailure()` Sets the status code to `BaseResponse.STATUS_FAILURE`.
    `BaseResponse` | `setStatus(int status)` Sets the status of this response.
    `BaseResponse` | `setSuccess()` Sets the status of this DSResponse to STATUS_SUCCESS.
    `boolean` | `statusIsError()` Returns true unless the currently status is STATUS_SUCCESS
    `boolean` | `statusIsSuccess()`

- - ### Field Detail

    - #### STATUS_SUCCESS

          public static final int STATUS_SUCCESS

      Indicates successful completion of the request. This is the default status and is automatically used by the RPCResponse unless you override it with setStatus().
      See Also:
        Constant Field Values

    - #### STATUS_FILE_NOT_FOUND

          public static final int STATUS_FILE_NOT_FOUND

      Indicates that a file has not been found.
      See Also:
        Constant Field Values

    - #### STATUS_AUTHORIZATION_FAILURE

          public static final int STATUS_AUTHORIZATION_FAILURE

      Indicates that a authorization attempt failed.
      See Also:
        Constant Field Values

    - #### STATUS_FAILURE

          public static final int STATUS_FAILURE

      Indicates a failure of some sort (generic).

      See the error handling doc section in RPCManager for information on how the client handles errors.

      See Also:
        Constant Field Values

    - #### STATUS_VALIDATION_ERROR

          public static final int STATUS_VALIDATION_ERROR

      Indicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors(). If the request was initiated by a databound component, the returned errors will be displayed next to the fields.

      This error code will automatically be set for you if you call setErrors() or addError().

      To instead indicate an unrecoverable error that does not have per-field error messages, set STATUS_FAILURE.

      See Also:
        Constant Field Values

    - #### STATUS_PROCESSING_SKIPPED

          public static final int STATUS_PROCESSING_SKIPPED

      Indicates that request processing was skipped. This is likely due to request processing being told to skip remaining requests in a transaction queue.
      See Also:
        Constant Field Values

    - #### STATUS_LOGIN_INCORRECT

          public static final int STATUS_LOGIN_INCORRECT

      Indicates that a login attempt failed.
      See Also:
        Constant Field Values

    - #### STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED

          public static final int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED

      Indicates that the maximum number of login attempts have been exceeded.
      See Also:
        Constant Field Values

    - #### STATUS_LOGIN_REQUIRED

          public static final int STATUS_LOGIN_REQUIRED

      Indicates that login is required.
      See Also:
        Constant Field Values

    - #### STATUS_LOGIN_SUCCESS

          public static final int STATUS_LOGIN_SUCCESS

      Indicates that a login attempt failed.
      See Also:
        Constant Field Values

    - #### UPDATE_WITHOUT_PK

          @Deprecated
          public static final int UPDATE_WITHOUT_PK

      Deprecated. Use `BaseResponse.STATUS_UPDATE_WITHOUT_PK` instead for naming consistency.
      Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued.
      See Also:
        Constant Field Values

    - #### STATUS_UPDATE_WITHOUT_PK

          public static final int STATUS_UPDATE_WITHOUT_PK

      Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued.
      See Also:
        Constant Field Values

    - #### STATUS_TRANSACTION_FAILED

          public static final int STATUS_TRANSACTION_FAILED

      Indicates a failure during a transactional request. This usually means that one of the requests involved in the transaction failed and you should have a look at that specific requests status code and error logs to determine why the whole transaction failed.
      See Also:
        Constant Field Values

    - #### STATUS_MAX_FILE_SIZE_EXCEEDED

          public static final int STATUS_MAX_FILE_SIZE_EXCEEDED

      Indicates that a maximum file size was exceeded for the request. This can happen if there is a maximum upload size specified and a file of larger size is sent through in the request.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getStatus

          public int getStatus()

      Retrieves the currently set status code for this response.

    - #### setStatus

          public BaseResponse setStatus(int status)

      Sets the status of this response. A zero status indicates succeess, a negative value indicates failure.

      Negative values will trigger error handling code on the client side - see the client-side reference for RPCManager.handleError(), rpcRequest.willHandleError.

      The default client-side behavior for a negative status code is that, if the data sent back (via setData()) is a String, it will be shown to the user in a warning dialog.

      Parameters:
        `status` - the status code for this response
      Returns:
        the RPCResponse

    - #### statusIsError

          public boolean statusIsError()

      Returns true unless the currently status is STATUS_SUCCESS
      Returns:
        false if status is STATUS_SUCCESS, false otherwise

    - #### statusIsSuccess

          public boolean statusIsSuccess()

      Returns:
        true if the currently set status code is STATUS_SUCCESS, false otherwise.

    - #### setSuccess

          public BaseResponse setSuccess()

      Sets the status of this DSResponse to STATUS_SUCCESS.
      Returns:
        the DSResponse

    - #### setFailure

          public BaseResponse setFailure()

      Sets the status code to `BaseResponse.STATUS_FAILURE`.
      Returns:
        the DSResponse