org.outerj.xreporter.client
Class XReporterResponse

java.lang.Object
  extended byorg.outerj.xreporter.client.XReporterResponse

public class XReporterResponse
extends java.lang.Object

This is the response returned by XReporterClient.processRequest(org.outerj.xreporter.client.XReporterRequest). The fields of this object which contain information depend on the type of the response. The type can be retrieved using the getType() method and is one of these constants:

OKFor a 'normal response'. In this case you can call getData() to get a byte array containing XReporter's XML response.
LINKIf XReporter answered with a link to somewhere else. In this case you can call getHref() to get the value of the link. Calling getData() will return XReporter's XML response as-is.
APP_ERRORIf an error occured in XReporter. Calling getData() wil give the error message (as XML).
ERRORIf an error occured with the connection to XReporter, within the HTTP stack or with parsing the result. In this case you can call getErrorMessage() to get a description of the error. Calling getData() will return null.


Field Summary
static short APP_ERROR
           
protected  byte[] data
           
static short ERROR
           
protected  java.lang.String errorMessage
          Error messsage in case type = ERROR, otherwise it is null.
protected  java.lang.String href
           
static short LINK
           
static short OK
           
protected  java.lang.String reportDefinitionId
           
protected  java.lang.String reportId
           
protected  short type
           
 
Constructor Summary
XReporterResponse()
           
 
Method Summary
 byte[] getData()
          Returns a byte array containing the XML response.
 java.lang.String getErrorMessage()
          In case getType() returns ERROR, this will contain a (non-localized) error message, otherwise this returns null.
 java.lang.String getHref()
          In case getType() returns LINK, this will contain the value of the link, otherwise this will return null.
 java.lang.String getReportDefinitionId()
          If getType() returns OK, and the request was send to report-resource (/reports/<id&t;/...), this will give the report definition id of the report to which the request was sent.
 java.lang.String getReportId()
          If getType() returns OK, and the request was send to report-resource (/reports/<id&t;/...), this will give the report instance id of the report to which the request was sent.
 short getType()
          Returns the type of the response.
 java.lang.String getTypeName()
          Returns the type of the response as a String.
 void setData(byte[] data)
           
 void setErrorMessage(java.lang.String errorMessage)
           
 void setHref(java.lang.String href)
           
 void setReportDefinitionId(java.lang.String reportDefinitionId)
           
 void setReportId(java.lang.String reportId)
           
 void setType(short type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected byte[] data

type

protected short type

href

protected java.lang.String href

errorMessage

protected java.lang.String errorMessage
Error messsage in case type = ERROR, otherwise it is null. This error message will normally not be localised.


OK

public static final short OK
See Also:
Constant Field Values

LINK

public static final short LINK
See Also:
Constant Field Values

APP_ERROR

public static final short APP_ERROR
See Also:
Constant Field Values

ERROR

public static final short ERROR
See Also:
Constant Field Values

reportDefinitionId

protected java.lang.String reportDefinitionId

reportId

protected java.lang.String reportId
Constructor Detail

XReporterResponse

public XReporterResponse()
Method Detail

getData

public byte[] getData()
Returns a byte array containing the XML response. This is null in case getType() returns ERROR.


setData

public void setData(byte[] data)

getType

public short getType()
Returns the type of the response. This is one of the constants OK, LINK, APP_ERROR or ERROR.


setType

public void setType(short type)

getHref

public java.lang.String getHref()
In case getType() returns LINK, this will contain the value of the link, otherwise this will return null.


setHref

public void setHref(java.lang.String href)

getErrorMessage

public java.lang.String getErrorMessage()
In case getType() returns ERROR, this will contain a (non-localized) error message, otherwise this returns null.


setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)

getTypeName

public java.lang.String getTypeName()
Returns the type of the response as a String. The strings returned are "OK", "ERROR", "APP_ERROR" or "LINK".


getReportDefinitionId

public java.lang.String getReportDefinitionId()
If getType() returns OK, and the request was send to report-resource (/reports/<id&t;/...), this will give the report definition id of the report to which the request was sent.


setReportDefinitionId

public void setReportDefinitionId(java.lang.String reportDefinitionId)

getReportId

public java.lang.String getReportId()
If getType() returns OK, and the request was send to report-resource (/reports/<id&t;/...), this will give the report instance id of the report to which the request was sent.


setReportId

public void setReportId(java.lang.String reportId)