public class DSResponse extends RPCResponse
DataSource request
. Contains
all the properties available on the basic RPCResponse
, in addition to the properties
listed here.INVALID_RESPONSE_FORMAT, STATUS_AUTHORIZATION_FAILURE, STATUS_CONNECTION_RESET_ERROR, STATUS_CRITERIA_REQUIRED_ERROR, STATUS_FAILURE, STATUS_FILE_REQUIRED_ERROR, STATUS_LOGIN_INCORRECT, STATUS_LOGIN_REQUIRED, STATUS_LOGIN_SUCCESS, STATUS_MAX_FILE_SIZE_EXCEEDED, STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED, STATUS_MAX_POST_SIZE_EXCEEDED, STATUS_OFFLINE, STATUS_REQUIRED_CRITERIA_MISSING, STATUS_SERVER_TIMEOUT, STATUS_SUCCESS, STATUS_TRANSACTION_FAILED, STATUS_TRANSPORT_ERROR, STATUS_UNKNOWN_HOST_ERROR, STATUS_UPDATE_WITHOUT_PK_ERROR, STATUS_VALIDATION_ERROR
id
factoryCreated, factoryProperties
Constructor and Description |
---|
DSResponse() |
DSResponse(com.google.gwt.core.client.JavaScriptObject jsObj) |
DSResponse(java.lang.String dataSource) |
DSResponse(java.lang.String dataSource,
DSOperationType operationType) |
DSResponse(java.lang.String dataSource,
DSOperationType operationType,
Record... data) |
Modifier and Type | Method and Description |
---|---|
Record[] |
getData()
For "fetch" operations, this is the array of Records fetched.
|
RecordList |
getDataAsRecordList()
For "fetch" operations, this is the array of Records fetched.
|
java.lang.String |
getDataSource()
The DataSource of this DSResponse.
|
java.lang.Integer |
getEndRow()
End row of returned server results, when using paged result fetching
|
java.util.Map |
getErrors()
Server-side validation errors for an attempted "update" or "add" operation, as a JS Object where each property
name is a field name from the record and each property value is an error message to be shown to the user.
|
java.lang.String |
getEstimatedTotalRows()
This attribute may be set for responses where
progressive loading is active to indicate the estimated true total row count for the data set. |
java.lang.Boolean |
getFromOfflineCache()
If set, indicates that this response came from the offline cache, not the server.
|
java.util.Map |
getHttpHeaders()
HTTP headers returned by the server as a map from header name to header value.
|
java.lang.Boolean |
getInvalidateCache()
Optional flag that can be set by the server to force ResultSets to drop any caches of records from the DataSource that
was the target of the operation.
|
java.lang.Integer |
getOfflineTimestamp()
Timestamp (millisecond value) to indicate when this dsResponse was cached in
offline storage . |
java.lang.String |
getOperationId()
The operation ID of the request corresponding to this DSResponse.
|
DSOperationType |
getOperationType()
The operation type of the request corresponding to this DSResponse.
|
static DSResponse |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
java.lang.Boolean |
getProgressiveLoading()
This attribute may be set to indicate that
progressive
loading is enabled , for a paged data fetch, and as such the total row count is not guaranteed to be accurate. |
int |
getQueueStatus()
An extra property of each DSResponse to a queued request that indicates whether the queue as a whole succeeded.
|
java.lang.Integer |
getStartRow()
Starting row of returned server results, when using paged result fetching
|
int |
getStatus()
Same meaning as
RPCResponse.status , except DSResponses have
additional error codes, such as validation failure . |
java.lang.Integer |
getTotalRows()
Total number of rows available from the server that match the current filter criteria, when using paged result fetching.
|
void |
setData(Record... data)
For "fetch" operations, this is the array of Records fetched.
|
DSResponse |
setDataSource(java.lang.String dataSource)
The DataSource of this DSResponse.
|
void |
setEndRow(java.lang.Integer endRow)
End row of returned server results, when using paged result fetching
|
void |
setErrors(com.google.gwt.core.client.JavaScriptObject errors)
Server-side validation errors for an attempted "update" or "add" operation, as a JS Object where each property
name is a field name from the record and each property value is an error message to be shown to the user.
|
void |
setErrors(java.util.Map errors)
Server-side validation errors for an attempted "update" or "add" operation, as a JS Object where each property
name is a field name from the record and each property value is an error message to be shown to the user.
|
void |
setInvalidateCache(java.lang.Boolean invalidateCache)
Optional flag that can be set by the server to force ResultSets to drop any caches of records from the DataSource
that was the target of the operation.
|
DSResponse |
setOperationId(java.lang.String operationId)
The operation ID of the request corresponding to this DSResponse.
|
DSResponse |
setOperationType(DSOperationType operationType)
The operation type of the request corresponding to this DSResponse.
|
DSResponse |
setQueueStatus(int queueStatus)
An extra property of each DSResponse to a queued request that indicates whether the queue as a whole succeeded.
|
void |
setStartRow(java.lang.Integer startRow)
Starting row of returned server results, when using paged result fetching
|
DSResponse |
setStatus(int status)
Same meaning as
RPCResponse.status , except DSResponses have
additional error codes, such as validation failure . |
void |
setTotalRows(java.lang.Integer totalRows)
Total number of rows available from the server that match the current filter criteria, when using paged result
fetching.
|
create, getDataAsMap, getDataAsObject, getDataAsString, getHttpResponseCode, getHttpResponseText, getTransactionNum, isDSResponse
getRef, getRef, internalSetID
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
public DSResponse()
public DSResponse(com.google.gwt.core.client.JavaScriptObject jsObj)
public DSResponse(java.lang.String dataSource)
public DSResponse(java.lang.String dataSource, DSOperationType operationType)
public DSResponse(java.lang.String dataSource, DSOperationType operationType, Record... data)
public static DSResponse getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public Record[] getData()
public RecordList getDataAsRecordList()
public DSResponse setDataSource(java.lang.String dataSource)
dataSource
- New dataSource value. Default value is nullDSResponse
instance, for chaining setter callspublic java.lang.String getDataSource()
public java.lang.Integer getEndRow()
Note that startRow and endRow are zero-based, inclusive at the beginning and exclusive at the end (like substring), so startRow: 0, endRow: 2 is a response containing two records.
public java.lang.String getEstimatedTotalRows()
progressive loading
is active to indicate the estimated true total row count for the data set. In progressive loading
mode, totalRows
can be thought of as an indication of the last
row the user is allowed to request (EG by scrolling through a databound ListGrid), whereas
estimatedTotalRows
can convey the server's knowledge of the number of matching rows to the client. This value may be validly set to a String in the following format:
DataSource.progressiveLoadingThreshold
feature, this property will be populated automatically to an exact value if a row count query was performed and the
result exceeded the progressiveLoadingThreshold causing progressiveLoading to be enabled. Developers may also write custom dataSource logic to populate this attribute if desired
public java.lang.Boolean getFromOfflineCache()
public java.util.Map getHttpHeaders()
Headers are available only when the
default RPCTransport
"xmlHttpRequest" is in use, and browsers may limit access to
headers for cross-domain requests or in other security-sensitive scenarios.
getHttpHeaders
in class RPCResponse
public java.lang.Boolean getInvalidateCache()
Automatic Cache Synchronization
public java.lang.Integer getOfflineTimestamp()
offline storage
. Not applicable if the response has never been stored offline.public DSResponse setOperationId(java.lang.String operationId)
operationId
- New operationId value. Default value is nullDSResponse
instance, for chaining setter callspublic java.lang.String getOperationId()
public DSResponse setOperationType(DSOperationType operationType)
operationType
- New operationType value. Default value is nullDSResponse
instance, for chaining setter callspublic DSOperationType getOperationType()
public java.lang.Boolean getProgressiveLoading()
progressive
loading is enabled
, for a paged data fetch, and as such the total row count
is not guaranteed to be accurate. Client side code, including the ResultSet.lengthIsProgressive()
method may make use of this
attribute. The Smart GWT server will automatically set this property whenever progressive loading is enabled. Developers may also set this property themselves for custom progressive loading implementations.
public DSResponse setQueueStatus(int queueStatus)
STATUS_SUCCESS
, or 0, indicates that the queue
succeeded whereas a queueStatus of STATUS_FAILURE
, or -1,
indicates that the queue failed. For example, if two "update" requests are sent in a queue and the first succeeded,
but the second failed validation, then both DSResponses' queueStatus would be -1, but the status
of the first would be STATUS_SUCCESS
and the status of the second would be an error code
such as STATUS_VALIDATION_ERROR
.
queueStatus
- New queueStatus value. Default value is see belowDSResponse
instance, for chaining setter callsError Handling Overview
public int getQueueStatus()
STATUS_SUCCESS
, or 0, indicates that the queue
succeeded whereas a queueStatus of STATUS_FAILURE
, or -1,
indicates that the queue failed. For example, if two "update" requests are sent in a queue and the first succeeded,
but the second failed validation, then both DSResponses' queueStatus would be -1, but the status
of the first would be STATUS_SUCCESS
and the status of the second would be an error code
such as STATUS_VALIDATION_ERROR
.
Error Handling Overview
public java.lang.Integer getStartRow()
Note that startRow and endRow are zero-based, inclusive at the beginning and exclusive at the end (like substring), so startRow: 0, endRow: 2 is a response containing two records.
public DSResponse setStatus(int status)
RPCResponse.status
, except DSResponses have
additional error codes, such as validation failure
.setStatus
in class RPCResponse
status
- New status value. Default value is see belowDSResponse
instance, for chaining setter callsError Handling Overview
public int getStatus()
RPCResponse.status
, except DSResponses have
additional error codes, such as validation failure
.getStatus
in class RPCResponse
Error Handling Overview
public java.lang.Integer getTotalRows()
public void setStartRow(java.lang.Integer startRow)
Note that startRow and endRow are zero-based - the first record is row zero.
startRow
- the start rowpublic void setEndRow(java.lang.Integer endRow)
Note that startRow and endRow are zero-based - the first record is row zero.
endRow
- the end rowpublic void setTotalRows(java.lang.Integer totalRows)
totalRows
- total rowspublic void setInvalidateCache(java.lang.Boolean invalidateCache)
invalidateCache
- invalidateCachepublic void setErrors(java.util.Map errors)
dsResponse.errors = { userId : "A user with this userId already exists", orderId : "No Order with ID '6A18294' exists" }The Java API DSResponse.addError(fieldName, errorMessage) is used to send server-side errors to the client. See the Java Server Reference for details.
errors
- errors mappublic void setErrors(com.google.gwt.core.client.JavaScriptObject errors)
dsResponse.errors = { userId : "A user with this userId already exists", orderId : "No Order with ID '6A18294' exists" }The Java API DSResponse.addError(fieldName, errorMessage) is used to send server-side errors to the client. See the Java Server Reference for details.
errors
- errors as JavaScriptObjectpublic void setData(Record... data)
data
- data Default value is nullpublic java.util.Map getErrors()
{ userId : ["A user with this userId already exists"], orderId : ["Must be a numeric value", "No Order with ID '6A18294' exists"] }The Java API DSResponse.addError(fieldName, errorMessage) is used to send server-side errors to the client. See the Java Server Reference for details.