Class WfXMLNote

All Implemented Interfaces:
Cloneable

public class WfXMLNote extends WfXMLObject implements Cloneable
This class represents notes. It can be used to create new notes, create notes out of JDOM elements, and create notes out of existing DMSNote objects (see the corresponding constructors). Once you have a WfXMLNote object, you can use the createDMSObject(com.groiss.org.User) method to create a new DMSNote.
See the super class WfXMLObject for more details and examples.
  • Constructor Details

    • WfXMLNote

      public WfXMLNote(String subject, String content, String userId, boolean isPrivate)
      Creates a note with all possible fields.
      Parameters:
      subject - A subject for the note.
      content - The content of the note.
      userId - Id of the user who will be (or is) the creator of the note. You can use null here, if you don't want to use a special user. In that case the note will be created by another user (if possible), or an error will occur.
      isPrivate - Indicates whether this note is private or not. If it is private (true), only the creator of the message has the rights to view the note.
    • WfXMLNote

      public WfXMLNote(DMSNote dmsNote) throws Exception
      Use this constructor to build a WfXMLNote out of a DMSNote. The WfXMLNote will be filled with the values of the DMSNote.
      Parameters:
      dmsNote - A DMSNote object.
      Throws:
      Exception - if there occur problems reading data from the DMSNote object.
    • WfXMLNote

      public WfXMLNote(org.apache.xmlbeans.XmlObject obj)
  • Method Details

    • getContent

      public String getContent()
      Returns the content string of this note.
      Returns:
      A String containing the content of this note.
    • isPrivate

      public boolean isPrivate()
      Use this method to check if this note is private or not.
      Returns:
      true if this is a private note or false if the note is public.
    • getSubject

      public String getSubject()
      Returns the subject of this note.
      Returns:
      A String with the subject of this note.
    • getName

      public String getName()
      Returns the name of this note. In fact the name of a note always equals to the note's subject. This method is present here, because every WfXMLObject supports a getName method, which returns the name with which the object is listed in DMS folders.
      Specified by:
      getName in class WfXMLObject
      Returns:
      The name of the note (its subject).
    • setContent

      public void setContent(String content)
      Set the content of this note. Any old content will be lost if you set new content with this method.
      Parameters:
      content - A String containing the content for this note.
    • setPrivate

      public void setPrivate(boolean isPrivate)
      This method sets the note to be private or public viewable.
      Parameters:
      isPrivate - true makes the note private, false makes it public.
    • setSubject

      public void setSubject(String subject)
      Set a subject for the note.
      Parameters:
      subject - A String with the subject of the note.
    • fill

      public void fill(DMSObject existingNote, User defaultCreator) throws Exception
      This method fills an existing DMSNote with the data of this WfXMLNote and updates it to the database.
      Specified by:
      fill in class WfXMLObject
      Parameters:
      existingNote - The existing DMSNote. If you pass an object that is no DMSNote, this method will simply do nothing.
      defaultCreator - A creator for objects that must be created. As this method updates a note, the user will not be used, because it will not be necessary to create anything here. You can simply pass in null.
      Throws:
      Exception - If updating the DMSNote with the data fails.
    • createDMSObject

      public DMSObject createDMSObject(User defaultCreator)
      Creates a DMSNote object out of this WfXMLNote.
      Specified by:
      createDMSObject in class WfXMLObject
      Parameters:
      defaultCreator - You can specify a default creator with this parameter. If there is no user defined in this WfXMLNote object, or if the defined user cannot be found, the defaultCreator will be used. If this user also does not exist, an ApplicationException will be thrown.
      Returns:
      The new DMSNote object, or null if creating the note didn't work.
    • clone

      public Object clone()
      Creates a deep copy of this note. The returned object can be casted to WfXMLNote.
      Overrides:
      clone in class Object
    • getXMLObject

      public org.apache.xmlbeans.XmlObject getXMLObject()
      Specified by:
      getXMLObject in class WfXMLObject