|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.wfxml.WfXMLMessage
com.groiss.wfxml.CreatePIMessage
public class CreatePIMessage
This message is used for creating a new process instance on a partner server. It provides a lot of various methods for adding all kind of content (process forms, notes, DMS folder content, self-defined parameters...). See the documentation of the methods for further details.
| Field Summary | |
|---|---|
protected static java.lang.String |
MSG_BODY_REQ
|
protected static java.lang.String |
MSG_BODY_RESP
|
| Constructor Summary | |
|---|---|
protected |
CreatePIMessage(org.jdom.Document doc)
This method is used internally for creating a create process instance message out of a xml document. |
protected |
CreatePIMessage(org.jdom.Document doc,
boolean justIDs)
That's a special constructor which doesn't try to create user objects out of the users that are specified in the message. |
|
CreatePIMessage(short messageType)
Use this method to create a new and empty CreatePIMessage object. |
| Method Summary | |
|---|---|
void |
addParameter(java.lang.String parameterName,
org.jdom.Element content)
Like addParameter(String, String) but you
can add whatever you want (complex structures...) with a JDOM
Element here. |
void |
addParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Use this method to add a parameter to the ContextData part of the request. |
void |
addParameter(java.lang.String parameterName,
WfXMLForm form)
Use this method to add a WfXMLForm as parameter to this
message. |
void |
addProcessForm(java.lang.String formName,
DMSForm form)
Use this method to add process forms to a CreateProcessInstance request message. |
void |
addProcessForm(java.lang.String formName,
WfXMLForm form)
Like addProcessForm(String,DMSForm),
but you can add a form here, without having a DMSForm available. |
void |
addToDMSFolder(java.util.Collection objects)
Use this method to add multiple DMSObjects at once by providing a Collection containing
DMSObject objects. |
void |
addToDMSFolder(java.util.Collection objects,
java.util.Collection documentTypes)
This method adds a Collection of DMSObject
objects to the DMS folder of this message. |
void |
addToDMSFolder(DMSObject obj)
This method adds a DMSObject to the message. |
void |
addToDMSFolder(WfXMLObject obj)
Use this method to add any WfXMLObject to the process instance's
DMSFolder without having a DMSObject. |
void |
attachNote(DMSNote note)
Use this method if you want that a note will be attached to the process instance that will be created. |
void |
attachNote(java.lang.String subject,
java.lang.String content,
java.lang.String userId,
boolean isPrivate)
Use this method to quickly attach notes without creating WfXMLNote
or DMSNote objects. |
void |
attachNote(WfXMLNote note)
This method attaches a WfXMLNote to this message. |
java.util.Collection |
createAttachedNotes()
Use this method to get all attached notes out of this message (these are notes which should be attached directly to the new process instance). |
java.util.Collection |
getAttachedNotes()
Use this method to get all attached notes as WfXMLNote objects. |
java.lang.String |
getDescription()
Returns the description of request messages. |
java.lang.String |
getKeyApplID()
Returns the application ID part of the key. |
java.lang.String |
getKeyProcDefID()
Returns the process definition ID part of the key. |
int |
getKeyVersion()
Returns the version part of the key. |
java.lang.String |
getName()
Use this method to get the name of the process instance. |
java.lang.String |
getObserverClass()
This method returns the observer class (as String object) which can be set in CreateProcessInstance request messages. |
java.lang.String |
getObserverKey()
This method returns the whole observer key that is set in the 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. |
WfXMLForm |
getParameterForm(java.lang.String parameterName)
Use this method to retrieve a WfXMLForm object representing
a form that has been set for or added to the parameter parameterName. |
WfXMLForm |
getProcessForm(java.lang.String formName)
Use this method to retrieve the data of a process form, if you know the exact form name with which the form is defined in the process definition. |
java.lang.String |
getProcessInstanceKey()
Use this method to get the process instance key out of repsonse messages. |
Agent |
getStartParameterAgent()
Returns an Agent instance representing the user
or role who is specified in the message's start parameters. |
java.lang.String |
getStartParameterAgentID()
Returns the agent id defined in the start parameters of this CreateProcessInstance request message. |
java.util.Date |
getStartParameterDueDate()
Use this method to get the due-date which is set in the start parameters of a CreateProcessInstance request message. |
OrgUnit |
getStartParameterOrgUnit()
Returns a OrgUnit instance representing the
organizational unit which is specified in the message's start parameters. |
java.lang.String |
getStartParameterOrgUnitID()
Returns the organization unit's id defined in the start parameters of this CreateProcessInstance request message. |
java.lang.String |
getSubject()
This method returns the subject for the process instance. |
java.util.List |
listDMSFolderContent()
This method gives you a List holding all the content of
this message's DMS folder (thus, all documents that have to be added to the
new process instance). |
java.util.Collection |
listParameterForms(java.lang.String parameterName)
This method returns a Collection containing
WfXMLForm objects which were set for the given
parameter parameterName. |
java.util.Collection |
listParameterValueElements(java.lang.String parameterName)
This method returns a Collection with all
values (as JDOM Element objects) for the given parameter. |
java.util.Collection |
listParameterValueStrings(java.lang.String parameterName)
Use this method to get a Collection filled with
the strings of all values of a parameter. |
java.util.List |
listProcessForms()
Returns a list with WfXMLForm objects representing the data
of all process forms included in this message. |
void |
prepare(Partner partner)
This method is called by the Sender before the message is sent. |
protected void |
prepare(java.lang.String targetURL)
This method is used by the WfXML test client only! |
void |
setDescription(java.lang.String desc)
A longer description of the purpose for the process instance that will be created with this message. |
void |
setKey(java.lang.String applID,
java.lang.String procdefID,
int version)
Use this method to set the key for this CreateProcessInstance message. |
void |
setMessageType(short type)
Set the message type of this WfXML message (in the message header). |
void |
setName(java.lang.String name)
Sets the name for the process instance. |
void |
setObserver(java.lang.Class observer)
Use this method to set an observer for the process instance that will be created on the remote server by this CreateProcessInstance request. |
protected void |
setObserver(java.lang.String uri)
Setting a dummy observer. |
void |
setParameter(java.lang.String parameterName,
org.jdom.Element content)
Similar to setParameter(String, String)
but you can set your own JDOM Element as content
here. |
void |
setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Use this method for setting a parameter in the ContextData part of request messages. |
void |
setParameter(java.lang.String parameterName,
WfXMLForm form)
Use this method to set a WfXMLForm as a parameter for this
message. |
void |
setProcessInstanceKey(java.lang.String procInstOID)
Sets the process instance key of the newly created process instance. |
void |
setStartParameter(Agent agent,
OrgUnit orgUnit,
java.util.Date dueDate)
Use this method to set the start parameters for CreateProcessInstance request methods. |
void |
setStartParameter(java.lang.String agentID,
java.lang.String agentClassName,
java.lang.String orgUnitID,
java.util.Date dueDate)
This method sets start parameters with which the process instance will be started. |
void |
setSubject(java.lang.String subject)
A subject for the process instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String MSG_BODY_REQ
protected static final java.lang.String MSG_BODY_RESP
| Constructor Detail |
|---|
public CreatePIMessage(short messageType)
CreatePIMessage object.
You must specify the type of message (request or response).
messageType - The type of new message you want to create: this can be
either WfXMLMessage.REQUEST or WfXMLMessage.RESPONSE.
protected CreatePIMessage(org.jdom.Document doc)
throws java.lang.Exception
doc - JDOM Document containing the content for the message.
java.lang.Exception
protected CreatePIMessage(org.jdom.Document doc,
boolean justIDs)
throws java.lang.Exception
doc - JDOM document with the message content.justIDs - true means that just IDs will be used and no
user objects will be created. false creates user objects.
java.lang.Exception| Method Detail |
|---|
public void setMessageType(short type)
throws java.lang.IllegalArgumentException
WfXMLMessage
setMessageType in class WfXMLMessagetype - 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.
java.lang.IllegalArgumentException - If type is illegal.public void setName(java.lang.String name)
name - String containing the name.public java.lang.String getName()
null
if the message doesn't contain a name.public void setProcessInstanceKey(java.lang.String procInstOID)
procInstOID - Unique oid of the process instance.public java.lang.String getProcessInstanceKey()
null
if there is no process instance key in the message (this also happens if
you call this method on a request message).public void setObserver(java.lang.Class observer)
NotifyMessage) and
ProcessInstanceStateChanged (PIStateChangedMessage) requests.
observer - A class implementing the ProcessInstanceObserver
interface. If you want to remove a previously set observer, provide
null as parameter.protected void setObserver(java.lang.String uri)
dummyclass.
uri - Specifies the uri that should be set in the observer.public java.lang.String getObserverKey()
null
if the message doesn't contain an observer key (this also happens if you
call this method for a response message).
public java.lang.String getObserverClass()
throws WfXMLMessageException
getObserverKey method would return.
null
if no observer was defined.
WfXMLMessageException - if the observer key is not compatible to @enterprise
requirements.public void setSubject(java.lang.String subject)
subject - The subject that you wish to be assigned to the process
instance.public java.lang.String getSubject()
null if the message
doesn't contain a subject.public void setDescription(java.lang.String desc)
desc - String containing the description that you want to add.public java.lang.String getDescription()
null if there
is no description. If you call this method for response messages, you will
always receive null, because this element only occurs in
request messages.
public void setKey(java.lang.String applID,
java.lang.String procdefID,
int version)
throws java.lang.IllegalArgumentException
applID - Application ID: this parameter is optional and defines the
application in which the process definition is located. If you don't set
this parameter (null), the default application will be used.procdefID - Process Definition ID: this is the process ID of the process
that you want to start. You must provide this id.version - Defines the version of the process. You can provide a positive
integer value for a specific version, or -1 if you want that
the process definition with the highest version number will be instantiated.
java.lang.IllegalArgumentException - if no process definition ID is defined or version < 0public void prepare(Partner partner)
prepare in class WfXMLMessagepartner - Reference to the Partner object, which holds the
information about the partner, to which the message will be sent.protected void prepare(java.lang.String targetURL)
targetURL - target URL to which the message will be sent.
public java.lang.String getKeyApplID()
throws WfXMLMessageException
setKey(String,String,int) for more details on key parts.
WfXMLMessageException - if any error occurs while reading the key.
public java.lang.String getKeyProcDefID()
throws WfXMLMessageException
setKey(String,String,int) for more details on key parts.
WfXMLMessageException - if any error occurs while reading the key.
public int getKeyVersion()
throws WfXMLMessageException
setKey(String,String,int)
for more details on key parts.
int value containing the version part of the key, or
-1 if no version has been specified. In this case the newest
version should be used.
WfXMLMessageException - if any error occurs while reading the key.
public void attachNote(DMSNote note)
throws java.lang.Exception
addToDMSFolder(DMSObject) method instead.
note - The DMSNote object you want to
attach.
java.lang.Exception - if any other error occurs while the note is added.
public void attachNote(java.lang.String subject,
java.lang.String content,
java.lang.String userId,
boolean isPrivate)
WfXMLNote
or DMSNote objects.subject, a
content, and the ID of a user who will be the creator of the
note on the remote server. The boolean value indicates whether the note will
be private or public.
subject - A Subject for the note.content - The content of the note.userId - ID String of the user. You can set this to null
if you don't want to specify a particular user for this note. In that case
either the default document creator (see WfXMLMessage.setDocumentCreator)
or the starter of the process instance will be set as user.isPrivate - set this parameter to true if this note should
be private (only the specified user will be able to read it), or to
false, if all users should be able to read the note.public void attachNote(WfXMLNote note)
WfXMLNote to this message. The note will be
attached to the new process instance, after it has been started.
note - A WfXMLNote object.public java.util.Collection createAttachedNotes()
DMSNote
objects are created for the notes and returned in a collection.getAttachedNotes() method to get all attached
notes, and then calls WfXMLNote.createDMSObject(com.groiss.org.User) on all of the notes.
DMSNote objects
containing notes for the new process instance. If there are no notes, the
Collection will be empty (this also happens if you call this method for
response messages).public java.util.Collection getAttachedNotes()
WfXMLNote objects. This
method does not create any DMSObject objects.
Collection filled with WfXMLNote
objects representing all attached notes. If there are no notes, or if this
is a response message (which cannot contain notes), you will receive an
empty Collection.
public void addProcessForm(java.lang.String formName,
DMSForm form)
throws java.lang.Exception
formName here, so that the values of the added form will be
used for the correct process form once the process instance has been
created on the communication partner server.
formName - The name of the form as it is defined in the process
definition of the process that will be instantiated.form - A DMSForm object containing
the process form data.
java.lang.Exception - if any error occurs while the process form is
added (database problems, etc.).
public void addProcessForm(java.lang.String formName,
WfXMLForm form)
addProcessForm(String,DMSForm),
but you can add a form here, without having a DMSForm available. See the
other addProcessForm method for more
details.WfXMLForm with this method copies the form's
values to the message. You can modify the WfXMLForm object
afterwards without affecting the data which is stored in this message.
Because of this behavior it is not necessary to clone the WfXMLForm
object!
formName - The name of the form, as it is defined in the process
definition, that you want to instantiate.form - A WfXMLForm will all form data.public WfXMLForm getProcessForm(java.lang.String formName)
DMSForm object, it only
builds a WfXMLForm object with all the data. So you can
control and also change the data before you create a DMSForm
with it.
formName - Name of the form (as defined in the process definition).
WfXMLForm object containing all the form's data,
or null if no form with the given name was found (this also
happens if the message is a response message).public java.util.List listProcessForms()
WfXMLForm objects representing the data
of all process forms included in this message. If you only want one specific
process form, use the getProcessForm(String)
method instead.
List with all process forms (represented
as WfXMLForm objects. If there are no process forms in
the message, the List will be empty. The returned
WfXMLForm objects have the right form names set.
public void addToDMSFolder(DMSObject obj)
throws java.lang.Exception
DMSObject to the message.
DMSObjects can only be added for request messages. After the new process has
been started on the remote server, these objects will be added to its document
folder.addProcessForm
methods instead.attachNote method.obj may be one of the following:
DMSNote - the DMSNote is added (it will
be placed in the document folder, and not attached to the new process
instance!).DMSDocForm - the document (base64 encoded)
and any notes that may be attached to the document are added.DMSFolder - a whole DMSFolder including all
content (also subfolders!) is added.DMSForm - the form plus any referenced forms
and subforms and attached notes are added.DMSLink - the linked object (=> one of the
4 types mentioned before) is added.
obj - The DMSObject that you want to
add to the message.
java.lang.Exception - if any error occurs while the object is added.
WfXMLMessageException - if adding failed because of an error. This
can happen if, e.g., there is not enough memory for adding the object.
public void addToDMSFolder(java.util.Collection objects)
throws java.lang.Exception,
java.lang.IllegalArgumentException
Collection containing
DMSObject objects. The objects of the
collection will be added using the
addToDMSFolder(DMSObject) method.addProcessForm
methods instead.attachNote methods.
objects - Any Collection containing
DMSObject objects. If there are other objects
in the collection, an IllegalArgumentException will be thrown.
java.lang.IllegalArgumentException - if there are other objects than DMSObject
objects in the collection.
java.lang.Exception - if any other error occurs. The message
can be in an undefined state after such an exception. Some objects may
have been added and some others not.
public void addToDMSFolder(java.util.Collection objects,
java.util.Collection documentTypes)
throws java.lang.Exception,
java.lang.IllegalArgumentException
Collection of DMSObject
objects to the DMS folder of this message. The second parameter specifies a set
of document types, that will be added. This has the following effect: all objects
will be added to the DMS folder, but DMSDocForm objects
will be added only if their form type appears in the documentTypes
collection. So you can restrict the types of documents you want to add to this
message. If the objects collection contains folders, the document
types restriction will also be applied to these folders and any subfolders and
so on.
objects - A Collection containing DMSObject
objects.documentTypes - A Collection with FormType
objects. DMSDocForm with other form types will not be added.
java.lang.IllegalArgumentException - If the objects collection contains
an object which is no DMSObject
java.lang.Exception - If other errors occur and the operation fails. The message
can be in an undefined state after such an exception. Some objects may
have been added and some others not.
public void addToDMSFolder(WfXMLObject obj)
throws WfXMLMessageException
WfXMLObject to the process instance's
DMSFolder without having a DMSObject. You
can simply create a WfXMLObject instead and add it with this method.
On response messages this method will not have any effect.
obj - The WfXMLObject you want to add.
WfXMLMessageException - if the object could not be added because of
a runtime problem (e.g., not enough memory for adding the object).public java.util.List listDMSFolderContent()
List holding all the content of
this message's DMS folder (thus, all documents that have to be added to the
new process instance). The list contains the content as
WfXMLObject objects. There are no DMSObject objects
created, when you call this method.createDMSObject method
of the WfXMLObject objects.
List holding the content of the DMS folder in
form of WfXMLObject objects. If there
is no content, the List will be empty.
public void setStartParameter(Agent agent,
OrgUnit orgUnit,
java.util.Date dueDate)
agent - An Agent object (user or role)
representing the agent who starts the process. If you start the process with a
role, the new process instance will appear in the role worklist of this role.
You can set the agent also to null if you don't want
to specify an agent for starting the process instance.orgUnit - A OrgUnit object representing the
organization unit (department) for which the process will be started.
This value can also be set to null, but only if the
remote @enterprise server has an interface defined for starting this process.
Interfaces define a relation between form, process definition, and
organizational unit. If you set this parameter to null the
organizational unit defined in the interface will be used. And if there
is no interface for starting this process, you will get back an exception
message from the remote server.dueDate - A Date object containing a date and
time which will be set as due-date for the process instance. If you don't
provide a value for this parameter (null), no due-date will
be set.
public void setStartParameter(java.lang.String agentID,
java.lang.String agentClassName,
java.lang.String orgUnitID,
java.util.Date dueDate)
setStartParameter, with the
only difference that you don't need to provide User
and OrgUnit objects here. Instead you simply
define the IDs of these parameters.
agentID - String specifying an agent ID. The ID can be the ID of a user
or the ID of a role. Use the agentClassName parameter for
specifying whether it is a user or a role. Set the agentID to
null if you don't want to specify an agent for starting the
process.agentClassName - Set this value to com.dec.avw.core.User
or com.dec.avw.core.Role, depending on whether the
agentID parameter is the ID of a role or of a user. If
agentID is null, you can also set this parameter
to null.orgUnitID - String specifying a org.unit ID. This value can also be
set to null, but only if the remote @enterprise server has
an interface defined for starting this process. Interfaces define a relation
between form, process definition, and organizational unit. If you set this
parameter to null the organizational unit defined in the
interface will be used. And if there is no interface for starting this
process, you will get back an exception message from the remote server.dueDate - A Date object containing the due-date
with which the process will be started. This parameter can also be set to
null.
public java.util.Date getStartParameterDueDate()
throws WfXMLMessageException
Date object representing the date and time
set in the message's start parameters, or null if no due-date
has been set in this message. The returned Date object
contains the time in the local timezone.
WfXMLMessageException - if the date and time defined in this message
don't meet the format requirements defined in the WfXML specification.
public OrgUnit getStartParameterOrgUnit()
throws java.lang.Exception
OrgUnit instance representing the
organizational unit which is specified in the message's start parameters.
OrgUnit instance of the
organizational unit which is specified in the message's start parameters,
or null if no org.unit has been defined or if the defined
org.unit does not exist on the local server.
java.lang.Exceptionpublic java.lang.String getStartParameterOrgUnitID()
String object containing the org.unit's id,
or null if no org.unit has been defined.
public Agent getStartParameterAgent()
throws java.lang.Exception
Agent instance representing the user
or role who is specified in the message's start parameters.
Agent instance of the user or role
who is specified in the message's start parameters, or null
if no agent has been defined or if the defined agent does not exist on
the local server.
java.lang.Exceptionpublic java.lang.String getStartParameterAgentID()
String object containing the agent id, or
null if no agent has been defined.
public void setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
addParameter method instead.
parameterName - Name of the parameter that you want to set.parameterValue - The value for the parameter.
public void setParameter(java.lang.String parameterName,
org.jdom.Element content)
setParameter(String, String)
but you can set your own JDOM Element as content
here. Use this method to add complex, self-defined data...
parameterName - Name of the parameter that you want to set.content - A JDOM Element object containing
everything you want to set as parameter.
public void setParameter(java.lang.String parameterName,
WfXMLForm form)
WfXMLForm as a parameter for this
message. If the parameter already existed before, the old value(s) will be
lost.
parameterName - The name of the parameter you want to set.form - The WfXMLForm you want to add.public java.util.Collection listParameterValueStrings(java.lang.String parameterName)
Collection filled with
the strings of all values of a parameter. You only retrieve the texts of the
parameter's values, so this method makes most sence for "simple" parameters
that have been set with the setParameter(String, String)
or addParameter(String, String) methods.
parameterName - The name of the parameter for which you want to retrieve
the value strings.
Collection containing
String objects representing the texts of all
values of the parameter. The Collection is
empty if the parameter does not contain values or if the parameter was not
found in the message.public java.lang.String getParameter(java.lang.String parameterName)
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.
parameterName - The name of the parameter you are searching for.
String containing the value of the
parameter, or null if the parameter was not found in the
message.public java.util.Collection listParameterForms(java.lang.String parameterName)
Collection containing
WfXMLForm objects which were set for the given
parameter parameterName. If you are sure that there is only
one WfXMLForm set for this parameter, you could also use
the getParameterForm method, which doesn't return
a collection, but only one single WfXMLForm.
parameterName - The name of the parameter for which you want to retrieve
values.
Collection containing
WfXMLForm objects. If the parameter was not found or if
the parameter didn't contain any forms, the returned collection will be
empty.public WfXMLForm getParameterForm(java.lang.String parameterName)
WfXMLForm object representing
a form that has been set for or added to the parameter parameterName.
If the parameter contains more than one form, you will retrieve one of these
forms (it cannot be guaranteed which one!). So if you know that there is
maybe more than one form for this parameter, use the method
listParameterForms, which returns a collection
of all forms, instead.
parameterName - The name of the parameter you want to get a form of.
WfXMLForm object containing the data of the
form, or null if the parameter doesn't exist or if it doesn't
contain a form.public java.util.Collection listParameterValueElements(java.lang.String parameterName)
Collection with all
values (as JDOM Element objects) for the given parameter.
So this method is good for retrieving values which have been set with the
addParameter(String, Element) or
setParameter(String, Element) methods.
parameterName - The name of the parameter for which you want to retrieve
the value elements.
Collection containing
Element objects representing the values of
the parameter. If the paramter is not found, the collection is empty.
public void addParameter(java.lang.String parameterName,
java.lang.String parameterValue)
parameterName - Name of the parameter for which you want to add a value.parameterValue - The value for the parameter.
public void addParameter(java.lang.String parameterName,
org.jdom.Element content)
addParameter(String, String) but you
can add whatever you want (complex structures...) with a JDOM
Element here.
parameterName - Name of the parameter for which you want to add a value.content - A JDOM Element object containing
content (attributes, subelements, etc.). All this content will be added as
a value to the parameter.
public void addParameter(java.lang.String parameterName,
WfXMLForm form)
WfXMLForm as parameter to this
message. Using a WfXMLForm is an easy way to create forms
when you don't have an existing DMSObject
available.listParameterForms
method.
parameterName - The name of the parameter under which you want to add
this form.form - A reference to the WfXMLForm object you want
to add to this parameter.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||