com.groiss.wfxml
Class GenericMessage

java.lang.Object
  extended by com.groiss.wfxml.WfXMLMessage
      extended by com.groiss.wfxml.GenericMessage

public class GenericMessage
extends WfXMLMessage

The generic message is not defined in the WfXML specification. It has been invented mainly for communication between passive and active @enterprise servers. Anyway, it can also be used to transfer any kind of data or information. Generic messages are parameter-based. You can specify as many arbitrary parameters and values as you want.


Field Summary
protected static java.lang.String MSG_BODY_GEN
           
 
Fields inherited from class com.groiss.wfxml.WfXMLMessage
body, CONTEXTDATA_DOCUMENTCREATOR, documentCreator, documentCreatorId, header, message, MSG_BODY, MSG_BODY_CTXDATA, MSG_BODY_CTXDATA_DMSFOLDER, MSG_BODY_CTXDATA_NOTES, MSG_BODY_CTXDATA_PROCESSFORMS, MSG_BODY_CTXDATA_PROCESSFORMS_NAME, MSG_BODY_EXC, MSG_BODY_EXC_DESC, MSG_BODY_EXC_MAINCODE, MSG_BODY_EXC_SUBCODE, MSG_BODY_EXC_SUBJECT, MSG_BODY_EXC_TYPE, MSG_BODY_RSLTDATA, MSG_BODY_RSLTDATASET, MSG_BODY_SET_NAME, MSG_BODY_SET_PARAM, MSG_BODY_SET_VALUE, MSG_HEAD, MSG_HEAD_KEY, MSG_HEAD_REQ, MSG_HEAD_RESP, MSG_HEAD_RESPREQUIRED, MSG_HEAD_RESPREQUIRED_NO, MSG_HEAD_RESPREQUIRED_ONERROR, MSG_HEAD_RESPREQUIRED_YES, MSG_ROOT, MSG_TRANSPORT, MSG_TRANSPORT_CORDATA, MSG_TRANSPORT_CORDATA_OID, MSG_TRANSPORT_CORDATA_ORIGIN, MSG_TRANSPORT_CORDATA_TIMESTAMP, MSG_VERSION, namespace, PI_STATE_CLOSED_ABNORMAL_COMPLETED, PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR, PI_STATE_CLOSED_COMPLETED, PI_STATE_CLOSED_COMPLETED_STR, PI_STATE_NONE, PI_STATE_OPEN_NOTRUNNING, PI_STATE_OPEN_NOTRUNNING_STR, PI_STATE_OPEN_RUNNING, PI_STATE_OPEN_RUNNING_STR, REQUEST, RESPONSE, RESPONSE_NOT_REQUIRED, RESPONSE_REQUIRED, RESPONSE_REQUIRED_ONERROR, root, transport, usingPlainKey
 
Constructor Summary
protected GenericMessage(org.jdom.Document doc)
          Use this constructor to create a GenericMessage out of an existing JDOM document.
  GenericMessage(short messageType)
          This constructor initializes a new empty GenericMessage message.
 
Method Summary
 void addParameter(java.lang.String parameterName, java.lang.String value)
          This method adds a value for a parameter to this message.
 java.lang.String getParameter(java.lang.String parameterName)
          Use this method to retrieve a simple text parameter, which has been set with setParameter(String, String) before.
 java.util.List listParameterValueStrings(java.lang.String parameterName)
          Returns a List containing all values of the parameter named parameterName.
 void prepare(Partner partner)
          Preparing the message for being sent.
 void setMessageType(short type)
          Set the message type of this WfXML message (in the message header).
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Use this method for setting a parameter.
 
Methods inherited from class com.groiss.wfxml.WfXMLMessage
addParameterValueElem, assureBodyExists, assureHeaderExists, assureTransportExists, createMessage, createMessage, getDocumentCreator, getException, getMessageIdentifier, getMessageOrigin, getMessageType, getParameterValueElem, getParameterValueElems, getPlainKey, getResponseRequired, getStateString, getTimestamp, getTransportElementValue, setDocumentCreator, setException, setMessageIdentifier, setMessageOrigin, setPlainKey, setResponseRequired, setTimestamp, setTransportElement, toPrettyString, toString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSG_BODY_GEN

protected static final java.lang.String MSG_BODY_GEN
See Also:
Constant Field Values
Constructor Detail

GenericMessage

public GenericMessage(short messageType)
This constructor initializes a new empty GenericMessage message. You must specify if this message will be a request or a response message.

Parameters:
messageType - Set the message type to either WfXMLMessage.REQUEST or WfXMLMessage.RESPONSE.

GenericMessage

protected GenericMessage(org.jdom.Document doc)
Use this constructor to create a GenericMessage out of an existing JDOM document.

Parameters:
doc - A JDOM Document element.
Method Detail

setMessageType

public void setMessageType(short type)
                    throws java.lang.IllegalArgumentException
Description copied from class: WfXMLMessage
Set the message type of this WfXML message (in the message header). Derived message classes can overwrite this method in order to set additional message type dependent content in the message body. Possible message types are request or response.
Take care: setting the message type removes proviously set content from the message.

Overrides:
setMessageType in class WfXMLMessage
Parameters:
type - Use the constants WfXMLMessage.REQUEST or WfXMLMessage.RESPONSE as value for this parameter, depending on if you want to create a request or a response message.
Throws:
java.lang.IllegalArgumentException - If type is illegal.

addParameter

public void addParameter(java.lang.String parameterName,
                         java.lang.String value)
This method adds a value for a parameter to this message. If the parameter doesn't exist in the message so far, it will be created. This method allows setting multiple values for parameters. Simply call it more than once with the same parameterName set.

Parameters:
parameterName - The name of the parameter for which you want to add a value.
value - The value you want to add to this parameter.

listParameterValueStrings

public java.util.List listParameterValueStrings(java.lang.String parameterName)
Returns a List containing all values of the parameter named parameterName.

Parameters:
parameterName - The name of the parameter for which you want to receive values.
Returns:
A List with the values of the parameter. If the parameter does not have values or if it doesn't exist, the returned List will be empty.

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
Use this method for setting a parameter. If the parameter already exists, the old value will be overwritten. If you want to add more values to one parameter, use the addParameter method instead.

Parameters:
parameterName - Name of the parameter that you want to set.
parameterValue - The value for the parameter.

getParameter

public java.lang.String getParameter(java.lang.String parameterName)
Use this method to retrieve a simple text parameter, which has been set with setParameter(String, String) before. Take care: if you use this method to access a parameter which contains multiple values, you will only retrieve one of these values with this method! If you want to get all the values of such a multiple-value parameter, use the listParameterValueStrings method instead.

Parameters:
parameterName - The name of the parameter you are searching for.
Returns:
A String containing the value of the parameter, or null if the parameter was not found in the message.

prepare

public void prepare(Partner partner)
Preparing the message for being sent. This is called automatically by the Sender before the message is sent. So you never need to call it manually.

Specified by:
prepare in class WfXMLMessage
Parameters:
partner - The partner server to which the message will be sent.


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.