Class WfXMLDocForm

All Implemented Interfaces:
Cloneable

public class WfXMLDocForm extends WfXMLForm
This class represents DMSDocForm objects.
See the WfXMLObject base class for general information and examples of how to use WfXMLObject objects.
  • Constructor Details

    • WfXMLDocForm

      public WfXMLDocForm(String name, String extension, byte[] content, String userId)
      Creates a new WfXMLDocForm. You can set parameters to null 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 the DMSDocForm, when it is created. You can set this to null if you don't want to specify a particular user.
    • WfXMLDocForm

      public WfXMLDocForm(org.apache.xmlbeans.XmlObject obj)
    • WfXMLDocForm

      public WfXMLDocForm(DMSDocForm dmsDocForm) throws Exception
      Create a WfXMLDocForm out of a DMSDocForm. Attached notes are also included.
      Parameters:
      dmsDocForm - A DMSDocForm object.
      Throws:
      Exception - if there are reading-problems and the WfXMLDocForm cannot be created.
  • Method Details

    • getName

      public String getName()
      Get the full name of the document (filename and extension).
      Overrides:
      getName in class WfXMLForm
      Returns:
      The name consisting of name and extension. If this is not a standard document, the name will be taken from the form field of the name attribute field.
    • setNamePart

      public void setNamePart(String name)
      Set the name part of the document (filename only; without extension).
      Parameters:
      name - The new name for the document.
    • getNamePart

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

      public String getExtension()
      Get the extension of the document (filename-extension).
      Returns:
      The extension.
    • setExtensionPart

      public void setExtensionPart(String extension)
      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

      public void fill(DMSObject existingDocForm, User defaultCreator) throws Exception
      Description copied from class: WfXMLForm
      This method fills an existing DMSForm with the values of this WfXMLForm. It's similar to WfXMLForm.createDMSObject(com.groiss.org.User), with the only difference, that the DMSForm must already exist.
      Notes and subforms will also be created and attached to the 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...
      After filling the form with data, changes are stored in the database.
      Overrides:
      fill in class WfXMLForm
      Parameters:
      existingDocForm - 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.
      Throws:
      Exception - if no user could be found, or if something fails while objects are created and attached/added.
    • createDMSObject

      public DMSObject createDMSObject(User defaultCreator) throws Exception
      Use this method to create a DMSObject out of this WfXMLDocForm object.
      Overrides:
      createDMSObject in class WfXMLForm
      Parameters:
      defaultCreator - If the user who is defined in this document form cannot be found, or if no user was defined, this defaultCreator will be used to create DMSObject objects. Providing a default creator is optional, so you can pass null if you don't want to set a default creator.
      Returns:
      A reference to the DMSForm, which represents this WfXMLForm.
      Throws:
      Exception - if there is no user for creating the DMSObject, or if creating failed.
    • getXMLObject

      public org.apache.xmlbeans.XmlObject getXMLObject()
      Overrides:
      getXMLObject in class WfXMLForm