|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.wfxml.WfXMLObject com.groiss.wfxml.WfXMLForm
public class WfXMLForm
This class can be used to represent forms. You can create new empty forms and
add content to them. You can also create a WfXMLForm out of an existing
DMSForm.
When you have created a WfXMLForm according to your needs, you can use it for
sending within WfXML messages, and for creating DMSForms out of it.
See the super class WfXMLObject
for a general explanation and
examples.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
content
|
protected static java.lang.String |
FIELDDT
|
protected static java.lang.String |
FORM_FIELD
|
protected static java.lang.String |
FORM_FIELDNAME
|
protected static java.lang.String |
FORMID
|
protected java.lang.String |
formName
|
protected static java.lang.String |
FORMSUBID
|
protected static java.lang.String |
FORMUSER
|
protected static java.lang.String |
FORMVERSION
|
protected java.lang.String |
id
|
protected int |
subformId
|
protected MultiMap<java.lang.Integer,WfXMLForm> |
subForms
|
protected int |
version
|
Fields inherited from class com.groiss.wfxml.WfXMLObject |
---|
namespace, notes, userId |
Constructor Summary | |
---|---|
WfXMLForm()
Creates a completely empty WfXMLForm object. |
|
WfXMLForm(DMSForm dmsForm)
This constructor creates a WfXMLForm out of a
DMSForm . |
|
WfXMLForm(java.lang.String formName,
org.jdom.Element formElem)
Deprecated. |
|
WfXMLForm(java.lang.String id,
int version,
java.lang.String userId)
Creates an empty WfXMLForm object and sets a form name, a
class name, and a creator user id for the form. |
|
WfXMLForm(org.apache.xmlbeans.XmlObject obj)
|
Method Summary | |
---|---|
void |
addSubForm(WfXMLForm form,
int subFormId)
Add a subform to this WfXMLForm . |
void |
attachNote(java.lang.String subject,
java.lang.String noteContent,
java.lang.String noteCreator,
boolean isPrivate)
Adds a note to this form. |
void |
attachNote(WfXMLNote note)
Adds a note to this form. |
java.lang.Object |
clone()
Use the clone method if you need a copy of this WfXMLForm. |
DMSObject |
createDMSObject(User defaultCreator)
This method creates DMSObject objects
out of this WfXMLForm . |
void |
fill(DMSObject existingForm,
User defaultCreator)
This method fills an existing DMSForm with
the values of this WfXMLForm . |
org.jdom.Element |
getAsXML()
Use this method to get the content of this form represented as XML (with JDOM elements). |
java.lang.Object |
getField(java.lang.String name)
Use this method to retrieve the value of one of this form's fields. |
java.lang.String |
getFormName()
Returns the form name, with which the form is defined in process definitions. |
java.lang.String |
getId()
Returns the id that has been set for this form. |
java.lang.String |
getName()
This method returns the form name. |
java.util.List<WfXMLNote> |
getNotes()
Returns a List with all attached notes. |
int |
getSubformId()
Returns the subform id. |
java.util.List |
getSubForms(java.lang.String subId)
Returns a List containing all subforms for the
given id. |
int |
getVersion()
Returns the version that has been set for this form. |
org.apache.xmlbeans.XmlObject |
getXMLObject()
|
void |
removeField(java.lang.String name)
This method removes a field from this form. |
void |
setField(java.lang.String name,
double value)
Set a field to a double value. |
void |
setField(java.lang.String name,
long value)
This method sets a field to an integer value. |
void |
setField(java.lang.String name,
java.lang.Object value)
Use this method to set a field to various values. |
void |
setFormName(java.lang.String formName)
Set the form name, with which the form is defined in process definitions. |
void |
setId(java.lang.String id)
Sets an id for this WfXMLForm . |
void |
setSubformId(int id)
Set a subform id for this form. |
void |
setVersion(int version)
Use this method to set a version for the form. |
Methods inherited from class com.groiss.wfxml.WfXMLObject |
---|
createInstance, createInstance, createInstance, getUser, getUser, getUserId, setUserId |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String FORMID
protected static final java.lang.String FORMVERSION
protected static final java.lang.String FORMSUBID
protected static final java.lang.String FORMUSER
protected static final java.lang.String FIELDDT
protected static final java.lang.String FORM_FIELD
protected static final java.lang.String FORM_FIELDNAME
protected java.lang.String formName
protected java.lang.String id
protected int version
protected int subformId
protected java.util.Map<java.lang.String,java.lang.Object> content
protected MultiMap<java.lang.Integer,WfXMLForm> subForms
Constructor Detail |
---|
public WfXMLForm()
WfXMLForm
object. Use the
setter and add methods to add content to the form.
public WfXMLForm(java.lang.String id, int version, java.lang.String userId)
WfXMLForm
object and sets a form name, a
class name, and a creator user id for the form. Use the setter and add
methods to add content to the form.
id
- id
and version
are used to
identify a FormType
when a
DMSForm
object is created with
this form.version
- The version of the FormType
(see id
).userId
- With this parameter you can specify the id of a user, who will
be used when a DMSForm
is
created out of this form. If you don't want to set a special
user for creating the form, you can simply pass
null
(in that case, WfXMLForm
will try to create the DMSForm
with another user --- default document creator, process
instance creator...). If no user can be found, creating the
DMSForm
will fail.public WfXMLForm(org.apache.xmlbeans.XmlObject obj)
@Deprecated public WfXMLForm(java.lang.String formName, org.jdom.Element formElem) throws java.lang.IllegalArgumentException
WfXMLForm
object out of a
JDOM Element
.
formName
- A form name if this form is used as process form. The form
name must be a form name defined in a process definition. If
this is no process form, pass null
.formElem
- JDOM Element
where the whole form content is
located.
java.lang.IllegalArgumentException
- if formElem
is an unexpected element with no
form data.public WfXMLForm(DMSForm dmsForm) throws java.lang.Exception
WfXMLForm
out of a
DMSForm
. The WfXMLForm
will contain all fields, referenced forms, subforms, and attached notes.
dmsForm
- The DMSForm
of which you want
to create a WfXMLForm.
java.lang.Exception
- if the DMSForm
is not filled
and cannot be filled.Method Detail |
---|
public void setId(java.lang.String id)
WfXMLForm
. Together, id and version are used
to identify the FormType
of which this
WfXMLForm
is.
id
- The id you want to set for this form.public java.lang.String getId()
FormType
of which this
WfXMLForm
is.
public void setVersion(int version)
FormType
, which will be used
when a DMSForm
is created.
version
- The new version you want to set for this form.
version
should be a positive value.public int getVersion()
FormType
, which will
be used when a DMSForm
is created.
-1
indicates, that no version has been set.public void setSubformId(int id)
id
- The subform id (should be a positive value).public int getSubformId()
-1
means, that no
subform id has been set.public java.lang.String getFormName()
null
if no
form name has been specified.public void setFormName(java.lang.String formName)
formName
- A string containing the form namepublic void setField(java.lang.String name, long value)
getField
method, you will receive a
Long
object.
name
- Name of the field. If a field with this name already exists,
the old value will be overwritten.value
- An integer value for that field.public void setField(java.lang.String name, double value)
getField(java.lang.String)
you will receive a Double
object.
name
- Name of the parameter you want to set.value
- A decimal value.public void setField(java.lang.String name, java.lang.Object value)
value
can be one of the following:String
, a simple text value.Long
, an integer value (you can use
setField(String, long)
to set a long value
without creating an object.).Double
, a decimal value (see also
setField(String, double)
).Date
, a date (and time) value.User
, a user.Role
, a role.OrgUnit
, a organizational unit.WfXMLForm
, a reference to another form.
name
- The name of the field. If a field with this name already
exists, the old field value will be lost.value
- An Object holding the value that you want to set.public java.lang.Object getField(java.lang.String name)
Object
because it is not
sure what lies behind the field. Object can be one of the following:
String
, a simple text value.Long
, an integer number.Double
, a decimal value.Date
, a date (and time) value.User
, a user.Role
, a role.OrgUnit
, a organizational unit.WfXMLForm
, if the field references another form.
name
- The name of the field that you want to retrieve.
null
if no value is set for a field with the name
name
.public void removeField(java.lang.String name)
name
- The name of the field you want to remove.public void addSubForm(WfXMLForm form, int subFormId)
WfXMLForm
. You must specify an
id for adding the subform. The type of the added form is set to
TYPE_SUB
automatically.
form
- A WfXMLForm
you want to add as subform.subFormId
- The id for which the subform will be added.public java.util.List getSubForms(java.lang.String subId)
List
containing all subforms for the
given id. The list contains WfXMLForm
objects.
subId
- The id for which you want to receive subforms.
List
with all subforms (WfXMLForm
objects). Use the returned list in a read-only way!public void attachNote(java.lang.String subject, java.lang.String noteContent, java.lang.String noteCreator, boolean isPrivate)
DMSObject
objects are created with the
createDMSObject
method.
subject
- A subject for the note.noteContent
- The content of the note.noteCreator
- The user id of the user who is the creator of the note. If you
don't want to set a special user here, use null
.
In that case another user will be used for creating the note
(line in the createDMSObject
method.isPrivate
- true
makes the note private, thus being
viewable only for its creator. false
means that
the note is public and can be viewed by anybody.public void attachNote(WfXMLNote note)
DMSObject
objects are created with the
createDMSObject
method.
note
- A WfXMLNote
object representing the note
that you want to add.public java.util.List<WfXMLNote> getNotes()
List
with all attached notes. The
List
is filled with WfXMLNote
objects.
WfXMLNote
objects. Use the returned list in a
read-only way!public DMSObject createDMSObject(User defaultCreator) throws java.lang.Exception
DMSObject
objects
out of this WfXMLForm
. At least a
DMSForm
object will be created. That
object represents this form. Additionally other objects may be created
(e.g., subforms, notes, ...).defaultCreator
to create objects. If no user can be found
at all, an exception is thrown.
createDMSObject
in class WfXMLObject
defaultCreator
- DMSObjects will be created with this user, if no particular
user is defined for them. If you don't want to set a default
creator, simply pass null
.
DMSForm
, which
represents this WfXMLForm
.
java.lang.Exception
- if creating the DMSForm
fails
(e.g., no user found, etc.).public void fill(DMSObject existingForm, User defaultCreator) throws java.lang.Exception
DMSForm
with
the values of this WfXMLForm
. It's similar to
createDMSObject(com.groiss.org.User)
, with the only difference, that the
DMSForm
must already exist.DMSForm
. All values that have been
defined in this WfXMLForm
will be set in the
DMSForm
. So values, which exist in the
DMSForm
, will not be changed, if they are
not defined in the WfXMLForm
...
fill
in class WfXMLObject
existingForm
- An existing DMSForm
, which
will be filled with the values set in this WfXMLForm
.
If you pass an object of a different type to this method,
nothing will be done.defaultCreator
- A default user for creating objects (notes, subforms), if no
particular user is defined for creating them. You can set this
parameter to null
if you don't want to provide
a default creator.
java.lang.Exception
- if no user could be found, or if something fails while
objects are created and attached/added.public java.lang.String getName()
FormType
must be present (id
and version
). If no such form type exists on the local
server, null
will be returned.
getName
in class WfXMLObject
null
if the name
cannot be read. That might happen if the specified form type is
not available, or if the form does not contain any of the fields
which form the name.public org.jdom.Element getAsXML()
getAsXML
in class WfXMLObject
Element
containing the whole
content of this form.public org.apache.xmlbeans.XmlObject getXMLObject()
getXMLObject
in class WfXMLObject
public java.lang.Object clone()
getField(String)
, you will retrieve a
reference to the WfXMLForm object which is still referenced by the old
form (of which the copy was made), too.getSubForms
method, changes to that list do not
affect the old form (because that List has been copied, too), but: the
WfXMLForm objects referenced by this List were not copied, so again you
retrieve references to the same WfXMLForm objects that are also still
referenced by the old form, when you access the List's content.getNotes
gives you a list of all notes. This list
is copied, so changes to the list don't affect the old WfXMLForm. If you
access the content of the list and if you change the WfXMLNote
objects, which are in the list, the WfXMLNote
objects of the old
WfXMLForm are also changed.
getField
)removeField
)new WfXMLForm(null, yourOldForm.getAsXML())
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |