edu.northwestern.at.wordhoard.model.annotations
Class AuthoredTextAnnotation

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.annotations.AuthoredTextAnnotation
All Implemented Interfaces:
Attachment, TextAttachment, PersistentObject, UserDataObject, java.io.Externalizable, java.io.Serializable

public class AuthoredTextAnnotation
extends java.lang.Object
implements PersistentObject, java.io.Externalizable, TextAttachment, UserDataObject

A text annotation.

Each text annotation has the following attributes in addition to those defined for annotations in general.

See Also:
Serialized Form

Nested Class Summary
protected  class AuthoredTextAnnotation.Context
          Text generation context.
 
Field Summary
protected  java.lang.String body
          The text body.
protected  AnnotationCategory category
          The annotation category.
protected  java.util.Date creationTime
          Original creation date/time.
protected  java.lang.String description
          Description of annotation.
protected  java.lang.Long id
          Unique persistence id (primary key).
protected  boolean isActive
          True if annotation is active (available for use).
protected  boolean isPublic
          True if public word set (can be seen by other users), false if private word set.
protected  java.util.Date modificationTime
          Last modification date/time.
protected  java.lang.String owner
          Owner of this annotation.
protected  java.lang.String query
          The query - part of UserData interface which should probably be factored out
(package private) static long serialVersionUID
           
protected  TextRange target
          The target of the annotation - the range of text to which it is attached.
protected  MemoryTextWrapper text
          The text.
protected  java.lang.String title
          The title of the annotation.
protected  java.lang.String webPageURL
          Web page URL.
protected  WorkPart workPart
          The work part to which this annotation is attached.
 
Constructor Summary
AuthoredTextAnnotation()
           
AuthoredTextAnnotation(java.lang.String owner, WorkPart workPart, TextRange target)
           
 
Method Summary
 void addReadPermission(UserGroup userGroup)
          Add read permission for userGroup
 boolean addToDOMDocument(org.w3c.dom.Document document)
          Add word set to DOM document.
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
protected  TextLine genText(java.lang.String str, Text text, TextLine line, AuthoredTextAnnotation.Context context)
          Generates a string of text.
 java.lang.String getAnnotates()
          Gets the annotates.
 java.lang.String getAuthor()
          Gets the author.
 java.lang.String getBody()
          Gets the text body.
 AnnotationCategory getCategory()
          Gets the annotation category.
 java.util.Date getCreationTime()
          Gets the creation date.
 java.lang.String getDescription()
          Gets the description.
 java.lang.Long getId()
          Gets the unique id.
 boolean getIsActive()
          Get the active flag.
 boolean getIsPublic()
          Get the public flag.
 java.util.Date getModificationTime()
          Gets the modification date.
 java.lang.String getOwner()
          Get the owner.
 java.lang.String getQuery()
          Get the query.
 java.lang.String getStatus()
          Gets the status.
 TextRange getTarget()
          Gets the target.
 TextWrapped getText()
          Gets the text.
 java.lang.String getTextAsString()
          Gets the text as a String.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getType()
          Gets the type.
 java.lang.String getWebPageURL()
          Gets the web page URL.
 WorkPart getWorkPart()
          Gets the work part.
 int hashCode()
          Returns a hash code for the object.
 void readExternal(java.io.ObjectInput in)
          Reads the annotation from an object input stream (deserializes the object).
 void resetText(java.lang.String textString)
          Reset the Text from a String.
 void setAnnotates(java.lang.String annotates)
          Sets the annotates.
 void setAuthor(java.lang.String author)
          Sets the author.
 void setBody(java.lang.String body)
          Sets the text body.
 void setCategory(AnnotationCategory category)
          Sets the annotation category.
 void setCreationTime(java.util.Date creationTime)
          Sets the creation time.
 void setDescription(java.lang.String description)
          Sets the description.
 boolean setFromDOMDocumentNode(org.w3c.dom.Node wordSetNode)
          Set values from DOM document node.
 void setIsActive(boolean isActive)
          Set the active flag.
 void setIsPublic(boolean isPublic)
          Set the public flag.
 void setModificationTime(java.util.Date modificationTime)
          Sets the modification time.
 void setOwner(java.lang.String owner)
          Set the owner.
 void setQuery(java.lang.String query)
          Set the query.
 void setStatus(java.lang.String status)
          Sets the status.
 void setTarget(TextRange target)
          Sets the target.
 void setText(TextWrapped text)
          Sets the text.
 void setTitle(java.lang.String title)
          Sets the title.
 void setType(java.lang.String type)
          Sets the type.
 void setWebPageURL(java.lang.String webPageURL)
          Sets the web page URL.
 void setWorkPart(WorkPart workPart)
          Sets the work part.
 java.lang.String toString()
          Gets a string representation of the word set.
 void writeExternal(java.io.ObjectOutput out)
          Writes the annotation to an object output stream (serializes the object).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

id

protected java.lang.Long id
Unique persistence id (primary key).


category

protected AnnotationCategory category
The annotation category.


body

protected java.lang.String body
The text body.


text

protected MemoryTextWrapper text
The text.


workPart

protected WorkPart workPart
The work part to which this annotation is attached.


target

protected TextRange target
The target of the annotation - the range of text to which it is attached.


title

protected java.lang.String title
The title of the annotation.


description

protected java.lang.String description
Description of annotation.


webPageURL

protected java.lang.String webPageURL
Web page URL.


creationTime

protected java.util.Date creationTime
Original creation date/time.


modificationTime

protected java.util.Date modificationTime
Last modification date/time.


owner

protected java.lang.String owner
Owner of this annotation.


isPublic

protected boolean isPublic
True if public word set (can be seen by other users), false if private word set.


isActive

protected boolean isActive
True if annotation is active (available for use).


query

protected java.lang.String query
The query - part of UserData interface which should probably be factored out

Constructor Detail

AuthoredTextAnnotation

public AuthoredTextAnnotation()

AuthoredTextAnnotation

public AuthoredTextAnnotation(java.lang.String owner,
                              WorkPart workPart,
                              TextRange target)
Method Detail

getId

public java.lang.Long getId()
Gets the unique id.

Specified by:
getId in interface Attachment
Specified by:
getId in interface PersistentObject
Specified by:
getId in interface UserDataObject
Returns:
The unique id.

getBody

public java.lang.String getBody()
Gets the text body.

Returns:
The body.

getText

public TextWrapped getText()
Gets the text.

Specified by:
getText in interface Attachment
Returns:
The text.

getCategory

public AnnotationCategory getCategory()
Gets the annotation category.

Specified by:
getCategory in interface Attachment
Returns:
The annotation category.

getWorkPart

public WorkPart getWorkPart()
Gets the work part.

Specified by:
getWorkPart in interface TextAttachment
Returns:
The work part.

getTarget

public TextRange getTarget()
Gets the target.

Specified by:
getTarget in interface TextAttachment
Returns:
The target - the range of text to which this annotation is attached.

getTitle

public java.lang.String getTitle()
Gets the title.

Specified by:
getTitle in interface UserDataObject
Returns:
The title.

getDescription

public java.lang.String getDescription()
Gets the description.

Specified by:
getDescription in interface UserDataObject
Returns:
The description.

getWebPageURL

public java.lang.String getWebPageURL()
Gets the web page URL.

Specified by:
getWebPageURL in interface UserDataObject
Returns:
The web page URL.

getCreationTime

public java.util.Date getCreationTime()
Gets the creation date.

Specified by:
getCreationTime in interface UserDataObject
Returns:
The creation date.

getModificationTime

public java.util.Date getModificationTime()
Gets the modification date.

Specified by:
getModificationTime in interface UserDataObject
Returns:
The modification date.

getAuthor

public java.lang.String getAuthor()
Gets the author.

Returns:
The author.

getAnnotates

public java.lang.String getAnnotates()
Gets the annotates.

Returns:
The annotates.

getType

public java.lang.String getType()
Gets the type.

Returns:
The type.

getStatus

public java.lang.String getStatus()
Gets the status.

Returns:
The status.

getOwner

public java.lang.String getOwner()
Get the owner.

Specified by:
getOwner in interface UserDataObject
Returns:
The owner.

getIsPublic

public boolean getIsPublic()
Get the public flag.

Specified by:
getIsPublic in interface UserDataObject
Returns:
True if the word set is public, false if private.

getIsActive

public boolean getIsActive()
Get the active flag.

Specified by:
getIsActive in interface UserDataObject
Returns:
True if the word set is active.

getQuery

public java.lang.String getQuery()
Get the query.

Specified by:
getQuery in interface UserDataObject
Returns:
The query for generating this word set.

setTarget

public void setTarget(TextRange target)
Sets the target.

Specified by:
setTarget in interface TextAttachment
Parameters:
target - The target - the range of text to which this annotation is attached.

setTitle

public void setTitle(java.lang.String title)
Sets the title.

Specified by:
setTitle in interface UserDataObject
Parameters:
title - The title.

setDescription

public void setDescription(java.lang.String description)
Sets the description.

Specified by:
setDescription in interface UserDataObject
Parameters:
description - The description.

setWebPageURL

public void setWebPageURL(java.lang.String webPageURL)
Sets the web page URL.

Specified by:
setWebPageURL in interface UserDataObject
Parameters:
webPageURL - The web page URL.

setCreationTime

public void setCreationTime(java.util.Date creationTime)
Sets the creation time.

Specified by:
setCreationTime in interface UserDataObject
Parameters:
creationTime - The creation time.

setModificationTime

public void setModificationTime(java.util.Date modificationTime)
Sets the modification time.

Specified by:
setModificationTime in interface UserDataObject
Parameters:
modificationTime - The modification time.

setOwner

public void setOwner(java.lang.String owner)
Set the owner.

Parameters:
owner - The owner.

setAuthor

public void setAuthor(java.lang.String author)
Sets the author.

Parameters:
author - The author.

setBody

public void setBody(java.lang.String body)
Sets the text body.

Parameters:
body - The text body.

setText

public void setText(TextWrapped text)
Sets the text.

Specified by:
setText in interface Attachment
Parameters:
text - The text.

resetText

public void resetText(java.lang.String textString)
Reset the Text from a String.

Parameters:
textString - The string.

getTextAsString

public java.lang.String getTextAsString()
Gets the text as a String.

Returns:
The text.

genText

protected TextLine genText(java.lang.String str,
                           Text text,
                           TextLine line,
                           AuthoredTextAnnotation.Context context)
Generates a string of text.

Parameters:
str - String of text.

setCategory

public void setCategory(AnnotationCategory category)
Sets the annotation category.

Specified by:
setCategory in interface Attachment
Parameters:
category - The annotation category.

setWorkPart

public void setWorkPart(WorkPart workPart)
Sets the work part.

Specified by:
setWorkPart in interface TextAttachment
Parameters:
workPart - The work part.

setAnnotates

public void setAnnotates(java.lang.String annotates)
Sets the annotates.

Parameters:
annotates - The annotates.

setType

public void setType(java.lang.String type)
Sets the type.

Parameters:
type - The type.

setStatus

public void setStatus(java.lang.String status)
Sets the status.

Parameters:
status - The status.

setIsPublic

public void setIsPublic(boolean isPublic)
Set the public flag.

Parameters:
isPublic - True if the word set is public, false if private.

setIsActive

public void setIsActive(boolean isActive)
Set the active flag.

Parameters:
isActive - True if the word set is active.

setQuery

public void setQuery(java.lang.String query)
Set the query.

Parameters:
query - The query for generating this word set.

setFromDOMDocumentNode

public boolean setFromDOMDocumentNode(org.w3c.dom.Node wordSetNode)
Set values from DOM document node.

Specified by:
setFromDOMDocumentNode in interface UserDataObject
Parameters:
wordSetNode - DOM document node with word set settings.
Returns:
true if settings retrieved.

addToDOMDocument

public boolean addToDOMDocument(org.w3c.dom.Document document)
Add word set to DOM document.

Specified by:
addToDOMDocument in interface UserDataObject
Parameters:
document - DOM document to which to add word set. Must not be null. In most cases, this document should have a "wordhoard" node as the root element.
Returns:
true if DOM addition successful, false otherwise.

toString

public java.lang.String toString()
Gets a string representation of the word set.

Overrides:
toString in class java.lang.Object
Returns:
The title.

equals

public boolean equals(java.lang.Object obj)
Returns true if some other object is equal to this one.

The two objects are equal if their ids are equal.

Specified by:
equals in interface Attachment
Overrides:
equals in class java.lang.Object
Parameters:
obj - The other object.
Returns:
True if this object equals the other object.

hashCode

public int hashCode()
Returns a hash code for the object.

Specified by:
hashCode in interface Attachment
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes the annotation to an object output stream (serializes the object).

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - Object output stream.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the annotation from an object input stream (deserializes the object).

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - Object input stream.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

addReadPermission

public void addReadPermission(UserGroup userGroup)
Add read permission for userGroup

Parameters:
userGroup - UserGroup that we're extending read privilege to.