com.groiss.wfxml
Class ChangePIStateMessage

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

public class ChangePIStateMessage
extends WfXMLMessage

This message type can change the state of a process instance. For doing that, you must know the process instance key of the process instance that you want to change (you retrive such a key, e.g., when you create a remote process instance with a CreatePIMessage. The target process id must be set as key for this message type (method setKey(java.lang.String)). With setState(short) you can set the state that you request for the process instance.


Field Summary
protected static java.lang.String MSG_BODY_REQ
           
protected static java.lang.String MSG_BODY_RESP
           
 
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 ChangePIStateMessage(org.jdom.Document doc)
          This method is used internally for creating a ChangePIStateMessage out of a xml document.
  ChangePIStateMessage(short messageType)
          Use this method to create a new ChangePIStateMessage message.
 
Method Summary
 java.lang.String getKey()
          Use this method to get the oid of the target process instance.
 short getState()
          This method returns the state that has been set in this message (works for both requests and responses).
 void prepare(Partner partner)
          This method prepares the message to be sent to a specific partner.
protected  void prepare(java.lang.String targetURL)
          This method is used by the WfXML test client only!
 void setKey(java.lang.String procInstID)
          Sets the key for the ChangeProcessInstanceState message.
 void setMessageType(short type)
          Set the message type of this WfXML message (in the message header).
 void setState(short state)
          Use this method to set the state.
 
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_REQ

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

MSG_BODY_RESP

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

ChangePIStateMessage

public ChangePIStateMessage(short messageType)
Use this method to create a new ChangePIStateMessage message. You must specify the type of message (request or response).

Parameters:
messageType - The type of new message you want to create: this can be either WfXMLMessage.REQUEST or WfXMLMessage.RESPONSE.

ChangePIStateMessage

protected ChangePIStateMessage(org.jdom.Document doc)
This method is used internally for creating a ChangePIStateMessage out of a xml document. After the message has been created, the getter methods can be used to retrieve the content of the message.

Parameters:
doc - JDOM Document containing the content for the message.
Method Detail

setKey

public void setKey(java.lang.String procInstID)
            throws java.lang.IllegalArgumentException
Sets the key for the ChangeProcessInstanceState message. The key defines a process instance on the remote partner server.

Parameters:
procInstID - The unique process instance OID of the process instance on the remote partner server (not a complete key!). This parameter must be provided.
Mind: if you created a remote process instance with WfXML, you retrieved a key for the new remote process instance (@link CreatePIMessage#getProcessInstanceKey}. If you want to use this key as key for this message, use the method WfXMLMessage.setPlainKey(java.lang.String) for setting the key (so you don't need to extract the oid part of the key String).
Throws:
java.lang.IllegalArgumentException - if procInstID == null.

getKey

public java.lang.String getKey()
                        throws WfXMLMessageException
Use this method to get the oid of the target process instance. The method does not return the whole key but only the relevant oid part.

Returns:
The oid of the process instance that is defined in the key of the message. The ChangePIState message is used to change the state of that process instance.
Throws:
WfXMLMessageException - if the key doesn't exist or if it is not compatible to @enterprise requirements.

prepare

public void prepare(Partner partner)
This method prepares the message to be sent to a specific partner. It is called by the Sender before the message is sent, so it should be usually not necessary to call this method yourself.

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

prepare

protected void prepare(java.lang.String targetURL)
This method is used by the WfXML test client only! it sets an arbitrary target URL for this message and does not need to have a Partner object provided.

Parameters:
targetURL - target URL to which the message will be sent.

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.

setState

public void setState(short state)
Use this method to set the state. In request messages it is the state that you request for the process instance. In response messages it is the new state of the process instance after a ChangePIState request has been received.

Parameters:
state - one of the states defined in the WfXMLMessage base class. If you set the state to WfXMLMessage.PI_STATE_NONE state info will be completely removed from the message.

getState

public short getState()
This method returns the state that has been set in this message (works for both requests and responses).

Returns:
The returned short value is one of the constant values defined in the WfXMLMessage base class. If no state is set in this message, the returned value will be WfXMLMessage.PI_STATE_NONE.


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