T
- Type of Objects that will be converted to Ext.data.Records by the client-side Ext.data.DataReader.public class JsonReaderResponse<T> extends Object
{ root : 'records', successProperty : 'success', // same as default. messageProperty : 'message', totalProperty : 'totalRecords' }If the parameterized type has two properties "field1" and "field2", then when an instance of this class is read by the client and there are 100 records in total to page through, it will look like:
{ records : [ { field1 : 'value', field2 : 'value', }, { field1 : 'value', field2 : 'value', } ], success : true, totalRecords : 100, // Only needed if you are paging. message : "Yay!" // optional. }Note that for Gemma, 'success' is rarely all that useful because even though DWR will always (?) return a 200, the error handler gets called.
Modifier and Type | Field and Description |
---|---|
String |
message |
Collection<T> |
records |
boolean |
success |
long |
totalRecords |
Constructor and Description |
---|
JsonReaderResponse(Collection<T> objectsToConvertToRecords,
long totalRecords)
Use for remote paging applications.
|
JsonReaderResponse(List<T> objectsToConvertToRecords)
Creates a successful JsonReaderResponse with the provided objectsToConvertToRecords.
|
JsonReaderResponse(String message)
|
Modifier and Type | Method and Description |
---|---|
String |
getMessage() |
Collection<T> |
getRecords() |
long |
getTotalRecords() |
boolean |
isSuccess() |
void |
setMessage(String message) |
void |
setRecords(List<T> records) |
void |
setSuccess(boolean success) |
void |
setTotalRecords(long totalRecords) |
public String message
public Collection<T> records
public boolean success
public long totalRecords
public JsonReaderResponse(List<T> objectsToConvertToRecords)
public JsonReaderResponse(Collection<T> objectsToConvertToRecords, long totalRecords)
success
ful JsonReaderResponse with the provided objectsToConvertToRecords.objectsToConvertToRecords
- objects to converttotalRecords
- total recordspublic JsonReaderResponse(String message)
success
ful JsonReaderResponse with null records
. This signals the case where the
client established a connection with the server, but the server couldn't fulfill it (e.g., user doesn't have
proper user credentials).message
- an error message to give to the client.public String getMessage()
public void setMessage(String message)
message
- the message to setpublic Collection<T> getRecords()
public long getTotalRecords()
public void setTotalRecords(long totalRecords)
totalRecords
- the totalRecords to setpublic boolean isSuccess()
public void setSuccess(boolean success)
success
- the success to setCopyright © 2005–2023 Pavlidis lab, Michael Smith Laboratories and Department of Psychiatry, University of British Columbia. All rights reserved.