edu.northwestern.at.wordhoard.model.userdata
Class WorkSet

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.userdata.WorkSet
All Implemented Interfaces:
CanCountWords, PersistentObject, SearchCriterion, UserDataObject, java.io.Externalizable, java.io.Serializable

public class WorkSet
extends java.lang.Object
implements java.io.Externalizable, CanCountWords, PersistentObject, SearchCriterion, UserDataObject

A work set.

A work set contains a list of works and/or work parts. Work sets are useful for creating collections of subparts of works. For example, a work set might contain all the prologues to Shakespeare plays. Another might contain just a single Canterbury Tale.

See Also:
Serialized Form

Field Summary
protected  java.util.Date creationTime
          Original creation date/time.
protected  java.lang.String description
          Description of work set.
protected  java.lang.Long id
          Unique persistence id (primary key).
protected  boolean isActive
          True if work set is active (available for use).
protected  boolean isPublic
          True if public work set (can be seen by other users), false if private work set.
protected  java.util.Date modificationTime
          Last modification date/time.
protected  java.lang.String owner
          Owner of this work set.
protected  java.lang.String query
          The query properties to generate this word set's work part list.
protected static long serialVersionUID
          Serial version UID.
protected  java.lang.String title
          The title of the work set.
protected  java.lang.String webPageURL
          Web page URL.
protected  java.util.Collection workPartTags
          Collection of reference tags of work parts belonging to this work set.
 
Constructor Summary
WorkSet()
          Create an empty work set.
WorkSet(org.w3c.dom.Node workSetNode, java.lang.String owner)
          Create a work set from a DOM document node.
WorkSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, java.lang.String query, java.util.Collection workParts)
          Create work set.
WorkSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, java.lang.String query, java.lang.String[] workPartTags)
          Create work set.
WorkSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, java.lang.String query, WorkPart[] workParts)
          Create work set.
 
Method Summary
 boolean addToDOMDocument(org.w3c.dom.Document document)
          Add work set to DOM document.
 void addWorkPart(WorkPart workPart)
          Adds a work part.
 void addWorkParts(java.util.Collection workPartCollection)
          Adds work parts from a collection.
 void addWorkParts(WorkPart[] workPartArray)
          Adds work parts from an array.
 void addWorkPartTags(java.lang.String[] workPartTagArray)
          Adds work parts from an array of tags.
 void appendDescription(TextLine line, FontInfo romanFontInfo, FontInfo[] fontInfo)
          Appends a description to a text line.
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
 java.util.Date getCreationTime()
          Gets the creation date.
 java.lang.String getDescription()
          Gets the description.
 Spelling getGroupingSpelling(int numHits)
          Gets the spelling of the grouping object.
 java.lang.Long getId()
          Gets the unique id.
 boolean getIsActive()
          Get the active flag.
 boolean getIsPublic()
          Get the public flag.
 java.lang.Class getJoinClass()
          Gets the join class.
 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 getReportPhrase()
          Gets the report phrase.
 SearchCriterion getSearchDefault(java.lang.Class cls)
          Gets a search criterion default value.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getWebPageURL()
          Gets the web page URL.
 java.lang.String getWhereClause()
          Gets the Hibernate where clause.
 java.util.Collection getWorkPartTags()
          Gets the work part tags.
 int hashCode()
          Returns a hash code for the object.
 void readExternal(java.io.ObjectInput in)
          Reads the work set from an object input stream (deserializes the object).
 void removeWorkPart(WorkPart workPart)
          Removes a work part.
 void removeWorkParts()
          Removes all the work parts.
 void setArg(org.hibernate.Query q, org.hibernate.Session session)
          Sets the Hibernate query argument.
 void setCreationTime(java.util.Date creationTime)
          Sets the creation date.
 void setDescription(java.lang.String description)
          Sets the description.
 boolean setFromDOMDocumentNode(org.w3c.dom.Node workSetNode)
          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 date.
 void setOwner(java.lang.String owner)
          Set the owner.
 void setTitle(java.lang.String title)
          Sets the title.
 void setWebPageURL(java.lang.String webPageURL)
          Sets the web page URL.
 java.lang.String toString()
          Gets a string representation of the work set.
 java.lang.String toStringDetailed()
          Gets a detailed string representation of the work set.
 void writeExternal(java.io.ObjectOutput out)
          Writes the work set 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

protected static final long serialVersionUID
Serial version UID.

See Also:
Constant Field Values

id

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


title

protected java.lang.String title
The title of the work set.


description

protected java.lang.String description
Description of work set.


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 work set.


isPublic

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


isActive

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


query

protected java.lang.String query
The query properties to generate this word set's work part list.


workPartTags

protected java.util.Collection workPartTags
Collection of reference tags of work parts belonging to this work set.

Constructor Detail

WorkSet

public WorkSet()
Create an empty work set.


WorkSet

public WorkSet(java.lang.String title,
               java.lang.String description,
               java.lang.String webPageURL,
               java.lang.String owner,
               boolean isPublic,
               java.lang.String query,
               java.util.Collection workParts)
Create work set.

Parameters:
title - The work set's title.
description - The work set's description.
webPageURL - The work set's web page.
owner - The work set's owner.
isPublic - True if the work set is public.
query - CQL Query which generated the work set.
workParts - The work parts in the work set as a list.

WorkSet

public WorkSet(java.lang.String title,
               java.lang.String description,
               java.lang.String webPageURL,
               java.lang.String owner,
               boolean isPublic,
               java.lang.String query,
               WorkPart[] workParts)
Create work set.

Parameters:
title - The work set's title.
description - The work set's description.
webPageURL - The work set's web page.
owner - The work set's owner.
isPublic - True if the work set is public.
query - CQL Query which generated the work set.
workParts - The work parts in the work set as an array.

WorkSet

public WorkSet(java.lang.String title,
               java.lang.String description,
               java.lang.String webPageURL,
               java.lang.String owner,
               boolean isPublic,
               java.lang.String query,
               java.lang.String[] workPartTags)
Create work set.

Parameters:
title - The work set's title.
description - The work set's description.
webPageURL - The work set's web page.
owner - The work set's owner.
isPublic - True if the work set is public.
query - CQL Query which generated the work set. May be null.
workPartTags - The work part tags as a string array.

WorkSet

public WorkSet(org.w3c.dom.Node workSetNode,
               java.lang.String owner)
Create a work set from a DOM document node.

Parameters:
workSetNode - The root node for the work set.
owner - The work set's owner.
Method Detail

getId

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

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

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.

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 work set is public, false if private.

getIsActive

public boolean getIsActive()
Get the active flag.

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

getQuery

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

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

getWorkPartTags

public java.util.Collection getWorkPartTags()
Gets the work part tags.

Returns:
The work part tags as an unmodifiable collection.

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 date.

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

setModificationTime

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

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.

setIsPublic

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

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

setIsActive

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

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

addWorkPart

public void addWorkPart(WorkPart workPart)
Adds a work part.

Parameters:
workPart - The new work part.

addWorkParts

public void addWorkParts(WorkPart[] workPartArray)
Adds work parts from an array.

Parameters:
workPartArray - The new work parts as an array.

addWorkParts

public void addWorkParts(java.util.Collection workPartCollection)
Adds work parts from a collection.

Parameters:
workPartCollection - The new work parts as a collection.

addWorkPartTags

public void addWorkPartTags(java.lang.String[] workPartTagArray)
Adds work parts from an array of tags.

Parameters:
workPartTagArray - The new work part tags as an array.

removeWorkPart

public void removeWorkPart(WorkPart workPart)
Removes a work part.

Parameters:
workPart - The work part.

removeWorkParts

public void removeWorkParts()
Removes all the work parts.


addToDOMDocument

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

Specified by:
addToDOMDocument in interface UserDataObject
Parameters:
document - DOM document to which to add work 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.

setFromDOMDocumentNode

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

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

toString

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

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

toStringDetailed

public java.lang.String toStringDetailed()
Gets a detailed string representation of the work set.

Returns:
The title.

getSearchDefault

public SearchCriterion getSearchDefault(java.lang.Class cls)
Gets a search criterion default value.

Parameters:
cls - Model class of search criterion.
Returns:
Default value for search criterion.

getJoinClass

public java.lang.Class getJoinClass()
Gets the join class.

Specified by:
getJoinClass in interface SearchCriterion
Returns:
The join class, or null if none.

getWhereClause

public java.lang.String getWhereClause()
Gets the Hibernate where clause.

Specified by:
getWhereClause in interface SearchCriterion
Returns:
The Hibernate where clause.

setArg

public void setArg(org.hibernate.Query q,
                   org.hibernate.Session session)
Sets the Hibernate query argument.

Specified by:
setArg in interface SearchCriterion
Parameters:
q - Hibernate query.
session - Hibernate session.

appendDescription

public void appendDescription(TextLine line,
                              FontInfo romanFontInfo,
                              FontInfo[] fontInfo)
Appends a description to a text line.

Specified by:
appendDescription in interface SearchCriterion
Parameters:
line - Text line.
romanFontInfo - Roman font info.
fontInfo - Array of font info indexed by character set.

getReportPhrase

public java.lang.String getReportPhrase()
Gets the report phrase.

Returns:
The report phrase "in".

getGroupingSpelling

public Spelling getGroupingSpelling(int numHits)
Gets the spelling of the grouping object.

Parameters:
numHits - Number of hits.
Returns:
The spelling of the grouping object.

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.

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.

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 work set 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 work set 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