com.highdeal.hci
Class MessageBody

java.lang.Object
  extended by com.highdeal.hci.MessageBody
All Implemented Interfaces:
XMLMarshallable

public class MessageBody
extends java.lang.Object
implements XMLMarshallable

This Java class represents the body of a message sent via HCI sent by your client application to a connected SAP CC system; it is a set of operations or a set of operation results.

See Also:
MessageEnvelope, MessageOperation, OperationResult

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="body">
   <xs:complexType>
     <xs:sequence>
       <xs:any minOccurs="0" maxOccurs="unbounded"/>
     </xs:sequence>
   </xs:complexType>
 </xs:element>


Constructor Summary
MessageBody()
          Builds an empty message body.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the objects, the child represents the marshallable object to be added into the content tree.
 void addOperation(MessageOperation op)
          Adds a message operation to the message body.
 void addOperationResult(OperationResult res)
          Adds an operation result to the message body.
 void clear()
          Clears the body.
 int getLength()
          Returns the number of operations or operation results contained in the body.
 MessageOperation getOperation(int i)
          Gets the ith operation contained in this body.
 OperationResult getResult(int i)
          Gets the ith operation result in this body.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, and of its children.
 void replaceLastOperationResult(OperationResult res)
          Replace the last operation result in the message body.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the tag being processed.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageBody

public MessageBody()
Builds an empty message body.

Method Detail

getLength

public int getLength()
Returns the number of operations or operation results contained in the body.

Returns:
The number of operations or operation results contained in the body

addOperation

public void addOperation(MessageOperation op)
Adds a message operation to the message body.

Parameters:
op - The operation to add

addOperationResult

public void addOperationResult(OperationResult res)
Adds an operation result to the message body.

Parameters:
res - The result to add

replaceLastOperationResult

public void replaceLastOperationResult(OperationResult res)
Replace the last operation result in the message body.

Parameters:
res - The result to add

getOperation

public MessageOperation getOperation(int i)
Gets the ith operation contained in this body.

Parameters:
i - The index of the operation to retrieve
Returns:
The ith operation contained in this body
Throws:
java.lang.ArrayIndexOutOfBoundsException - if i > body length.
java.lang.ClassCastException - if the ith element is not a message operation

getResult

public OperationResult getResult(int i)
                          throws OperationFailureException
Gets the ith operation result in this body.

Parameters:
i - The index of the result to retrieve
Returns:
The ith result contained in this body
Throws:
OperationFailureException - if the result is an OperationFailureException
java.lang.ArrayIndexOutOfBoundsException - if i > body length
java.lang.ClassCastException - if the ith element is not a result

clear

public void clear()
Clears the body.


setAttributes

public void setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the tag being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current tag

addChild

public void addChild(java.lang.String tagName,
                     XMLMarshallable child)
Adds a child to the objects, the child represents the marshallable object to be added into the content tree.

Specified by:
addChild in interface XMLMarshallable
Parameters:
tagName - The name of tag for the child
child - The child to be added

addCharacterData

public void addCharacterData(java.lang.String cData)
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

marshal

public void marshal(XMLOutputter output)
Gives an XML representation of this object, and of its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)