Package com.groiss.wfxml
Class WfXMLDocForm
java.lang.Object
com.groiss.wfxml.WfXMLObject
com.groiss.wfxml.WfXMLForm
com.groiss.wfxml.WfXMLDocForm
- All Implemented Interfaces:
Cloneable
This class represents DMSDocForm objects.
See the
See the
WfXMLObject
base class for general information and examples
of how to use WfXMLObject objects.-
Field Summary
Fields inherited from class com.groiss.wfxml.WfXMLForm
content, formName, id, subformId, subForms, version
Fields inherited from class com.groiss.wfxml.WfXMLObject
notes, userId
-
Constructor Summary
ConstructorDescriptionWfXMLDocForm
(DMSDocForm dmsDocForm) Create a WfXMLDocForm out of aDMSDocForm
.WfXMLDocForm
(String name, String extension, byte[] content, String userId) Creates a new WfXMLDocForm.WfXMLDocForm
(org.apache.xmlbeans.XmlObject obj) -
Method Summary
Modifier and TypeMethodDescriptioncreateDMSObject
(User defaultCreator) Use this method to create aDMSObject
out of this WfXMLDocForm object.void
byte[]
Returns the document's content byte array.
Note: The byte array is not cloned, so if you modify it, the data set in this WfXMLDocForm object will also change.Get the extension of the document (filename-extension).getName()
Get the full name of the document (filename and extension).Returns just the name part of this doc form.org.apache.xmlbeans.XmlObject
void
setContent
(byte[] content) Set new content for the document.void
setExtensionPart
(String extension) Set a new extension for the document.void
setNamePart
(String name) Set the name part of the document (filename only; without extension).Methods inherited from class com.groiss.wfxml.WfXMLForm
addSubForm, attachNote, attachNote, clone, getField, getFormName, getId, getNotes, getSubformId, getSubForms, getVersion, removeField, setField, setField, setField, setField, setFormName, setId, setSubformId, setVersion
Methods inherited from class com.groiss.wfxml.WfXMLObject
createInstance, createInstance, getUser, getUser, getUserId, setUserId
-
Constructor Details
-
WfXMLDocForm
Creates a new WfXMLDocForm. You can set parameters tonull
if they don't exist or if you prefer setting them with the corresponding setter method later.- Parameters:
name
- The name of the document (filename).extension
- The extension of the document (filename-extension).content
- A byte array holding the content of this document form. The byte array will be stored in zipped form.userId
- A user who will be the creator of theDMSDocForm
, when it is created. You can set this tonull
if you don't want to specify a particular user.
-
WfXMLDocForm
public WfXMLDocForm(org.apache.xmlbeans.XmlObject obj) -
WfXMLDocForm
Create a WfXMLDocForm out of aDMSDocForm
. Attached notes are also included.- Parameters:
dmsDocForm
- ADMSDocForm
object.- Throws:
Exception
- if there are reading-problems and the WfXMLDocForm cannot be created.
-
-
Method Details
-
getName
Get the full name of the document (filename and extension). -
setNamePart
Set the name part of the document (filename only; without extension).- Parameters:
name
- The new name for the document.
-
getNamePart
Returns just the name part of this doc form. If it is not a standard document, the name will be taken from the form field of the name attribute field.- Returns:
- The name of the document (without extension!).
-
getExtension
Get the extension of the document (filename-extension).- Returns:
- The extension.
-
setExtensionPart
Set a new extension for the document. The mime type is not automatically changed when you set a new extension.- Parameters:
extension
- The new extension for the document.
-
getContent
public byte[] getContent()Returns the document's content byte array.
Note: The byte array is not cloned, so if you modify it, the data set in this WfXMLDocForm object will also change.- Returns:
- The byte array holding the content of this document form.
-
setContent
public void setContent(byte[] content) Set new content for the document.- Parameters:
content
- The new content for this document form object.
-
fill
Description copied from class:WfXMLForm
This method fills an existingDMSForm
with the values of thisWfXMLForm
. It's similar toWfXMLForm.createDMSObject(com.groiss.org.User)
, with the only difference, that theDMSForm
must already exist.
Notes and subforms will also be created and attached to theDMSForm
. All values that have been defined in thisWfXMLForm
will be set in theDMSForm
. So values, which exist in theDMSForm
, will not be changed, if they are not defined in theWfXMLForm
...
After filling the form with data, changes are stored in the database.- Overrides:
fill
in classWfXMLForm
- Parameters:
existingDocForm
- An existingDMSForm
, which will be filled with the values set in thisWfXMLForm
. 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 tonull
if you don't want to provide a default creator.- Throws:
Exception
- if no user could be found, or if something fails while objects are created and attached/added.
-
createDMSObject
Use this method to create aDMSObject
out of this WfXMLDocForm object.- Overrides:
createDMSObject
in classWfXMLForm
- Parameters:
defaultCreator
- If the user who is defined in this document form cannot be found, or if no user was defined, thisdefaultCreator
will be used to createDMSObject
objects. Providing a default creator is optional, so you can passnull
if you don't want to set a default creator.- Returns:
- A reference to the
DMSForm
, which represents thisWfXMLForm
. - Throws:
Exception
- if there is no user for creating theDMSObject
, or if creating failed.
-
getXMLObject
public org.apache.xmlbeans.XmlObject getXMLObject()- Overrides:
getXMLObject
in classWfXMLForm
-