Class MessageBody

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

public class MessageBody extends 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:

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 Details

    • MessageBody

      public MessageBody()
      Builds an empty message body.
  • Method Details

    • 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:
      ArrayIndexOutOfBoundsException - if i > body length.
      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
      ArrayIndexOutOfBoundsException - if i > body length
      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(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(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 String toString()
      Overrides:
      toString in class Object