com.groiss.wfxml
Class WfXMLObject

java.lang.Object
  extended by com.groiss.wfxml.WfXMLObject
Direct Known Subclasses:
WfXMLForm, WfXMLNote, WfXMLWebLink

public abstract class WfXMLObject
extends java.lang.Object

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:

As you can see, the same naming scheme has been used, so it's easy to keep that mapping in mind.
Let's take a look on what you can do with WfXMLObject objects:

  1. First, you can create WfXMLObject objects in three different ways:
  2. Once you have a WfXMLObject, you can modify it with various methods (change name/id/etc.; add and change content, fields, and so on).
  3. When you created and changed a WfXMLObject according to your needs, you can do two things with it:


Field Summary
static org.jdom.Namespace namespace
           
protected  java.util.List<WfXMLNote> 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)
          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  org.jdom.Element getAsXML()
          Deprecated. 
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.
abstract  org.apache.xmlbeans.XmlObject getXMLObject()
           
 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

namespace

public static final org.jdom.Namespace namespace

notes

protected java.util.List<WfXMLNote> notes

userId

protected java.lang.String userId
Constructor Detail

WfXMLObject

protected WfXMLObject()
This default constructor is called implicitly when one of the subclasses is instanciated. It creates a collection object for storing attached notes.

Method Detail

createInstance

@Deprecated
public static WfXMLObject createInstance(org.jdom.Element elem)
Deprecated. 

Creates a WfXMLObject out of a JDOM Element. The returned object's type depends on what kind of element you pass in.
If you know of which type the element is, use a constructor of the corresponding subclass instead.

Parameters:
elem - The element of which you want to create a WfXMLObject.
Returns:
The resulting WfXMLObject, or null if the element was not one of the supported element types.

createInstance

public static WfXMLObject createInstance(org.apache.xmlbeans.XmlObject elem)

getUserId

public java.lang.String getUserId()
Get the id of the user who should be used to create a DMSObject out of this WfXMLObject.

Returns:
The id of the user who should be used to create the document, or null if no user has been specified.

getUser

public User getUser()
Returns a 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.

Returns:
A User object of the user who should create this object or null if the user is not available.

getUser

protected User getUser(User defaultUser)
This method tries to get a user defined in this WfXMLObject. If there is no user, it simply returns the defaultUser that you passed in to the method. As this is usually performed quite often, this method is useful.

Parameters:
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.
Returns:
The user defined in this WfXMLObject, or defaultUser (whatever you passed in to this method) if no user is set in this object.

setUserId

public 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.

Parameters:
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.

createInstance

public static WfXMLObject createInstance(DMSObject obj)
                                  throws java.lang.Exception
Use this method to create a WfXMLObject out of a 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:

Parameters:
obj - A DMSObject of which you want to create a WfXMLObject.
Returns:
A WfXMLObject with the data of the DMSObject or null if obj was non of the above mentioned types.
Throws:
java.lang.Exception - if creating the object fails.

getAsXML

@Deprecated
public abstract org.jdom.Element getAsXML()
Deprecated. 

Returns the WfXMLObject in XML representation.

Returns:
A JDOM Element holding the complete content of the WfXMLObject.

createDMSObject

public abstract DMSObject createDMSObject(User defaultCreator)
                                   throws java.lang.Exception
This method creates a DMSObject out of a WfXMLObject. Depending on the type of WfXMLObject, the right DMSObject will be created.
For example: if you call createDMSObject on a WfXMLForm, you can cast the result to DMSForm.

Parameters:
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.
Returns:
The resulting DMSObject.
Throws:
java.lang.Exception - if creating the object fails.

fill

public abstract void fill(DMSObject object,
                          User defaultCreator)
                   throws java.lang.Exception
This method is used for updating existing 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.

Parameters:
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.
Throws:
java.lang.Exception - if updating the object fails.

getName

public abstract java.lang.String getName()
Returns the name of this WfXMLObject.

Returns:
The name as String.

getXMLObject

public abstract org.apache.xmlbeans.XmlObject getXMLObject()


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.