Package com.highdeal.hci
Class MessageBody
java.lang.Object
com.highdeal.hci.MessageBody
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String tagName, XMLMarshallable child) Adds a child to the objects, thechildrepresents the marshallable object to be added into the content tree.voidAdds a message operation to the message body.voidAdds an operation result to the message body.voidclear()Clears the body.intReturns the number of operations or operation results contained in the body.getOperation(int i) Gets the ith operation contained in this body.getResult(int i) Gets the ith operation result in this body.voidmarshal(XMLOutputter output) Gives an XML representation of this object, and of its children.voidReplace the last operation result in the message body.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the tag being processed.final StringtoString()
-
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
Adds a message operation to the message body.- Parameters:
op- The operation to add
-
addOperationResult
Adds an operation result to the message body.- Parameters:
res- The result to add
-
replaceLastOperationResult
Replace the last operation result in the message body.- Parameters:
res- The result to add
-
getOperation
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
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 OperationFailureExceptionArrayIndexOutOfBoundsException- if i > body lengthClassCastException- if the ith element is not a result
-
clear
public void clear()Clears the body. -
setAttributes
Sets the attributes of the XML representation of the tag being processed.- Specified by:
setAttributesin interfaceXMLMarshallable- Parameters:
atts- The XML attributes of the current tag
-
addChild
Adds a child to the objects, thechildrepresents the marshallable object to be added into the content tree.- Specified by:
addChildin interfaceXMLMarshallable- Parameters:
tagName- The name of tag for the childchild- The child to be added
-
addCharacterData
Adds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
marshal
Gives an XML representation of this object, and of its children.- Specified by:
marshalin interfaceXMLMarshallable- Parameters:
output- The XML output to marshal the object into
-
toString
-