telosys.objects
Class ScreenResponse

java.lang.Object
  extended bytelosys.objects.ScreenResponse

public class ScreenResponse
extends java.lang.Object

ScreenResponse object
The request response for "ScreenActions" and "ScreenService"


Constructor Summary
protected ScreenResponse(object oXHR)
          Creates a new ScreenResponse object
 
Method Summary
 boolean dataFound()
          Return true if the tag "found" is present in the response
This flag is automaticaly set by the action "load" ( "found" or "not-found" )
 boolean dataNotFound()
          Return true if the tag "not-found" is present in the response
This flag is automaticaly set by the action "load" ( "found" or "not-found" )
 boolean dataVoid()
          Returns true if there's no data element in the response
( when the tag "data" is void and has an attribute void="true" )
 object getActionInfos()
          Returns an object holding the following attributes :
. screenName
. screenId
. action
. procName
 string getDataFieldValue(string tag, string attr, boolean childTag)
          Return a tag field value
 ScreenError[] getErrors()
          Returns an array of ScreenError objects
 string getErrorsAsText()
          Returns a string containing all the "errors"
 ScreenException[] getExceptions()
          Returns an array of exceptions, or null if there's no exception in the response
 string getExceptionsAsText()
          Returns a string containing all the "exceptions"
 number getHttpStatusCode()
          Returns the HTTP status code ( from the HTTP header, "200" if OK, ... )
 string getHttpStatusText()
          Returns the HTTP status message ( from the HTTP header )
 ScreenMessage[] getMessages()
          Returns an array of messages, or null if there's no message in the response
 object[] getOutputErrors()
          Returns an array of objects, or null if there's no "output errors" in the response
Each object holds the following attributes :
. view ( for a "view-error" only )
. renderer ( for a "view-error" only )
. dataName ( for a "data-error" only )
. dataClass ( for a "data-error" only )
. exception
. message
 string getOutputErrorsAsText()
          Returns a string containing all the "output errors"
 number getReadyState()
          Returns the technical readyState value ( from XHR )
 string getResponseText()
          Returns the reponse content as a string
 object getResponseXML()
          Returns the reponse content as an XML tree ( DOM )
 string getReturnCode()
          Returns the Telosys return code
 string getReturnMessage()
          Returns the Telosys return message
 string getServiceViewContent()
          Retuns the content of the unique view ( usable only with a "service response" )
 string getValue(string name)
          Return a single value of the response
 object getValues()
          Return all the values of the response in a single object
The object returned can be used as a Map ( value = obj[key] )
 string getViewContent(string viewName)
          Returns the content of the given view
protected  object getXmlTagData()
          Returns the node object for the XML tag "data" ( XML node )
 boolean hasErrors()
          Returns a boolean indicating if there's errors in the response
 boolean hasExceptions()
          Returns a boolean indicating if there's exceptions in the response
 boolean hasMessages()
          Returns a boolean indicating if there's messages in the response
 boolean hasOutputErrors()
          Returns a boolean indicating if there's "output errors" in the response
Output errors occurs when the server-side tries to generate the response output :
. during a view generation ( with a renderer )
. during a data generation ( with an XML mapper )
 boolean hasValues()
          Returns a boolean indicating if there's values in the response
 boolean hasView()
          Returns true if there's a least one view in the response
 boolean isOK()
          Returns true if the HTTP/AJAX response is OK ( readyState == 4 and http status == 200 ) and if the telosys return code is "0" ( in the XML response )
 boolean reportsErrors()
          Returns a boolean indicating if the response reports any kind of error
Returns true in the following cases :
. an HTTP or AJAX error has occurred
. the return code is not "0"
. there's an "error" in the response
. there's an "exception" in the response
. there's an "output error" in the response
Returns false only if everything is OK
 void show()
          Show the response in an alert message box
 void showAllErrors()
          Shows all the errors (http, return code, errors, exceptions, output errors ) in an alert message box
 void showOutputErrors()
          Shows all the "output errors" in an alert message box
 void showValues()
          Shows all the values in an alert message box
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenResponse

protected ScreenResponse(object oXHR)
Creates a new ScreenResponse object

Parameters:
oXHR - : a reference on the XMLHttpRequest object used to send the request
Method Detail

isOK

public boolean isOK()
Returns true if the HTTP/AJAX response is OK ( readyState == 4 and http status == 200 ) and if the telosys return code is "0" ( in the XML response )

Returns:

getResponseText

public string getResponseText()
Returns the reponse content as a string

Returns:

getResponseXML

public object getResponseXML()
Returns the reponse content as an XML tree ( DOM )

Returns:

getReadyState

public number getReadyState()
Returns the technical readyState value ( from XHR )

Returns:

getHttpStatusCode

public number getHttpStatusCode()
Returns the HTTP status code ( from the HTTP header, "200" if OK, ... )

Returns:

getHttpStatusText

public string getHttpStatusText()
Returns the HTTP status message ( from the HTTP header )

Returns:

getReturnCode

public string getReturnCode()
Returns the Telosys return code

Returns:

getReturnMessage

public string getReturnMessage()
Returns the Telosys return message

Returns:

dataNotFound

public boolean dataNotFound()
Return true if the tag "not-found" is present in the response
This flag is automaticaly set by the action "load" ( "found" or "not-found" )

Returns:
: true if the flag "not-found" has been set (else false)

dataFound

public boolean dataFound()
Return true if the tag "found" is present in the response
This flag is automaticaly set by the action "load" ( "found" or "not-found" )

Returns:
: true if the flag "found" has been set (else false)

dataVoid

public boolean dataVoid()
Returns true if there's no data element in the response
( when the tag "data" is void and has an attribute void="true" )

Returns:

show

public void show()
Show the response in an alert message box


getXmlTagData

protected object getXmlTagData()
Returns the node object for the XML tag "data" ( XML node )

Returns:
: the node (or null)

getDataFieldValue

public string getDataFieldValue(string tag,
                                string attr,
                                boolean childTag)
Return a tag field value

Parameters:
tag - : the tag name ( the "element" name )
attr - : the attribute name
childTag - : if true returns the child tag content ( usefull for "LONG TEXT" )
Returns:

getMessages

public ScreenMessage[] getMessages()
Returns an array of messages, or null if there's no message in the response

Returns:

getExceptions

public ScreenException[] getExceptions()
Returns an array of exceptions, or null if there's no exception in the response

Returns:

getValue

public string getValue(string name)
Return a single value of the response

Parameters:
name - : the name of the value
Returns:
: the value for the given name ( or null )

getValues

public object getValues()
Return all the values of the response in a single object
The object returned can be used as a Map ( value = obj[key] )

Returns:
: the values object, or null if there's no values in the response

showValues

public void showValues()
Shows all the values in an alert message box


hasView

public boolean hasView()
Returns true if there's a least one view in the response

Returns:

getViewContent

public string getViewContent(string viewName)
Returns the content of the given view

Parameters:
viewName - : the name of the view
Returns:
: the content of the view (or null)

getServiceViewContent

public string getServiceViewContent()
Retuns the content of the unique view ( usable only with a "service response" )

Returns:
: the content of the view (or null)

getActionInfos

public object getActionInfos()
Returns an object holding the following attributes :
. screenName
. screenId
. action
. procName

Returns:
Since:
v 1.1.0

hasValues

public boolean hasValues()
Returns a boolean indicating if there's values in the response

Returns:
true if there's a tag "values" in the XML response, else false
Since:
v 1.1.0

hasErrors

public boolean hasErrors()
Returns a boolean indicating if there's errors in the response

Returns:
true if there's a tag "errors" in the XML response, else false
Since:
v 1.1.0

getErrors

public ScreenError[] getErrors()
Returns an array of ScreenError objects

Returns:
an array, or null if there's no error in the response
Since:
v 1.1.0

getErrorsAsText

public string getErrorsAsText()
Returns a string containing all the "errors"

Returns:
Since:
v 1.1.0

hasExceptions

public boolean hasExceptions()
Returns a boolean indicating if there's exceptions in the response

Returns:
true if there's a tag "exceptions" in the XML response, else false
Since:
v 1.1.0

getExceptionsAsText

public string getExceptionsAsText()
Returns a string containing all the "exceptions"

Returns:
Since:
v 1.1.0

hasMessages

public boolean hasMessages()
Returns a boolean indicating if there's messages in the response

Returns:
true if there's a tag "messages" in the XML response, else false
Since:
v 1.1.0

hasOutputErrors

public boolean hasOutputErrors()
Returns a boolean indicating if there's "output errors" in the response
Output errors occurs when the server-side tries to generate the response output :
. during a view generation ( with a renderer )
. during a data generation ( with an XML mapper )

Returns:
true if there's a tag "output-errors" in the XML response, else false
Since:
v 1.1.0

getOutputErrors

public object[] getOutputErrors()
Returns an array of objects, or null if there's no "output errors" in the response
Each object holds the following attributes :
. view ( for a "view-error" only )
. renderer ( for a "view-error" only )
. dataName ( for a "data-error" only )
. dataClass ( for a "data-error" only )
. exception
. message

Returns:
Since:
v 1.1.0

getOutputErrorsAsText

public string getOutputErrorsAsText()
Returns a string containing all the "output errors"

Returns:
Since:
v 1.1.0

showOutputErrors

public void showOutputErrors()
Shows all the "output errors" in an alert message box

Since:
v 1.1.0

reportsErrors

public boolean reportsErrors()
Returns a boolean indicating if the response reports any kind of error
Returns true in the following cases :
. an HTTP or AJAX error has occurred
. the return code is not "0"
. there's an "error" in the response
. there's an "exception" in the response
. there's an "output error" in the response
Returns false only if everything is OK

Returns:
Since:
v 1.1.0

showAllErrors

public void showAllErrors()
Shows all the errors (http, return code, errors, exceptions, output errors ) in an alert message box

Since:
v 1.1.0