|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.wfxml.WfXMLObject
public abstract class WfXMLObject
WfXMLObject and its subclasses are used to easily access, modify and create
DMSObject objects and to do a transformation to and
from XML.
Therefore the hierarchical structure of these WfXML classes is similar to the
structure of the DMSObject interface and its subinterfaces.
The mapping between WfXMLObject objects and DMSObject
objects works like this:
WfXMLNote -- DMSNoteWfXMLWebLink -- DMSWebLinkWfXMLForm -- DMSFormWfXMLDocForm -- DMSDocFormWfXMLFolder -- DMSFolderWfXMLObject -- DMSObjectDMSObject.
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);
| Field Summary | |
|---|---|
protected static org.jdom.Namespace |
namespace
|
protected java.util.ArrayList |
notes
|
protected java.lang.String |
userId
|
| Constructor Summary | |
|---|---|
protected |
WfXMLObject()
This default constructor is called implicitly when one of the subclasses is instanciated. |
| Method Summary | |
|---|---|
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(org.jdom.Element elem)
Creates a WfXMLObject out of a JDOM Element. |
abstract void |
fill(DMSObject object,
User defaultCreator)
This method is used for updating existing DMSObject objects with
data from WfXMLObject objects. |
abstract org.jdom.Element |
getAsXML()
Returns the WfXMLObject in XML representation. |
abstract java.lang.String |
getName()
Returns the name of this WfXMLObject. |
User |
getUser()
Returns a User object representing the user who will be
used to create a DMSObject out of this WfXMLObject. |
protected User |
getUser(User defaultUser)
This method tries to get a user defined in this WfXMLObject. |
java.lang.String |
getUserId()
Get the id of the user who should be used to create a DMSObject
out of this WfXMLObject. |
void |
setUserId(java.lang.String userId)
Set a user (by its id), who will be used when a DMSObject is
created out of this WfXMLObject. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.jdom.Namespace namespace
protected java.util.ArrayList notes
protected java.lang.String userId
| Constructor Detail |
|---|
protected WfXMLObject()
| Method Detail |
|---|
public static WfXMLObject createInstance(org.jdom.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 java.lang.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(java.lang.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 java.lang.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:
obj - A DMSObject of which you want
to create a WfXMLObject.
DMSObject
or null if obj was non of the above mentioned types.
java.lang.Exception - if creating the object fails.public abstract org.jdom.Element getAsXML()
Element holding the complete content of
the WfXMLObject.
public abstract DMSObject createDMSObject(User defaultCreator)
throws java.lang.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.
ApplicationException - if creating the object fails.
java.lang.Exception
public abstract void fill(DMSObject object,
User defaultCreator)
throws java.lang.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.
java.lang.Exception - if updating the object fails.public abstract java.lang.String getName()
WfXMLObject.
String.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||