com.groiss.wfxml
Class WfXMLMessage

java.lang.Object
  extended by com.groiss.wfxml.WfXMLMessage
Direct Known Subclasses:
ChangePIStateMessage, CreatePIMessage, GenericMessage, GetPIDataMessage, NotifyMessage, PIStateChangedMessage

public abstract class WfXMLMessage
extends java.lang.Object

This is an abstract base class for all WfXML message types. It provides some constants (static final) fields that are used throughout the WfXML implementation.
Furthermore some methods are defined which can be used on all messages.
If you want to create a new WfXMLMessage you should use one of the subclasses' constructors. Once messages are created and content is added, you can send them to partner servers using the Sender class.


Field Summary
protected  org.jdom.Element body
          Body Element of the message.
protected static java.lang.String CONTEXTDATA_DOCUMENTCREATOR
           
protected  com.dec.avw.core.User documentCreator
          If this user is defined, it will be used to create all documents for which no other creator is defined.
protected  java.lang.String documentCreatorId
           
protected  org.jdom.Element header
          Header Element of the message.
protected  org.jdom.Document message
          Reference to the jdom XML message which is encapsulated by this WfXMLMessage
protected static java.lang.String MSG_BODY
           
protected static java.lang.String MSG_BODY_CTXDATA
           
protected static java.lang.String MSG_BODY_CTXDATA_DMSFOLDER
           
protected static java.lang.String MSG_BODY_CTXDATA_NOTES
           
protected static java.lang.String MSG_BODY_CTXDATA_PROCESSFORMS
           
protected static java.lang.String MSG_BODY_CTXDATA_PROCESSFORMS_NAME
           
protected static java.lang.String MSG_BODY_EXC
           
protected static java.lang.String MSG_BODY_EXC_DESC
           
protected static java.lang.String MSG_BODY_EXC_MAINCODE
           
protected static java.lang.String MSG_BODY_EXC_SUBCODE
           
protected static java.lang.String MSG_BODY_EXC_SUBJECT
           
protected static java.lang.String MSG_BODY_EXC_TYPE
           
protected static java.lang.String MSG_BODY_RSLTDATA
           
protected static java.lang.String MSG_BODY_RSLTDATASET
           
protected static java.lang.String MSG_BODY_SET_NAME
           
protected static java.lang.String MSG_BODY_SET_PARAM
           
protected static java.lang.String MSG_BODY_SET_VALUE
           
protected static java.lang.String MSG_HEAD
           
protected static java.lang.String MSG_HEAD_KEY
           
protected static java.lang.String MSG_HEAD_REQ
           
protected static java.lang.String MSG_HEAD_RESP
           
protected static java.lang.String MSG_HEAD_RESPREQUIRED
           
protected static java.lang.String MSG_HEAD_RESPREQUIRED_NO
           
protected static java.lang.String MSG_HEAD_RESPREQUIRED_ONERROR
           
protected static java.lang.String MSG_HEAD_RESPREQUIRED_YES
           
protected static java.lang.String MSG_ROOT
           
protected static java.lang.String MSG_TRANSPORT
           
protected static java.lang.String MSG_TRANSPORT_CORDATA
           
protected static java.lang.String MSG_TRANSPORT_CORDATA_OID
           
protected static java.lang.String MSG_TRANSPORT_CORDATA_ORIGIN
           
protected static java.lang.String MSG_TRANSPORT_CORDATA_TIMESTAMP
           
protected static java.lang.String MSG_VERSION
           
protected  org.jdom.Namespace namespace
          Namespace of this message.
static short PI_STATE_CLOSED_ABNORMAL_COMPLETED
           
protected static java.lang.String PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR
           
static short PI_STATE_CLOSED_COMPLETED
           
protected static java.lang.String PI_STATE_CLOSED_COMPLETED_STR
           
static short PI_STATE_NONE
           
static short PI_STATE_OPEN_NOTRUNNING
           
protected static java.lang.String PI_STATE_OPEN_NOTRUNNING_STR
           
static short PI_STATE_OPEN_RUNNING
           
protected static java.lang.String PI_STATE_OPEN_RUNNING_STR
           
static short REQUEST
          Constant value for representing a request message
static short RESPONSE
          Constant value for representing a response message
static short RESPONSE_NOT_REQUIRED
          Constant value defining that a response is not required
static short RESPONSE_REQUIRED
          Constant value defining that a response is required
static short RESPONSE_REQUIRED_ONERROR
          Constant value defining that a response is only required if an error occurs
protected  org.jdom.Element root
          The root element of the message.
protected  org.jdom.Element transport
          Transport Element of the message (optional).
protected  boolean usingPlainKey
          This object field indicates whether a plain key has been set for the message or not.
 
Constructor Summary
protected WfXMLMessage(org.jdom.Document doc)
          Internal constructor that can be called to create a WfXMLMessage object out of an existing document.
 
Method Summary
protected  org.jdom.Element addParameterValueElem(org.jdom.Element parent, java.lang.String parameterName)
          This method returns a reference to a new value element for a parameter with the name parameterName.
protected  void assureBodyExists()
          Assures that a body exists.
protected  void assureHeaderExists()
          Assures that a header exists.
protected  void assureTransportExists()
          Assures that the transport part exists.
static WfXMLMessage createMessage(java.lang.String xmlContent)
          This static method creates a WfXMLMessage object out of a String containing the XML data.
protected static WfXMLMessage createMessage(java.lang.String xmlContent, boolean justIDs)
          This method creates a WfXMLMessage object out of a String containing XML data.
 User getDocumentCreator()
          Get the user who has been set with setDocumentCreator.
 WfXMLException getException()
          Use this method to check if the message contains an exception and retrieve a WfXMLException object representing the exception.
 java.lang.String getMessageIdentifier()
          Get the message identifier out of this message.
 java.lang.String getMessageOrigin()
          Returns the message's origin in case that one has been set.
 short getMessageType()
          Returns the message type of the message or throws an exception if there is no message type.
protected  org.jdom.Element getParameterValueElem(org.jdom.Element parent, java.lang.String parameterName, boolean create)
          This method returns a reference to the Value element of a parameter with the name parameterName.
protected  java.util.Collection getParameterValueElems(org.jdom.Element parent, java.lang.String parameterName)
          This method can be used for reading all value elements of a parameter specified by parameterName.
 java.lang.String getPlainKey()
          Returns the key of the message "as it is".
 short getResponseRequired()
          Use this method to get the 'response required' setting of the message.
 java.lang.String getStateString(short state)
          Use this method to get the WfXML String representation of one of the possible process instance states (e.g., PI_STATE_OPEN_RUNNING).
 java.lang.String getTimestamp()
          Use this method to get the message's timestamp.
protected  java.lang.String getTransportElementValue(java.lang.String elemName)
          This method is used internally for getting the value of an element set in CorrelationData part of the message's transport part.
abstract  void prepare(Partner partner)
          This method is called before the message is sent.
 void setDocumentCreator(java.lang.String userId)
          Use this method to set a default document creator user.
 void setException(WfXMLException exception)
          Use this method to set an exception for a response message or remove a previously set exception.
 void setMessageIdentifier(java.lang.String id)
          Use this method to set a message identifier in the transport part of the message.
protected  void setMessageOrigin(java.lang.String partnerId)
          Set the origin of the message in the message's transport part.
protected  void setMessageType(short type)
          Set the message type of this WfXML message (in the message header).
 void setPlainKey(java.lang.String key)
          This method sets a complete key for the message.
 void setResponseRequired(short type)
          Use this method to define if a response is required or not.
protected  void setTimestamp(java.lang.String timestamp)
          When a new WfXML message is created, the abstract constructor uses this method to set a timestamp in it.
protected  void setTransportElement(java.lang.String elemName, java.lang.String value)
          This method is internally used for setting a value in the CorrelationData part of the message's transport part.
 java.lang.String toPrettyString()
          Returns the message as pretty String.
 java.lang.String toString()
          Returns a String representation of the message.
 void write(java.io.OutputStream os)
          Writes the message to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESPONSE

public static final short RESPONSE
Constant value for representing a response message

See Also:
Constant Field Values

REQUEST

public static final short REQUEST
Constant value for representing a request message

See Also:
Constant Field Values

RESPONSE_REQUIRED

public static final short RESPONSE_REQUIRED
Constant value defining that a response is required

See Also:
Constant Field Values

RESPONSE_NOT_REQUIRED

public static final short RESPONSE_NOT_REQUIRED
Constant value defining that a response is not required

See Also:
Constant Field Values

RESPONSE_REQUIRED_ONERROR

public static final short RESPONSE_REQUIRED_ONERROR
Constant value defining that a response is only required if an error occurs

See Also:
Constant Field Values

PI_STATE_NONE

public static final short PI_STATE_NONE
See Also:
Constant Field Values

PI_STATE_OPEN_NOTRUNNING

public static final short PI_STATE_OPEN_NOTRUNNING
See Also:
Constant Field Values

PI_STATE_OPEN_RUNNING

public static final short PI_STATE_OPEN_RUNNING
See Also:
Constant Field Values

PI_STATE_CLOSED_COMPLETED

public static final short PI_STATE_CLOSED_COMPLETED
See Also:
Constant Field Values

PI_STATE_CLOSED_ABNORMAL_COMPLETED

public static final short PI_STATE_CLOSED_ABNORMAL_COMPLETED
See Also:
Constant Field Values

MSG_ROOT

protected static final java.lang.String MSG_ROOT
See Also:
Constant Field Values

MSG_VERSION

protected static final java.lang.String MSG_VERSION
See Also:
Constant Field Values

MSG_TRANSPORT

protected static final java.lang.String MSG_TRANSPORT
See Also:
Constant Field Values

MSG_TRANSPORT_CORDATA

protected static final java.lang.String MSG_TRANSPORT_CORDATA
See Also:
Constant Field Values

MSG_TRANSPORT_CORDATA_OID

protected static final java.lang.String MSG_TRANSPORT_CORDATA_OID
See Also:
Constant Field Values

MSG_TRANSPORT_CORDATA_ORIGIN

protected static final java.lang.String MSG_TRANSPORT_CORDATA_ORIGIN
See Also:
Constant Field Values

MSG_TRANSPORT_CORDATA_TIMESTAMP

protected static final java.lang.String MSG_TRANSPORT_CORDATA_TIMESTAMP
See Also:
Constant Field Values

MSG_HEAD

protected static final java.lang.String MSG_HEAD
See Also:
Constant Field Values

MSG_HEAD_REQ

protected static final java.lang.String MSG_HEAD_REQ
See Also:
Constant Field Values

MSG_HEAD_RESP

protected static final java.lang.String MSG_HEAD_RESP
See Also:
Constant Field Values

MSG_HEAD_RESPREQUIRED

protected static final java.lang.String MSG_HEAD_RESPREQUIRED
See Also:
Constant Field Values

MSG_HEAD_RESPREQUIRED_YES

protected static final java.lang.String MSG_HEAD_RESPREQUIRED_YES
See Also:
Constant Field Values

MSG_HEAD_RESPREQUIRED_NO

protected static final java.lang.String MSG_HEAD_RESPREQUIRED_NO
See Also:
Constant Field Values

MSG_HEAD_RESPREQUIRED_ONERROR

protected static final java.lang.String MSG_HEAD_RESPREQUIRED_ONERROR
See Also:
Constant Field Values

MSG_HEAD_KEY

protected static final java.lang.String MSG_HEAD_KEY
See Also:
Constant Field Values

MSG_BODY

protected static final java.lang.String MSG_BODY
See Also:
Constant Field Values

MSG_BODY_CTXDATA

protected static final java.lang.String MSG_BODY_CTXDATA
See Also:
Constant Field Values

MSG_BODY_CTXDATA_PROCESSFORMS

protected static final java.lang.String MSG_BODY_CTXDATA_PROCESSFORMS
See Also:
Constant Field Values

MSG_BODY_CTXDATA_PROCESSFORMS_NAME

protected static final java.lang.String MSG_BODY_CTXDATA_PROCESSFORMS_NAME
See Also:
Constant Field Values

MSG_BODY_CTXDATA_DMSFOLDER

protected static final java.lang.String MSG_BODY_CTXDATA_DMSFOLDER
See Also:
Constant Field Values

MSG_BODY_CTXDATA_NOTES

protected static final java.lang.String MSG_BODY_CTXDATA_NOTES
See Also:
Constant Field Values

MSG_BODY_RSLTDATASET

protected static final java.lang.String MSG_BODY_RSLTDATASET
See Also:
Constant Field Values

MSG_BODY_RSLTDATA

protected static final java.lang.String MSG_BODY_RSLTDATA
See Also:
Constant Field Values

MSG_BODY_SET_PARAM

protected static final java.lang.String MSG_BODY_SET_PARAM
See Also:
Constant Field Values

MSG_BODY_SET_NAME

protected static final java.lang.String MSG_BODY_SET_NAME
See Also:
Constant Field Values

MSG_BODY_SET_VALUE

protected static final java.lang.String MSG_BODY_SET_VALUE
See Also:
Constant Field Values

MSG_BODY_EXC

protected static final java.lang.String MSG_BODY_EXC
See Also:
Constant Field Values

MSG_BODY_EXC_MAINCODE

protected static final java.lang.String MSG_BODY_EXC_MAINCODE
See Also:
Constant Field Values

MSG_BODY_EXC_TYPE

protected static final java.lang.String MSG_BODY_EXC_TYPE
See Also:
Constant Field Values

MSG_BODY_EXC_SUBJECT

protected static final java.lang.String MSG_BODY_EXC_SUBJECT
See Also:
Constant Field Values

MSG_BODY_EXC_SUBCODE

protected static final java.lang.String MSG_BODY_EXC_SUBCODE
See Also:
Constant Field Values

MSG_BODY_EXC_DESC

protected static final java.lang.String MSG_BODY_EXC_DESC
See Also:
Constant Field Values

PI_STATE_OPEN_NOTRUNNING_STR

protected static final java.lang.String PI_STATE_OPEN_NOTRUNNING_STR
See Also:
Constant Field Values

PI_STATE_OPEN_RUNNING_STR

protected static final java.lang.String PI_STATE_OPEN_RUNNING_STR
See Also:
Constant Field Values

PI_STATE_CLOSED_COMPLETED_STR

protected static final java.lang.String PI_STATE_CLOSED_COMPLETED_STR
See Also:
Constant Field Values

PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR

protected static final java.lang.String PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR
See Also:
Constant Field Values

CONTEXTDATA_DOCUMENTCREATOR

protected static final java.lang.String CONTEXTDATA_DOCUMENTCREATOR
See Also:
Constant Field Values

message

protected org.jdom.Document message
Reference to the jdom XML message which is encapsulated by this WfXMLMessage


namespace

protected org.jdom.Namespace namespace
Namespace of this message. The namespace for all WfXML documents is defined in the WfXMLSettings class.

See Also:
WfXMLSettings

root

protected org.jdom.Element root
The root element of the message.


transport

protected org.jdom.Element transport
Transport Element of the message (optional).


header

protected org.jdom.Element header
Header Element of the message.


body

protected org.jdom.Element body
Body Element of the message.


documentCreator

protected com.dec.avw.core.User documentCreator
If this user is defined, it will be used to create all documents for which no other creator is defined.


documentCreatorId

protected java.lang.String documentCreatorId

usingPlainKey

protected boolean usingPlainKey
This object field indicates whether a plain key has been set for the message or not. Subclasses should check if a plain key has been set, before overwriting the key with a --- maybe previously set --- other key.

Constructor Detail

WfXMLMessage

protected WfXMLMessage(org.jdom.Document doc)
Internal constructor that can be called to create a WfXMLMessage object out of an existing document. This constructor extracts the general top-level elements. It is called by various subclasses.

Parameters:
doc - The JDOM document out of which a WfXMLMessage has to be created.
Method Detail

assureBodyExists

protected void assureBodyExists()
Assures that a body exists. If required, a body element will be created. Otherwise no changes are performed.


assureHeaderExists

protected void assureHeaderExists()
Assures that a header exists. If there is no header yet, a new one will be created. If a header exists, nothing will be done.


assureTransportExists

protected void assureTransportExists()
Assures that the transport part exists. If there is no transport part yet, a new one will be created, otherwise nothing will be done.


setMessageIdentifier

public void setMessageIdentifier(java.lang.String id)
Use this method to set a message identifier in the transport part of the message. This message identifier can be an OID for example. This value will be stored in the CorrelationData element of the transport part. According to the WfXML specification we can add implementation-specific data to the CorrelationData element: the message identifier is such implementation-specific data, which is not defined in the WfXML specification.

Parameters:
id - An identifier that you want to set for this message. Pass null in order to remove a previously set identifier.

setMessageOrigin

protected void setMessageOrigin(java.lang.String partnerId)
Set the origin of the message in the message's transport part. The origin should be the id of a partner. This value is not defined in the WfXML specification, therefore it is added in the CorrelationData element.

Parameters:
partnerId - The partner id that will be set as origin of the message.

setTimestamp

protected void setTimestamp(java.lang.String timestamp)
When a new WfXML message is created, the abstract constructor uses this method to set a timestamp in it. The timestamp will be used for logging purposes.

Parameters:
timestamp - A timestamp String.

getTimestamp

public java.lang.String getTimestamp()
Use this method to get the message's timestamp. The timestamp is set automatically when a new message is created.

Returns:
The timestamp of the message. If the message does not contain a timestamp, this method will return an empty String, but not null.

setTransportElement

protected void setTransportElement(java.lang.String elemName,
                                   java.lang.String value)
This method is internally used for setting a value in the CorrelationData part of the message's transport part.
If you want to remove a previously set element, pass null as value parameter.

Parameters:
elemName - Name of the element for which a value will be set.
value - The value that will be set (null to remove an element).

getMessageIdentifier

public java.lang.String getMessageIdentifier()
Get the message identifier out of this message. See setMessageIdentifier(java.lang.String) for more details about what the message identifier is.

Returns:
A String representing the message identifier, or null if no such message identifier has been set for this message.

getMessageOrigin

public java.lang.String getMessageOrigin()
Returns the message's origin in case that one has been set. The origin of a message is the server from which the message has been sent. Therefore, the returned String is the id of the Partner from which the message originates.

Returns:
The id of the partner from which the message originates, or null if no origin has been set in the message.

getTransportElementValue

protected java.lang.String getTransportElementValue(java.lang.String elemName)
This method is used internally for getting the value of an element set in CorrelationData part of the message's transport part.

Parameters:
elemName - The name of the element for which you want to get a value.
Returns:
The value of the element, or null if the element does not exist.

setMessageType

protected void setMessageType(short type)
                       throws java.lang.IllegalArgumentException
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.

Parameters:
type - Use the constants REQUEST or 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.

setDocumentCreator

public void setDocumentCreator(java.lang.String userId)
Use this method to set a default document creator user. If any documents will be created because of this message, and there is no particular user defined for a document, or if the defined user does not exist on the target system, then such documents will be created using this document creator.

Parameters:
userId - A String containing the id of the user who will be the default document creator for this message. If you want to remove the default document creator from the message, invoke this method with null.

getDocumentCreator

public User getDocumentCreator()
Get the user who has been set with setDocumentCreator.

Returns:
A User object representing the user who has been set as default document creator for this message, or null if no such user has been defined.

getMessageType

public short getMessageType()
                     throws WfXMLMessageException
Returns the message type of the message or throws an exception if there is no message type.

Returns:
REQUEST for request messages or RESPONSE for response messages.
Throws:
WfXMLMessageException - if the message type has not been set so far.

setResponseRequired

public void setResponseRequired(short type)
                         throws java.lang.IllegalArgumentException,
                                WfXMLMessageException
Use this method to define if a response is required or not. Note that this method only makes sense in context of a request message (if you invoke it for other message types, an exception will be thrown).

Parameters:
type - The type that you want to set. Use one of the following values: RESPONSE_REQUIRED, RESPONSE_NOT_REQUIRED, or RESPONSE_REQUIRED_ONERROR.
Throws:
java.lang.IllegalArgumentException - If type is illegal.
WfXMLMessageException - If the message type is not REQUEST. This exception is also thrown if no message type has been set at all.

getResponseRequired

public short getResponseRequired()
                          throws WfXMLMessageException
Use this method to get the 'response required' setting of the message. If no value has been set or 'response required' does not make sense in this message, an exception is thrown.

Returns:
A short representing the response required value of this message. The returned value may be RESPONSE_REQUIRED, RESPONSE_NOT_REQUIRED, or RESPONSE_REQUIRED_ONERROR.
Throws:
WfXMLMessageException - in the following cases:
  • the message is not a request message
  • the 'response required' is not set in this message
  • 'response required' contains an unsupported value

setException

public void setException(WfXMLException exception)
                  throws WfXMLMessageException
Use this method to set an exception for a response message or remove a previously set exception. If you want to set an exception, you have to create a WfXMLException object, which represents a WfXML exception as defined in the WfXML specification.
When you set an exception in a message, all other message content will be deleted. The Wf-XML specification defines, that a message can contain its content or an exception, but not both. Furthermore, a message can always only contain one exception and not more. So, if you set an exception and there already exists a previously set exception, the old exception will be replaced by the new one.

Parameters:
exception - The WfXMLException object you want to set for this message. If you want to remove a previously set exception, you must pass null as parameter here.
Throws:
WfXMLMessageException - in one of the following cases:
  • The exception is invalid.
  • You called the method on a message which is not a response message.

getException

public WfXMLException getException()
                            throws WfXMLMessageException
Use this method to check if the message contains an exception and retrieve a WfXMLException object representing the exception. Exceptions can only be contained in response messages, so a WfXMLMessageException will be thrown if you call this method for any other message type.

Returns:
if the message contains an exception, the exception is returned. Otherwise null will be returned.
Throws:
WfXMLMessageException - if the message is no response message or if the message contains an exception with invalid error codes (e.g., non integer values).

createMessage

public static WfXMLMessage createMessage(java.lang.String xmlContent)
                                  throws java.lang.Exception
This static method creates a WfXMLMessage object out of a String containing the XML data. The runtime data type of the returned message depends on the provided XML String. It can be any of the available subclasses that extend the abstract WfXMLMessage class.

Parameters:
xmlContent - A String containg the XML representation of a WfXML message.
Returns:
A reference to a WfXMLMessage object, which has been created out of the given XML content.
Throws:
java.lang.Exception - if problems occur. This can happen because of various reasons:
  • The xmlContent parameter doesn't contain valid XML.
  • The version of the message is not supported.
  • The root element is not valid.
  • The message doesn't contain a body element.
  • ...

createMessage

protected static WfXMLMessage createMessage(java.lang.String xmlContent,
                                            boolean justIDs)
                                     throws java.lang.Exception
This method creates a WfXMLMessage object out of a String containing XML data. It is supposed to be called from the wfxml test client, because the test client can't use @enterprise objects such as users.
For more details on parameters and return values, see createMessage(String).

Parameters:
justIDs - true means that only ids are used and no objects are created (for users, depts, etc.). false creates objects. The public createMessage(String) method calls this method with justIDs = false.
Throws:
java.lang.Exception

prepare

public abstract void prepare(Partner partner)
This method is called before the message is sent. Here the message can prepare things that could not be prepared earlier, e.g., the key always contains a partner-dependent part, which is only known when the message is sent.
Every subclass must implement this method.

Parameters:
partner - the communication partner to which the message will be sent.

getParameterValueElem

protected org.jdom.Element getParameterValueElem(org.jdom.Element parent,
                                                 java.lang.String parameterName,
                                                 boolean create)
This method returns a reference to the Value element of a parameter with the name parameterName. The parameter must be located under the parent element (typically the parent element will be a ContextData, ResultData, or similar element).

You can use this method if you want to read parameters or also if you want to change parameters. Use create to indicate if new parameters should be created (if necessary) or not.
If the parameter already exists, you get a reference to the Value element of the existing parameter (so you can read and also change the value). If the parameter does not exist, it depends on the create value, if a new parameter with the given name will be created or not. If one will be created a reference to the Value element of this new parameter will be returned (so you should set the value of the new parameter afterwards).

Parameters:
parent - Reference to the parent element, under which the parameter is located or will be created. Typically this parent element is a ContextData element or something similar. If you pass null here, this method doesn't do anything and null will be returned.
parameterName - The name of the paremter for which you want to retrieve the Value element.
create - If set to true, a new parameter with the given name parameterName will be created if the parameter doesn't already exist. If you set it to false the method returns null in order to indicate that the parameter does not exist.
Returns:
A JDOM Element object which represents the value of the requested parameter. If the parameter was not found and you set create to false then null will be returned. If parent is null, the return value will also be null, because nothing can be done in such a case.

addParameterValueElem

protected org.jdom.Element addParameterValueElem(org.jdom.Element parent,
                                                 java.lang.String parameterName)
This method returns a reference to a new value element for a parameter with the name parameterName. The parameter is located under the parent element (ContextData, ResultData, ...). This method is similar to the getParameterValueElem method. The only difference is that you can set multiple values with this method, whereas the getParameterValueElem method overwrites values, if they already exist.
If the parameter doesn't exist, it will be created.

Parameters:
parent - The parent element under which the parameter is located or will be created. Typically this is an element like ContextData, ResultSet, or similar.
parameterName - The name of the parameter for which you want to add a value element. If the parameter does not already exist, it will be created.
Returns:
A reference to the new value element. You should add content to this element afterwards.

getParameterValueElems

protected java.util.Collection getParameterValueElems(org.jdom.Element parent,
                                                      java.lang.String parameterName)
This method can be used for reading all value elements of a parameter specified by parameterName. The method searches for parameters under the JDOM Element parent.

Parameters:
parent - JDOM Element in which you want to search for parameters.
parameterName - The name of the parameter that you are searching for.
Returns:
A Collection containing references to all the Value elements that have been found for the given parameterName. So the content of the collection are JDOM Element objects (one for each Value). The collection is empty if the parameter does not have values or if the parameter has not been found.

getPlainKey

public java.lang.String getPlainKey()
Returns the key of the message "as it is". So you can receive the whole complete key with this method.

Returns:
The complete key as String, or null if no key has been set in the message.

setPlainKey

public void setPlainKey(java.lang.String key)
This method sets a complete key for the message. The key will be set as you provide it here. If you communicate with an @enterprise server, it will be easier to use the set key methods of the various message types.

Parameters:
key - A complete key that will be set for the message.

toString

public java.lang.String toString()
Returns a String representation of the message.
Mind: usually you never need this method when using the WfXML implementation. It is just there for testing purposes or for cases where you may want to store or log messages somewhere.

Overrides:
toString in class java.lang.Object
Returns:
The message as String.

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Writes the message to an OutputStream.

Throws:
java.io.IOException

toPrettyString

public java.lang.String toPrettyString()
Returns the message as pretty String. There is a linebreak after each line and an indent of two spaces, so that the message can be easily read by humans.
Mind: usually you never need this method when using the WfXML implementation. It is just there for testing purposes or for cases where you may want to store or log messages somewhere.

Returns:
The message as String.

getStateString

public java.lang.String getStateString(short state)
Use this method to get the WfXML String representation of one of the possible process instance states (e.g., PI_STATE_OPEN_RUNNING).

Parameters:
state - The state of which you want to have the String representation.
Returns:
A String with the WfXML name of that state, or null if no such state exists.


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