Class WfXMLFolder

All Implemented Interfaces:
Cloneable

public class WfXMLFolder extends WfXMLForm
This class represents a DMSFolder. Other WfXMLObject objects can be added as content to the folder.
See WfXMLObject for examples on how to use the WfXMLObject objects in general.
  • Constructor Details

    • WfXMLFolder

      public WfXMLFolder(String name, String userId)
      Create a new empty standard folder and set a name for it.
      Parameters:
      name - The name of the folder.
      userId - The user who will be the creator of this folder. Set it to null, if you don't want to specify a user.
    • WfXMLFolder

      public WfXMLFolder(org.apache.xmlbeans.XmlObject obj)
      loads the WfXMLFolder from a FolderFormDocument.FolderForm element
    • WfXMLFolder

      public WfXMLFolder(DMSFolder dmsFolder) throws Exception
      This constructor creates a WfXMLFolder out of a DMSFolder. All content of the folder is also transformed to WfXMLObject objects.
      Parameters:
      dmsFolder - The DMSFolder folder.
      Throws:
      Exception - if an item of the folder cannot be created.
  • Method Details

    • getName

      public String getName()
      Get the name of the folder. The name of the folder is also the name that you will see in DMS folders where the folder is displayed.
      Overrides:
      getName in class WfXMLForm
      Returns:
      A String with the folder's name.
    • setName

      public void setName(String name)
      Set a name for the folder.
      Parameters:
      name - The new folder name.
    • addContent

      public void addContent(WfXMLObject obj)
      Add another WfXMLObject to the content of this folder.
      Parameters:
      obj - The object you want to add.
    • listContent

      public List<WfXMLObject> listContent()
      You get a List filled with the content of this folder. The elements of the list are WfXMLObject objects. You can perform changes on the list without affecting this WfXMLFolder, but the referenced WfXMLObject objects are not copied, thus changes on them also affect the referenced objects of this folder.
      Returns:
      A List containing the content (WfXMLObject objects) of this folder. If the folder is empty, the returned List is also empty.
    • listSubFolders

      public List<WfXMLFolder> listSubFolders()
      Use this method to get a list containing all subfolders of this folder.
      Returns:
      A List filled with the subfolders of this folder. The elements of the List are WfXMLFolder objects. If there are no subfolders, the returned List will be empty.
    • fill

      public void fill(DMSObject existingFolder, User defaultCreator) throws Exception
      This method fills an existing DMS folder with the data contained in this WfXML folder. That means: every object that already exists in the DMS folder, will be updated with the data of corresponding objects (same name) in this WfXML folder, or, if objects don't exist they will be created and added to the DMS folder.
      Overrides:
      fill in class WfXMLForm
      Parameters:
      existingFolder - An existing DMSFolder that you wish to fill with the data of this WfXMLFolder. If you pass not a DMSFolder, the method will do nothing.
      defaultCreator - A default creator for elements that will be newly created. It would be good to provide a default creator for this method, because maybe there will be new DMS objects created and then a creator is needed in case that the corresponding WfXML objects don't contain creators.
      Throws:
      Exception - if filling the DMSFolder fails (update of existing elements or creation of new elements doesn't work).
    • createDMSObject

      public DMSObject createDMSObject(User defaultCreator) throws Exception
      This method creates a DMSFolder out of this WfXMLObject object. The whole content of that folder will also be created (various DMSObject objects. Usually the objects are created by the user who was defined to create them. If no user is defined in a WfXMLObject (or if the defined user doesn't exist), the defaultCreator will be used.
      Overrides:
      createDMSObject in class WfXMLForm
      Parameters:
      defaultCreator - You can specify a default creator for the case that no other user can be found.
      Returns:
      A reference to the DMSForm, which represents this WfXMLForm.
      Throws:
      Exception - if no user can be found for creating the DMSObject objects, or if creating the folder or parts of its content fails.
    • createDMSObject

      public DMSObject createDMSObject(User defaultCreator, DMSFolder parentFolder) throws Exception
      Throws:
      Exception
    • clone

      public Object clone()
      Creates a copy of this WfXMLFolder. If the foldertype also includes a form, this form-part is copied like with WfXMLForm.clone(), so you can find more details there. The folder content array of this WfXMLFolder is cloned, but the referenced WfXMLObject objects are not cloned. So if you want to modify these objects, you should take care.
      Overrides:
      clone in class WfXMLForm
      Returns:
      A WfXMLFolder object which is a clone of this object. You can cast it to WfXMLFolder, because the returned object is always of that type.
    • getXMLObject

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