public abstract class WfXMLMessage extends Object
Sender
class.Modifier and Type | Field and Description |
---|---|
protected Element |
body
Body Element of the message.
|
protected static 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 String |
documentCreatorId |
protected Element |
header
Header Element of the message.
|
protected static org.slf4j.Logger |
logger |
protected Document |
message
Reference to the jdom XML message which is encapsulated by this WfXMLMessage
|
protected static String |
MSG_BODY |
protected static String |
MSG_BODY_CTXDATA |
protected static String |
MSG_BODY_CTXDATA_DMSFOLDER |
protected static String |
MSG_BODY_CTXDATA_NOTES |
protected static String |
MSG_BODY_CTXDATA_PROCESSFORMS |
protected static String |
MSG_BODY_CTXDATA_PROCESSFORMS_NAME |
protected static String |
MSG_BODY_EXC |
protected static String |
MSG_BODY_EXC_DESC |
protected static String |
MSG_BODY_EXC_MAINCODE |
protected static String |
MSG_BODY_EXC_SUBCODE |
protected static String |
MSG_BODY_EXC_SUBJECT |
protected static String |
MSG_BODY_EXC_TYPE |
protected static String |
MSG_BODY_RSLTDATA |
protected static String |
MSG_BODY_RSLTDATASET |
protected static String |
MSG_BODY_SET_NAME |
protected static String |
MSG_BODY_SET_PARAM |
protected static String |
MSG_BODY_SET_VALUE |
protected static String |
MSG_HEAD |
protected static String |
MSG_HEAD_KEY |
protected static String |
MSG_HEAD_REQ |
protected static String |
MSG_HEAD_RESP |
protected static String |
MSG_HEAD_RESPREQUIRED |
protected static String |
MSG_HEAD_RESPREQUIRED_NO |
protected static String |
MSG_HEAD_RESPREQUIRED_ONERROR |
protected static String |
MSG_HEAD_RESPREQUIRED_YES |
protected static String |
MSG_ROOT |
protected static String |
MSG_TRANSPORT |
protected static String |
MSG_TRANSPORT_CORDATA |
protected static String |
MSG_TRANSPORT_CORDATA_OID |
protected static String |
MSG_TRANSPORT_CORDATA_ORIGIN |
protected static String |
MSG_TRANSPORT_CORDATA_TIMESTAMP |
protected static String |
MSG_VERSION |
protected Namespace |
namespace
Namespace of this message.
|
static short |
PI_STATE_CLOSED_ABNORMAL_COMPLETED |
protected static String |
PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR |
static short |
PI_STATE_CLOSED_COMPLETED |
protected static String |
PI_STATE_CLOSED_COMPLETED_STR |
static short |
PI_STATE_NONE |
static short |
PI_STATE_OPEN_NOTRUNNING |
protected static String |
PI_STATE_OPEN_NOTRUNNING_STR |
static short |
PI_STATE_OPEN_RUNNING |
protected static 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 Element |
root
The root element of the message.
|
protected 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.
|
Modifier | Constructor and Description |
---|---|
protected |
WfXMLMessage(Document doc)
Internal constructor that can be called to create a WfXMLMessage object out
of an existing document.
|
Modifier and Type | Method and Description |
---|---|
protected Element |
addParameterValueElem(Element parent,
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(String xmlContent)
This static method creates a
WfXMLMessage object out of
a String containing the XML data. |
protected static WfXMLMessage |
createMessage(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. |
String |
getMessageIdentifier()
Get the message identifier out of this message.
|
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 Element |
getParameterValueElem(Element parent,
String parameterName,
boolean create)
This method returns a reference to the Value element of a parameter
with the name
parameterName . |
protected Collection<Element> |
getParameterValueElems(Element parent,
String parameterName)
This method can be used for reading all value elements of a parameter
specified by
parameterName . |
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.
|
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 ). |
String |
getTimestamp()
Use this method to get the message's timestamp.
|
protected String |
getTransportElementValue(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(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(String id)
Use this method to set a message identifier in the transport part of the
message.
|
protected void |
setMessageOrigin(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(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(String timestamp)
When a new WfXML message is created, the abstract constructor uses this method
to set a timestamp in it.
|
protected void |
setTransportElement(String elemName,
String value)
This method is internally used for setting a value in the CorrelationData
part of the message's transport part.
|
String |
toPrettyString()
Returns the message as pretty String.
|
String |
toString()
Returns a String representation of the message.
|
void |
write(OutputStream os)
Writes the message to an OutputStream.
|
protected static final org.slf4j.Logger logger
public static final short RESPONSE
public static final short REQUEST
public static final short RESPONSE_REQUIRED
public static final short RESPONSE_NOT_REQUIRED
public static final short RESPONSE_REQUIRED_ONERROR
public static final short PI_STATE_NONE
public static final short PI_STATE_OPEN_NOTRUNNING
public static final short PI_STATE_OPEN_RUNNING
public static final short PI_STATE_CLOSED_COMPLETED
public static final short PI_STATE_CLOSED_ABNORMAL_COMPLETED
protected static final String MSG_ROOT
protected static final String MSG_VERSION
protected static final String MSG_TRANSPORT
protected static final String MSG_TRANSPORT_CORDATA
protected static final String MSG_TRANSPORT_CORDATA_OID
protected static final String MSG_TRANSPORT_CORDATA_ORIGIN
protected static final String MSG_TRANSPORT_CORDATA_TIMESTAMP
protected static final String MSG_HEAD
protected static final String MSG_HEAD_REQ
protected static final String MSG_HEAD_RESP
protected static final String MSG_HEAD_RESPREQUIRED
protected static final String MSG_HEAD_RESPREQUIRED_YES
protected static final String MSG_HEAD_RESPREQUIRED_NO
protected static final String MSG_HEAD_RESPREQUIRED_ONERROR
protected static final String MSG_HEAD_KEY
protected static final String MSG_BODY
protected static final String MSG_BODY_CTXDATA
protected static final String MSG_BODY_CTXDATA_PROCESSFORMS
protected static final String MSG_BODY_CTXDATA_PROCESSFORMS_NAME
protected static final String MSG_BODY_CTXDATA_DMSFOLDER
protected static final String MSG_BODY_CTXDATA_NOTES
protected static final String MSG_BODY_RSLTDATASET
protected static final String MSG_BODY_RSLTDATA
protected static final String MSG_BODY_SET_PARAM
protected static final String MSG_BODY_SET_NAME
protected static final String MSG_BODY_SET_VALUE
protected static final String MSG_BODY_EXC
protected static final String MSG_BODY_EXC_MAINCODE
protected static final String MSG_BODY_EXC_TYPE
protected static final String MSG_BODY_EXC_SUBJECT
protected static final String MSG_BODY_EXC_SUBCODE
protected static final String MSG_BODY_EXC_DESC
protected static final String PI_STATE_OPEN_NOTRUNNING_STR
protected static final String PI_STATE_OPEN_RUNNING_STR
protected static final String PI_STATE_CLOSED_COMPLETED_STR
protected static final String PI_STATE_CLOSED_ABNORMAL_COMPLETED_STR
protected static final String CONTEXTDATA_DOCUMENTCREATOR
protected Document message
protected Namespace namespace
WfXMLSettings
protected Element root
protected Element transport
protected Element header
protected Element body
protected com.dec.avw.core.User documentCreator
protected String documentCreatorId
protected boolean usingPlainKey
protected WfXMLMessage(Document doc)
doc
- The JDOM document out of which a WfXMLMessage has to be created.protected void assureBodyExists()
protected void assureHeaderExists()
protected void assureTransportExists()
public void setMessageIdentifier(String id)
id
- An identifier that you want to set for this message. Pass null
in order to remove a previously set identifier.protected void setMessageOrigin(String partnerId)
partnerId
- The partner id that will be set as origin of the message.protected void setTimestamp(String timestamp)
timestamp
- A timestamp String.public String getTimestamp()
null
.protected void setTransportElement(String elemName, String value)
null
as
value parameter.elemName
- Name of the element for which a value will be set.value
- The value that will be set (null
to remove an
element).public String getMessageIdentifier()
setMessageIdentifier(java.lang.String)
for more details about what the message identifier is.null
if
no such message identifier has been set for this message.public String getMessageOrigin()
Partner
from which the message
originates.null
if no origin has been set in the message.protected String getTransportElementValue(String elemName)
elemName
- The name of the element for which you want to get a value.null
if the element does
not exist.protected void setMessageType(short type)
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.IllegalArgumentException
- If type is illegal.public void setDocumentCreator(String userId)
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
.public User getDocumentCreator()
setDocumentCreator
.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.public short getMessageType() throws WfXMLMessageException
REQUEST
for request messages or RESPONSE
for
response messages.WfXMLMessageException
- if the message type has not been set so far.public void setResponseRequired(short type) throws WfXMLMessageException
type
- The type that you want to set. Use one of the following values: RESPONSE_REQUIRED
,
RESPONSE_NOT_REQUIRED
, or RESPONSE_REQUIRED_ONERROR
.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.public short getResponseRequired() throws WfXMLMessageException
short
representing the response required value of
this message. The returned value may be RESPONSE_REQUIRED
,
RESPONSE_NOT_REQUIRED
, or RESPONSE_REQUIRED_ONERROR
.WfXMLMessageException
- in the following cases:
public void setException(WfXMLException exception) throws WfXMLMessageException
WfXMLException
object, which represents a WfXML exception as defined in
the WfXML specification.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.WfXMLMessageException
- in one of the following cases:public WfXMLException getException() throws WfXMLMessageException
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.null
will be returned.WfXMLMessageException
- if the message is no response message or if
the message contains an exception with invalid error codes (e.g., non
integer values).public static WfXMLMessage createMessage(String xmlContent) throws Exception
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.xmlContent
- A String containg the XML representation of a WfXML message.Exception
- if problems occur. This can happen because of
various reasons:xmlContent
parameter doesn't contain valid XML.protected static WfXMLMessage createMessage(String xmlContent, boolean justIDs) throws Exception
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.createMessage(String)
.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
.Exception
public abstract void prepare(Partner partner)
partner
- the communication partner to which the message will be sent.protected Element getParameterValueElem(Element parent, String parameterName, boolean create)
parameterName
. The parameter must be located
under the parent
element (typically the parent
element will be a ContextData, ResultData, or similar element).create
to indicate if new
parameters should be created (if necessary) or not.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).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.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.protected Element addParameterValueElem(Element parent, String parameterName)
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.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.protected Collection<Element> getParameterValueElems(Element parent, String parameterName)
parameterName
. The method searches for parameters
under the JDOM Element
parent
.parent
- JDOM Element
in which you want to
search for parameters.parameterName
- The name of the parameter that you are searching for.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.public String getPlainKey()
String
, or null
if no
key has been set in the message.public void setPlainKey(String key)
key
- A complete key that will be set for the message.public String toString()
public void write(OutputStream os) throws IOException
IOException
public String toPrettyString()
public String getStateString(short state)
PI_STATE_OPEN_RUNNING
).state
- The state of which you want to have the String representation.null
if
no such state exists.@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.