Class BaseResponse<T extends BaseResponse>

java.lang.Object
com.isomorphic.base.Base
com.isomorphic.rpc.BaseResponse<T>
All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
Direct Known Subclasses:
DSResponse, RPCResponse

public abstract class BaseResponse<T extends BaseResponse> extends com.isomorphic.base.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:
  • Field Details

    • 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:
    • STATUS_FILE_NOT_FOUND

      public static final int STATUS_FILE_NOT_FOUND
      Indicates that a file has not been found.
      See Also:
    • STATUS_AUTHORIZATION_FAILURE

      public static final int STATUS_AUTHORIZATION_FAILURE
      Indicates that a authorization attempt failed.
      See Also:
    • 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:
    • 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:
    • 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:
    • STATUS_LOGIN_INCORRECT

      public static final int STATUS_LOGIN_INCORRECT
      Indicates that a login attempt failed.
      See Also:
    • 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:
    • STATUS_LOGIN_REQUIRED

      public static final int STATUS_LOGIN_REQUIRED
      Indicates that login is required.
      See Also:
    • STATUS_LOGIN_SUCCESS

      public static final int STATUS_LOGIN_SUCCESS
      Indicates that a login attempt failed.
      See Also:
    • UPDATE_WITHOUT_PK

      @Deprecated public static final int UPDATE_WITHOUT_PK
      Deprecated.
      Use 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:
    • 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:
    • 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:
    • 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:
    • STATUS_REQUIRED_CRITERIA_MISSING

      public static final int STATUS_REQUIRED_CRITERIA_MISSING
      Indicates that an operation binding configured to require requiredCriterion has received none.
      See Also:
    • STATUS_FILE_REQUIRED_ERROR

      public static final int STATUS_FILE_REQUIRED_ERROR
      Indicates that a file has not been specified.
      See Also:
  • Method Details

    • getStatus

      public int getStatus()
      Retrieves the currently set status code for this response.
    • setStatus

      public T 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 T setSuccess()
      Sets the status of this DSResponse to STATUS_SUCCESS.
      Returns:
      the DSResponse
    • setFailure

      public T setFailure()
      Sets the status code to STATUS_FAILURE.
      Returns:
      the DSResponse