com.groiss.wfxml
Class WfXMLNote

java.lang.Object
  extended by com.groiss.wfxml.WfXMLObject
      extended by com.groiss.wfxml.WfXMLNote
All Implemented Interfaces:
java.lang.Cloneable

public class WfXMLNote
extends WfXMLObject
implements java.lang.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 its getAsXML() method to get a JDOM representation of the note, or the createDMSObject(com.groiss.org.User) method to create a new DMSNote.
See the super class WfXMLObject for more details and examples.


Field Summary
 
Fields inherited from class com.groiss.wfxml.WfXMLObject
namespace, notes, userId
 
Constructor Summary
WfXMLNote(DMSNote dmsNote)
          Use this constructor to build a WfXMLNote out of a DMSNote.
WfXMLNote(org.jdom.Element noteElem)
          Deprecated. 
WfXMLNote(java.lang.String subject, java.lang.String content, java.lang.String userId, boolean isPrivate)
          Creates a note with all possible fields.
WfXMLNote(org.apache.xmlbeans.XmlObject obj)
           
 
Method Summary
 java.lang.Object clone()
          Creates a deep copy of this note.
 DMSObject createDMSObject(User defaultCreator)
          Creates a DMSNote object out of this WfXMLNote.
 void fill(DMSObject existingNote, User defaultCreator)
          This method fills an existing DMSNote with the data of this WfXMLNote and updates it to the database.
 org.jdom.Element getAsXML()
          This method creates a JDOM representation of this note.
 java.lang.String getContent()
          Returns the content string of this note.
 java.lang.String getName()
          Returns the name of this note.
 java.lang.String getSubject()
          Returns the subject of this note.
 org.apache.xmlbeans.XmlObject getXMLObject()
           
 boolean isPrivate()
          Use this method to check if this note is private or not.
 void setContent(java.lang.String content)
          Set the content of this note.
 void setPrivate(boolean isPrivate)
          This method sets the note to be private or public viewable.
 void setSubject(java.lang.String subject)
          Set a subject for the note.
 
Methods inherited from class com.groiss.wfxml.WfXMLObject
createInstance, createInstance, createInstance, getUser, getUser, getUserId, setUserId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WfXMLNote

public WfXMLNote(java.lang.String subject,
                 java.lang.String content,
                 java.lang.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

@Deprecated
public WfXMLNote(org.jdom.Element noteElem)
          throws java.lang.IllegalArgumentException
Deprecated. 

Creates a note out of a JDOM Element. The Element must be a note element, otherwise an exception will be thrown.

Parameters:
noteElem - JDOM Element representing a note.
Throws:
java.lang.IllegalArgumentException - if the noteElem parameter is no valid note element.

WfXMLNote

public WfXMLNote(DMSNote dmsNote)
          throws java.lang.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:
java.lang.Exception - if there occur problems reading data from the DMSNote object.

WfXMLNote

public WfXMLNote(org.apache.xmlbeans.XmlObject obj)
Method Detail

getContent

public java.lang.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 java.lang.String getSubject()
Returns the subject of this note.

Returns:
A String with the subject of this note.

getName

public java.lang.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(java.lang.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(java.lang.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 java.lang.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:
java.lang.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.
Throws:
java.lang.Exception - if no user was found for creating the note, or creating failed.

getAsXML

public org.jdom.Element getAsXML()
This method creates a JDOM representation of this note.

Specified by:
getAsXML in class WfXMLObject
Returns:
A JDOM Element, which is a note element with all information of this note.

clone

public java.lang.Object clone()
Creates a deep copy of this note. The returned object can be casted to WfXMLNote.

Overrides:
clone in class java.lang.Object

getXMLObject

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


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