com.isomorphic.datasource
Class DSResponse

com.isomorphic.datasource.DSResponse

public class DSResponse

Response object to be populated by server-side code responding to a DSRequest.


Field Summary
static int STATUS_FAILURE
          Indicates a total failure of the request.
static int STATUS_SUCCESS
          Indicates successful completion of the request.
static int STATUS_VALIDATION_ERROR
          This error code indicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors().
 
Constructor Summary
DSResponse()
          Creates an empty DSResponse.
DSResponse(DataSource dataSource)
          Creates a DSResponse with the specified dataSource.
DSResponse(DataSource dataSource, int status)
          Creates a DSResponse with the specified dataSource and status code.
DSResponse(DataSource dataSource, java.lang.Object data)
          Creates a DSResponse with the specified dataSource and data payload
DSResponse(DataSource dataSource, java.lang.Object data, int status)
          Creates a DSResponse with the specified dataSource, data payload and status code.
DSResponse(int status)
          Creates a DSResponse with the specified status code.
DSResponse(java.lang.Object data)
          Creates a DSResponse with the specified data payload.
DSResponse(java.lang.Object data, int status)
          Creates a DSResponse with the specified data payload and status code.
 
Method Summary
 DSResponse addError(java.lang.String fieldName, ErrorMessage errorMessage)
          Adds an ErrorMessage to the ErrorReport for this DSResponse.
 DSResponse addError(java.lang.String fieldName, java.lang.String errorMessage)
          Adds an ErrorMessage to the ErrorReport for this DSResponse.
 DSResponse addRelatedUpdate(DSResponse relatedUpdate)
          Causes client-side components to react as though the provided DSResponse had just successfully completed.
 long getAffectedRows()
          For operations that modify data, this method returns the number of rows affected by the change.
 java.lang.Boolean getBypassDataFilter()
          This method returns true if this DSResponse will bypass the normal data filter pipeline (i.e dropExtraFields, valueXPath evaluation, etc) and simply serialize the provided data to the client.
 java.lang.Object getData()
          Returns the data object originally set by setData()
 java.util.List getDataList()
          Convenience method to return the data object originally set by setData(), as a List.
 java.util.Map getDataMap()
          Convenience method to return the data object originally set by setData(), as a Map.
 DataSource getDataSource()
          Returns the currently set DataSource.
 java.lang.Boolean getDropExtraFields()
          This method returns true if this DSResponse will automatically trim the fields in its data member to just those fields declared in the DataSource.
 long getEndRow()
          Returns the endRow for this DSResponse.
 ErrorReport getErrorReport()
          Returns the current ErrorReport.
 java.lang.Object getExportObject(DSRequest dsRequest)
          Returns the Java object encapsulating the exported data in a format suitable for directly loading into Microsoft Excel.
 java.io.OutputStream getExportTo()
          Returns the OuputStream we will use for data export.
 java.lang.Object getFieldValue(java.lang.String fieldName)
          Returns the value of the field name provided in this dsResponse's data member.
 boolean getInvalidateCache()
          Returns the current value of invalidateCache
 java.lang.String getOperationType()
          Returns the operationType associated with this DSResponse.
 java.lang.Object getProperty(java.lang.String key)
          Returns an arbitrary property of the DSResponse that has previously been set with DSResponse.setProperty(String, Object)
 java.util.Map getRecord()
          Returns the DSResponse's data member in "record" format (ie, as a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater).
 java.util.List getRecords()
          Returns the DSResponse's data member as a list of maps in "record" format (ie, each entry in the list is a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater).
 java.util.List getRecords(ValidationContext vc)
          Returns the DSResponse's data member as a list of maps in "record" format (ie, each entry in the list is a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater).
 java.util.List getRelatedUpdates()
          Gets list of related updates previously added to this response.
 long getStartRow()
          Returns the startRow for this DSResponse.
 int getStatus()
          Returns the currently set status code.
 long getTotalRows()
          Returns the totalRows for this DSResponse.
 DSResponse setBypassDataFilter(java.lang.Boolean value)
          This method sets the DSResponse's behavior with regard to the normal data filter pipeline (i.e dropExtraFields, valueXPath evaluation, etc).
 DSResponse setData(java.lang.Object data)
          Sets the data to satisfy the DataSource request.
 DSResponse setDataSource(DataSource dataSource)
          Sets the DataSource associated with this DSResponse.
 DSResponse setDropExtraFields(java.lang.Boolean value)
          This method sets the DSResponse's behavior with regard to extra fields in the data it returns.
 DSResponse setEndRow(long endRow)
          If the DSRequest specified an endRow, then the DSResponse should return the actual endRow for the response.
 DSResponse setErrorReport(ErrorReport errorReport)
          Sets the ErrorReport for this DSResponse
 DSResponse setExportObject(java.lang.Object exportObject)
          Set the export object on the DSResponse.
 DSResponse setExportTo(java.io.OutputStream exportOutputStream)
          Sets the OuputStream we will use for data export (this means exports to CSV, XML, JSON and Excel formats; PDF exports are "content exports" and are different).
 DSResponse setFailure()
          Sets the status code to STATUS_FAILURE.
 DSResponse setFailure(java.lang.String message)
          Sets the status code to STATUS_FAILURE and provides an error message to be shown to the user.
 DSResponse setInvalidateCache(boolean invalidateCache)
          Setting invalidateCache to true triggers the client-side ResultSet to drop its existing cache.
 DSResponse setOperationType(java.lang.String value)
          Set the operationType associated with this DSResponse.
 DSResponse setProperty(java.lang.String key, java.lang.Object value)
          Set an arbitrary property of the DSResponse, so that the value will be visible to custom JavaScript code on the client-side DSResponse object.
 DSResponse setStartRow(long startRow)
          If the DSRequest specified a startRow, then the DSResponse should return the actual startRow for the response.
 DSResponse setStatus(int status)
          Sets the status of this DSResponse.
 DSResponse setSuccess()
          Sets the status of this DSResponse to STATUS_SUCCESS.
 DSResponse setTotalRows(long totalRows)
          If the DSRequest sent a paged request (see DSRequest.isPaged()) and the total number of records available to be sent to the client given the provided criteria is greater than the requested size, then you should provide the total number of rows that actually matched the provided criteria.
 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 DSResponse unless you override it with setStatus().


STATUS_FAILURE

public static final int STATUS_FAILURE
Indicates a total failure of the request.

To instead signal that individual data values have errors, use STATUS_VALIDATION_ERROR.

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


STATUS_VALIDATION_ERROR

public static final int STATUS_VALIDATION_ERROR
This error code 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.

Constructor Detail

DSResponse

public DSResponse()
Creates an empty DSResponse. Status code defaults to STATUS_SUCCESS


DSResponse

public DSResponse(int status)
Creates a DSResponse with the specified status code.

Parameters:
status - the status code (one of the static STATUS_* codes on this class)

DSResponse

public DSResponse(java.lang.Object data)
Creates a DSResponse with the specified data payload.

Parameters:
data - the payload of the response - equivalent to setData()

DSResponse

public DSResponse(java.lang.Object data,
                  int status)
Creates a DSResponse with the specified data payload and status code.

Parameters:
data - the payload of the response - equivalent to setData()
status - the status code (one of the static STATUS_* codes on this class)
See Also:
DSResponse.setData(java.lang.Object), DSResponse.setStatus(int)

DSResponse

public DSResponse(DataSource dataSource)
Creates a DSResponse with the specified dataSource.

Parameters:
dataSource - the DataSource associated with this DSResponse
See Also:
DSResponse.setDataSource(com.isomorphic.datasource.DataSource)

DSResponse

public DSResponse(DataSource dataSource,
                  int status)
Creates a DSResponse with the specified dataSource and status code.

Parameters:
dataSource - the DataSource associated with this DSResponse
status - the status code (one of the static STATUS_* codes on this class)
See Also:
DSResponse.setDataSource(com.isomorphic.datasource.DataSource), DSResponse.setStatus(int)

DSResponse

public DSResponse(DataSource dataSource,
                  java.lang.Object data)
Creates a DSResponse with the specified dataSource and data payload

Parameters:
dataSource - the DataSource associated with this DSResponse
data - the payload of the response - equivalent to setData()
See Also:
DSResponse.setDataSource(com.isomorphic.datasource.DataSource), DSResponse.setData(java.lang.Object), DSResponse.setStatus(int)

DSResponse

public DSResponse(DataSource dataSource,
                  java.lang.Object data,
                  int status)
Creates a DSResponse with the specified dataSource, data payload and status code.

Parameters:
dataSource - the DataSource associated with this DSResponse
data - the payload of the response - equivalent to setData()
status - the status code (one of the static STATUS_* codes on this class)
See Also:
DSResponse.setDataSource(com.isomorphic.datasource.DataSource), DSResponse.setData(java.lang.Object), DSResponse.setStatus(int)
Method Detail

getOperationType

public java.lang.String getOperationType()
Returns the operationType associated with this DSResponse.

Returns:
the DSResponse's operationType, or null if it is unset

setOperationType

public DSResponse setOperationType(java.lang.String value)
Set the operationType associated with this DSResponse.

Parameters:
value - the operationType
Returns:
the DSResponse

setProperty

public DSResponse setProperty(java.lang.String key,
                              java.lang.Object value)
Set an arbitrary property of the DSResponse, so that the value will be visible to custom JavaScript code on the client-side DSResponse object.

The value parameter will be translated to JavaScript by the JSTranslater.

For example, if you were to call:

    dsResponse.setProperty("totalRowsIsApproximate", new Boolean(true));
 
JavaScript code on the client could then access "dsResponse.totalsRowsIsApproximate" from any method that receives the DSResponse, eg, DataSource.transformResponse().

This API is easily misused. setProperty should only be used to pass metadata about the request, similar to the existing DSResponse properties like startRow/endRow and status. The following are bad patterns:

Returns:
the DSResponse

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns an arbitrary property of the DSResponse that has previously been set with DSResponse.setProperty(String, Object)

Parameters:
key - the key of the property to return
Returns:
The value of the requested proeprty, or null if it has never been set

getBypassDataFilter

public java.lang.Boolean getBypassDataFilter()
This method returns true if this DSResponse will bypass the normal data filter pipeline (i.e dropExtraFields, valueXPath evaluation, etc) and simply serialize the provided data to the client.

Returns:
Boolean.TRUE if this DSResponse will bypass extra fields; otherwise Boolean.FALSE
See Also:
DSResponse.setBypassDataFilter(java.lang.Boolean)

setBypassDataFilter

public DSResponse setBypassDataFilter(java.lang.Boolean value)
This method sets the DSResponse's behavior with regard to the normal data filter pipeline (i.e dropExtraFields, valueXPath evaluation, etc).
One use case for this flag is to suppress automatic valueXPath derivation on the response in cases where you have postprocessing logic that has already converted the response into client-consumable records.

Returns:
the DSResponse
See Also:
DSResponse.getBypassDataFilter(), DSResponse.setData(java.lang.Object)

getDropExtraFields

public java.lang.Boolean getDropExtraFields()
This method returns true if this DSResponse will automatically trim the fields in its data member to just those fields declared in the DataSource. This is the default for normal, non-custom DataSource operations.

Returns:
Boolean.TRUE if this DSResponse will drop extra fields; otherwise Boolean.FALSE
See Also:
DSResponse.setDropExtraFields(java.lang.Boolean)

setDropExtraFields

public DSResponse setDropExtraFields(java.lang.Boolean value)
This method sets the DSResponse's behavior with regard to extra fields in the data it returns. If set to true, only the fields declared in the DataSource will be returned by the DSResponse; all other fields will be automatically trimmed off. If set to false, the DSResponse will return all fields.

Returns:
the DSResponse
See Also:
DSResponse.getDropExtraFields(), DSResponse.setData(java.lang.Object)

getAffectedRows

public long getAffectedRows()
For operations that modify data, this method returns the number of rows affected by the change. This is set by the built-in ISC datasources.

Returns:
number of affected rows

getInvalidateCache

public boolean getInvalidateCache()
Returns the current value of invalidateCache

Returns:
current value of invalidateCache

setInvalidateCache

public DSResponse setInvalidateCache(boolean invalidateCache)
Setting invalidateCache to true triggers the client-side ResultSet to drop its existing cache. If you set invalidateCache to an update operation, a new cache will be requested by the ResultSet.

Parameters:
invalidateCache - new value for invalidateCache

setData

public DSResponse setData(java.lang.Object data)
Sets the data to satisfy the DataSource request.

The object passed to setData() is translated to JavaScript via the JSTranslater class. The expected return data varies by operationType and is described in terms of the JavaScript result (see below) - anything that will be translated to the appropriate JavaScript result is acceptable. Compare all the data formats you can readily retrieve against the capabilities of the JSTranslater. Common options are to pass an XML document fragment or a Collection of Java Beans.

If the operationType is DataSource.OP_FETCH, then the data is expected to be an Array of JavaScript Objects matching the criteria specified in the DSRequest.

If the operationType is DataSource.OP_UPDATE, then the data is expected to be a JavaScript Object reflecting the updated record as stored.

If the operationType is DataSource.OP_ADD, then the data is expected to be a JavaScript Object reflecting the added record as stored.

If the operationType is DataSource.OP_REMOVE, then the data is expected to be at least the primary key fields of the removed record, an as JavaScript Object. A complete record is also acceptable.

DSResponses or DSResponse data returned by DMI methods is, by default, automatically filtered to just the set of fields defined on the DataSource. You can override this default in several ways - see the DMI overview in the SmartClient Reference documentation for a full description. For backwards compatibility, non-DMI DSResponses are not filtered in this manner. If you want to enable this filtering for non-DMI responses, you can do so by setting the config parameter DSResponse.dropExtraFields to true in [webroot]/WEB-INF/classes/server.properties. Note that per-DataSource overrides specified by the dropExtraFields setting on the DataSource will still apply in this case. Note that DMI.dropExtraFields and DSResponse.dropExtraFields can be enabled/disabled independently of each other - that is, setting one does not side-effect the other.

Also, all data objects are automatically filtered through a DataSourceBeanFilter to resolve valueXPaths specified on the DataSource fields. Search the client-side reference for 'valueXPath' for more information on this mechanism.

Parameters:
data - the data
Returns:
the DSResponse
See Also:
JSTranslater.toJS(Object, Writer), JSONFilter, com.isomorphic.ds.DataSourceBeanFilter

getDataList

public java.util.List getDataList()
Convenience method to return the data object originally set by setData(), as a List. If the data object is a List, the object is returned; if the data object is a JSONFilter and the wrapped object inside the JSONFilter is a List, the wrapped object is returned. In all other circumstances, this method returns null.

Returns:
the data object as originally set by setData(), as a List
See Also:
DSResponse.getData(), DSResponse.getDataMap()

getDataMap

public java.util.Map getDataMap()
Convenience method to return the data object originally set by setData(), as a Map. If the data object is a Map, the object is returned; if the data object is actually a List but the first entry in that List is a Map, the first entry in the List is returned. If the data object is a JSONFilter wrapping a Map or a List with a Map in its first entry, this method returns the wrapped Map or the first List entry, as appropriate. In all other circumstances, this method returns null.

Returns:
the data object as originally set by setData(), as a Map
See Also:
DSResponse.getData(), DSResponse.getDataList()

getData

public java.lang.Object getData()
Returns the data object originally set by setData()

Returns:
the data object as originally set by setData()
See Also:
DSResponse.setData(Object)

getStartRow

public long getStartRow()
Returns the startRow for this DSResponse.

Returns:
current value for startRow. If unset, returns -1.

setStartRow

public DSResponse setStartRow(long startRow)
If the DSRequest specified a startRow, then the DSResponse should return the actual startRow for the response. Note that will not necessarily be the same value as requested. It may be different if the underlying data has changed since the client last made a request.

Note that startRow and endRow are zero-based - the first record is row zero.

Parameters:
startRow - new value for startRow
Returns:
the DSResponse

getEndRow

public long getEndRow()
Returns the endRow for this DSResponse.

Returns:
current value for endRow. If unset, returns -1.

setEndRow

public DSResponse setEndRow(long endRow)
If the DSRequest specified an endRow, then the DSResponse should return the actual endRow for the response. Note that will not necessarily be the same value as requested. It may be different if the underlying data has changed since the client last made a request.

Note that startRow and endRow are zero-based - the first record is row zero.

If startRow is currently greater than endRow, it will be reduced to a maximum of endRow (or 0).

Parameters:
endRow - new value for endRow
Returns:
the DSResponse

getTotalRows

public long getTotalRows()
Returns the totalRows for this DSResponse.

Returns:
current value for totalRows. If unset, returns -1.

setTotalRows

public DSResponse setTotalRows(long totalRows)
If the DSRequest sent a paged request (see DSRequest.isPaged()) and the total number of records available to be sent to the client given the provided criteria is greater than the requested size, then you should provide the total number of rows that actually matched the provided criteria. This allows the databound component to properly display a visual representation of the portion of the result set actually retreived.

For example, the ListGrid uses this value to display a properly sized scrollbar thumb.

Returns:
the DSResponse
See Also:
DSRequest.isPaged()

getStatus

public int getStatus()
Returns the currently set status code.

Returns:
current status

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.

setStatus

public DSResponse setStatus(int status)
Sets the status of this DSResponse.

Parameters:
status - new status code
Returns:
the DSResponse

setSuccess

public DSResponse setSuccess()
Sets the status of this DSResponse to STATUS_SUCCESS.

Returns:
the DSResponse

setFailure

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

Returns:
the DSResponse

setFailure

public DSResponse setFailure(java.lang.String message)
Sets the status code to STATUS_FAILURE and provides an error message to be shown to the user.

Returns:
the DSResponse

getDataSource

public DataSource getDataSource()
Returns the currently set DataSource.

Returns:
the DataSource associated with this DSResponse

setDataSource

public DSResponse setDataSource(DataSource dataSource)
Sets the DataSource associated with this DSResponse.

Parameters:
status - new status code
Returns:
the DSResponse

getRelatedUpdates

public java.util.List getRelatedUpdates()
Gets list of related updates previously added to this response.

Returns:
list of related responses.
See Also:
com.isomorphic.datasource.DSResponse#addRelatedUpdate()

addRelatedUpdate

public DSResponse addRelatedUpdate(DSResponse relatedUpdate)
Causes client-side components to react as though the provided DSResponse had just successfully completed.

This API can be used to communicate additional changes that occur as a consequence of the current DSResponse succeeding, such as changes to other records in the same DataSource or to records from unrelated DataSources. For example, in CRM applications, Leads may be converted to Accounts. In this case the "remove" operation on the Leads DataSource might call addRelatedUpdate() with a DSResponse representing an "add" operation on the Accounts DataSource. This would cause any client-side caches of Accounts (such as a drop-down list for picking an Account) to automatically update.

If a DSResponse is passed with the DataSource or operationType unset, they will match the current DSResponse.

This API can be called multiple times for multiple related updates. Each update is processed by the client-side method DataSource.updateCaches().

This API should NOT be used simply to complete multiple requests in a single HTTP turnaround, instead, use Queuing for this (see the client-side API isc.RPCManager.startQueue()).

Parameters:
relatedUpdate - DSResponse to add.
Returns:
the DSResponse that addRelatedUpdate() was called on

getErrorReport

public ErrorReport getErrorReport()
Returns the current ErrorReport.

Returns:
current ErrorReport
See Also:
ErrorReport, ErrorMessage, DSRequest.validate()

setErrorReport

public DSResponse setErrorReport(ErrorReport errorReport)
Sets the ErrorReport for this DSResponse

Parameters:
errorReport - new errorReport
Returns:
the DSResponse

addError

public DSResponse addError(java.lang.String fieldName,
                           ErrorMessage errorMessage)
Adds an ErrorMessage to the ErrorReport for this DSResponse. If no ErrorReport exists, one is created. Note that multiple ErrorMessages can be returned for a given field - for example if the field specified multiple validators and more than one those failed.

Parameters:
fieldName - the fieldName for the error
errorMessage - the errorMessage
Returns:
the DSResponse

addError

public DSResponse addError(java.lang.String fieldName,
                           java.lang.String errorMessage)
Adds an ErrorMessage to the ErrorReport for this DSResponse. If no ErrorReport exists, one is created. Note that multiple ErrorMessages can be returned for a given field - for example if the field specified multiple validators and more than one those failed.

Parameters:
fieldName - the fieldName for the error
errorMessage - the errorMessage
Returns:
the DSResponse

getRecord

public java.util.Map getRecord()
Returns the DSResponse's data member in "record" format (ie, as a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater). Note that this method only works if the DSResponse has had its dataSource member set, either by constructing with a suitable constructor or by calling dsResponse.setDataSource().

Returns:
This dsResponse's data object, in record format

getRecords

public java.util.List getRecords()
Returns the DSResponse's data member as a list of maps in "record" format (ie, each entry in the list is a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater). Note that this method only works if the DSResponse has had its dataSource member set, either by constructing with a suitable constructor or by calling dsResponse.setDataSource().

Returns:
This dsResponse's data object, as a list of maps in record format

getRecords

public java.util.List getRecords(ValidationContext vc)
Returns the DSResponse's data member as a list of maps in "record" format (ie, each entry in the list is a nested collection of Maps and Lists that can be directly translated into JSON format by the JSTranslater). Note that this method only works if the DSResponse has had its dataSource member set, either by constructing with a suitable constructor or by calling dsResponse.setDataSource().

Parameters:
vc - Validation context
Returns:
This dsResponse's data object, as a list of maps in record format

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fieldName)
Returns the value of the field name provided in this dsResponse's data member. Note that this method first calls getRecord() to obtain a record view of the data.

Parameters:
fieldName - The name of the field whose value to return
Returns:
The value of the supplied field name in this dsResponse's data member

getExportTo

public java.io.OutputStream getExportTo()
Returns the OuputStream we will use for data export. If you have not set this explicitly with the com.isomorphic.datasource.DSResponse#exportTo(OutputStream) API, it will be null.

Returns:
The export OutputStream

setExportTo

public DSResponse setExportTo(java.io.OutputStream exportOutputStream)
Sets the OuputStream we will use for data export (this means exports to CSV, XML, JSON and Excel formats; PDF exports are "content exports" and are different). This API allows you to arrange for other export scenarios than the two built-in options (download to client and write to filesystem). If you set this property, it overrides the default OutputStream we would normally create for a filesystem export; in other words, we will export to your OutputStream rather than to a filesystem file.

Parameters:
exportOutputStream - An OutputStream to use for the export
Returns:
The DSResponse itself

getExportObject

public java.lang.Object getExportObject(DSRequest dsRequest)
                                 throws java.lang.Exception
Returns the Java object encapsulating the exported data in a format suitable for directly loading into Microsoft Excel. Note that calling this method causes the parameter dsRequest to be executed inline, if it has not already been executed, in order to fetch and format the data. Note that this API is only applicable when the parameter DSRequest is for an export to XLS or OOXML format.

Currently, we use the Apache POI library to perform Excel exports, so the object returned by this method will be an instance of that library's Workbook interface.

Use this API with extreme caution. Most of its behavior is subject to change without notice. The types of objects returned by this API may be changed in future versions without notice if the Server Framework begins using a newer version of the various libraries used for exports (eg a newer version of Apache POI) and could change to a completely different type if the Server Framework switches to using a different library for a given type of export.

Further, the contents of the export object are likewise subject to change without notice, including, for example, the specific way that type, formatting and styling information is conveyed to Excel.

If you choose to use this API, when interacting with the generated export object, code defensively and rely on as few specifics as possible. Also, be sure to revisit and re-test this code when upgrading to new versions of the Server Framework.

Parameters:
dsRequest - The DSRequest to execute to obtain the export object
Returns:
The export object
Throws:
java.lang.Exception

setExportObject

public DSResponse setExportObject(java.lang.Object exportObject)
                           throws java.lang.Exception
Set the export object on the DSResponse. Note that this API is only applicable when the parameter DSRequest is for an export to XLS or OOXML format. Calling this method causes the server framework to use the provided object rather than running through the export process.

Currently, we use the Apache POI library to perform Excel exports, so the object provided to this method must be an instance of that library's Workbook interface.

Use this API with extreme caution. Most of its behavior is subject to change without notice. The types of object accepted by this API may be changed in future versions without notice if the Server Framework begins using a newer version of the various libraries used for exports (eg a newer version of Apache POI) and could change to a completely different type if the Server Framework switches to using a different library for a given type of export.

Parameters:
exportObject - The export object to associate with this DSResponse
Returns:
The DSResponse itself
Throws:
java.lang.Exception