public abstract class WfXMLObject extends Object
DMSObject
objects and to do a transformation to and
from XML.DMSObject
interface and its subinterfaces.DMSObject
objects works like this:WfXMLNote
-- DMSNote
WfXMLWebLink
-- DMSWebLink
WfXMLForm
-- DMSForm
WfXMLDocForm
-- DMSDocForm
WfXMLFolder
-- DMSFolder
WfXMLObject
-- DMSObject
DMSObject
.
There are two possible ways to do that. If you know the exact type of
DMSObject
that you have, then you should use a
constructor of the corresponding WfXML class. If you don't know the exact
type, you can use the static createInstance(DMSObject)
method of
this class (WfXMLObject) to create the right WfXMLObject out of your
DMSObject
.Element
object, which typically has been created using one of the WfXMLObject
subclasses (but of course, the XML structure can also come from somewhere
else). If you know which type of WfXMLObject the
Element
holds, you can use a constructor of the
corresponding subclass again. If you don't know the type, you should take
the static createInstance(Element)
method for that purpose.WfXMLNote
myNote = new WfXMLNote
("About this", "This is the WfXMLObject class", "gerhard", false);
WfXMLObject myObject = WfXMLObject.createInstance(someDMSObject);
WfXMLForm
myForm = new WfXMLForm
(anyDMSForm);
getAsXML()
method. This method creates a XML structure
holding all the data that has been set in the WfXMLObject.DMSObject
objects out of the WfXMLObject by calling the createDMSObject(User)
method.DMSObject
with the fill(com.groiss.dms.DMSObject, com.groiss.org.User)
method.
myNote.getAsXML();
DMSObject aNewDMSObject = myObject.createDMSObject("gerhard");
(note, that you don't need to know the type of WfXMLObject at all...)myObject.fill(existingDMSObject, aUser);
myForm.setField("subject", "Whatever you want");
myForm.attachNote(myNote);
DMSForm
newDMSForm = myForm.createDMSObject(null);
Modifier and Type | Field and Description |
---|---|
static Namespace |
namespace |
protected List<WfXMLNote> |
notes |
protected String |
userId |
Modifier | Constructor and Description |
---|---|
protected |
WfXMLObject()
This default constructor is called implicitly when one of the subclasses
is instanciated.
|
Modifier and Type | Method and Description |
---|---|
abstract DMSObject |
createDMSObject(User defaultCreator)
This method creates a
DMSObject out of a WfXMLObject. |
static WfXMLObject |
createInstance(DMSObject obj)
Use this method to create a WfXMLObject out of a
DMSObject . |
static WfXMLObject |
createInstance(Element elem)
Deprecated.
|
static WfXMLObject |
createInstance(org.apache.xmlbeans.XmlObject elem) |
abstract void |
fill(DMSObject object,
User defaultCreator)
This method is used for updating existing
DMSObject objects with
data from WfXMLObject objects. |
abstract Element |
getAsXML()
Deprecated.
|
abstract String |
getName()
Returns the name of this
WfXMLObject . |
User |
getUser()
|
protected User |
getUser(User defaultUser)
This method tries to get a user defined in this WfXMLObject.
|
String |
getUserId()
Get the id of the user who should be used to create a
DMSObject
out of this WfXMLObject. |
abstract org.apache.xmlbeans.XmlObject |
getXMLObject() |
void |
setUserId(String userId)
Set a user (by its id), who will be used when a
DMSObject is
created out of this WfXMLObject. |
protected WfXMLObject()
@Deprecated public static WfXMLObject createInstance(Element elem)
Element
. The returned
object's type depends on what kind of element you pass in.elem
- The element of which you want to create a WfXMLObject.null
if the element was
not one of the supported element types.public static WfXMLObject createInstance(org.apache.xmlbeans.XmlObject elem)
public String getUserId()
DMSObject
out of this WfXMLObject.null
if no user has been specified.public User getUser()
User
object representing the user who will be
used to create a DMSObject
out of this WfXMLObject. If
null
is returned, the defined user was not found on the system.User
object of the user who should create
this object or null
if the user is not available.protected User getUser(User defaultUser)
defaultUser
- You can provide a default user here. If no user is found
in the WfXMLObject object, you will get this default user back. Mind: if you pass
null
and no user is found, you will get null
back.defaultUser
(whatever you passed in to this method) if no user is set in this object.public void setUserId(String userId)
DMSObject
is
created out of this WfXMLObject.userId
- The id of the user who you want to set as document creator. You
can set this to null
if you want to remove a previously set user.public static WfXMLObject createInstance(DMSObject obj) throws Exception
DMSObject
. You don't need to care about
which type of DMSObject you pass in to this method, it will always return
the right type of WfXMLObject.obj
should be one of the following:@Deprecated public abstract Element getAsXML()
Element
holding the complete content of
the WfXMLObject.public abstract DMSObject createDMSObject(User defaultCreator) throws Exception
DMSObject
out of a WfXMLObject.
Depending on the type of WfXMLObject, the right DMSObject
will be created.createDMSObject
on a WfXMLForm
,
you can cast the result to DMSForm
.defaultCreator
- This optional parameter defines a default creator who
will be used for creating the DMSObject
, if no
particular user is defined in the WfXMLObject. You can set this parameter
to null
in case you don't want to provide a default creator.DMSObject
.Exception
- if creating the object fails.public abstract void fill(DMSObject object, User defaultCreator) throws Exception
DMSObject
objects with
data from WfXMLObject
objects. Each subclass implements this
method and handles the task of filling existing objects with data and updating
them to the database.object
- The object that has to be filled.defaultCreator
- If any new object must be created, a creator is required.
In case that the WfXMLObject
objects themselves don't contain
users, it is useful to provide a default creator here.Exception
- if updating the object fails.public abstract String getName()
WfXMLObject
.String
.public abstract org.apache.xmlbeans.XmlObject getXMLObject()
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.