public class WfXMLForm extends WfXMLObject implements Cloneable
WfXMLObject
for a general explanation and
examples.Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
content |
protected static String |
FIELDDT |
protected static String |
FORM_FIELD |
protected static String |
FORM_FIELDNAME |
protected static String |
FORMID |
protected String |
formName |
protected static String |
FORMSUBID |
protected static String |
FORMUSER |
protected static String |
FORMVERSION |
protected String |
id |
protected int |
subformId |
protected MultiMap<Integer,WfXMLForm> |
subForms |
protected int |
version |
namespace, notes, userId
Constructor and Description |
---|
WfXMLForm()
Creates a completely empty
WfXMLForm object. |
WfXMLForm(DMSForm dmsForm)
This constructor creates a
WfXMLForm out of a
DMSForm . |
WfXMLForm(String formName,
Element formElem)
Deprecated.
|
WfXMLForm(String id,
int version,
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) |
Modifier and Type | Method and Description |
---|---|
void |
addSubForm(WfXMLForm form,
int subFormId)
Add a subform to this
WfXMLForm . |
void |
attachNote(String subject,
String noteContent,
String noteCreator,
boolean isPrivate)
Adds a note to this form.
|
void |
attachNote(WfXMLNote note)
Adds a note to this form.
|
Object |
clone()
Use the clone method if you need a copy of this WfXMLForm.
|
DMSObject |
createDMSObject(User defaultCreator)
|
void |
fill(DMSObject existingForm,
User defaultCreator)
|
Element |
getAsXML()
Use this method to get the content of this form represented as XML (with
JDOM elements).
|
Object |
getField(String name)
Use this method to retrieve the value of one of this form's fields.
|
String |
getFormName()
Returns the form name, with which the form is defined in process
definitions.
|
String |
getId()
Returns the id that has been set for this form.
|
String |
getName()
This method returns the form name.
|
List<WfXMLNote> |
getNotes()
Returns a
List with all attached notes. |
int |
getSubformId()
Returns the subform id.
|
List<WfXMLForm> |
getSubForms(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(String name)
This method removes a field from this form.
|
void |
setField(String name,
double value)
Set a field to a double value.
|
void |
setField(String name,
int value)
This method sets a field to an integer value.
|
void |
setField(String name,
long value)
This method sets a field to a long value.
|
void |
setField(String name,
Object value)
Use this method to set a field to various values.
|
void |
setFormName(String formName)
Set the form name, with which the form is defined in process definitions.
|
void |
setId(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.
|
createInstance, createInstance, createInstance, getUser, getUser, getUserId, setUserId
protected static final String FORMID
protected static final String FORMVERSION
protected static final String FORMSUBID
protected static final String FORMUSER
protected static final String FIELDDT
protected static final String FORM_FIELD
protected static final String FORM_FIELDNAME
protected String formName
protected String id
protected int version
protected int subformId
public WfXMLForm()
WfXMLForm
object. Use the
setter and add methods to add content to the form.public WfXMLForm(String id, int version, 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(String formName, Element formElem)
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.IllegalArgumentException
- if formElem
is an unexpected element with no
form data.public void setId(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 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 String getFormName()
null
if no
form name has been specified.public void setFormName(String formName)
formName
- A string containing the form namepublic void setField(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(String name, int value)
getField
method, you will receive a
Integer
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(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(String name, 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 Object getField(String name)
Object
because it is not
sure what lies behind the field. Object can be one of the following:
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(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 void attachNote(String subject, String noteContent, 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 List<WfXMLNote> getNotes()
WfXMLNote
objects. Use the returned list in a
read-only way!public DMSObject createDMSObject(User defaultCreator) throws 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
.Exception
- if creating the DMSForm
fails
(e.g., no user found, etc.).public void fill(DMSObject existingForm, User defaultCreator) throws 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.Exception
- if no user could be found, or if something fails while
objects are created and attached/added.public 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 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 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())
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.