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

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

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

A WordHoard query.

A query contains a WordHoard Corpus Query Language specification. At present, WordHoard allows for two types of saved queries: word-based queries for constructing word sets and phrase sets, and bibliographic-based queries for constructing work sets.

Each query object contains the following fields.

See Also:
Serialized Form

Field Summary
protected  java.util.Date creationTime
          Original creation date/time.
protected  java.lang.String description
          Description of query.
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 query (can be seen by other users), false if private query.
protected  java.util.Date modificationTime
          Last modification date/time.
protected  java.lang.String owner
          Owner of this query.
protected  java.lang.String queryText
          Query text in WordHoard Corpus Query Language format.
protected  int queryType
          Type of query.
protected static long serialVersionUID
          Serial version UID.
protected  java.lang.String title
          The title of the query.
protected  java.lang.String webPageURL
          Web page URL.
static int WORDQUERY
          Word query.
static int WORKPARTQUERY
          Work/Work part query.
 
Constructor Summary
WHQuery()
          Create an empty query.
WHQuery(org.w3c.dom.Node queryNode, java.lang.String owner)
          Create a query from a DOM document node.
WHQuery(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, int queryType, java.lang.String queryText)
          Create a query with a specified name.
 
Method Summary
 boolean addToDOMDocument(org.w3c.dom.Document document)
          Add query to DOM document.
 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.
 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()
          Return the query text.
 java.lang.String getQueryText()
          Get the query text.
 int getQueryType()
          Get the query type.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getWebPageURL()
          Gets the web page URL.
 int hashCode()
          Returns a hash code for the object.
 void readExternal(java.io.ObjectInput in)
          Reads the query from an object input stream (deserializes the object).
 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 queryNode)
          Set query settings from a 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 setQueryText(java.lang.String queryText)
          Set the query text.
 void setQueryType(int queryType)
          Set the query type.
 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 query.
 java.lang.String toStringDetailed()
          Gets a detailed string representation of the query.
 void writeExternal(java.io.ObjectOutput out)
          Writes the query 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

WORDQUERY

public static final int WORDQUERY
Word query.

See Also:
Constant Field Values

WORKPARTQUERY

public static final int WORKPARTQUERY
Work/Work part query.

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


description

protected java.lang.String description
Description of query.


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


isPublic

protected boolean isPublic
true if public query (can be seen by other users), false if private query.


isActive

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


queryType

protected int queryType
Type of query.


queryText

protected java.lang.String queryText
Query text in WordHoard Corpus Query Language format.

Constructor Detail

WHQuery

public WHQuery()
Create an empty query.


WHQuery

public WHQuery(java.lang.String title,
               java.lang.String description,
               java.lang.String webPageURL,
               java.lang.String owner,
               boolean isPublic,
               int queryType,
               java.lang.String queryText)
Create a query with a specified name.

Parameters:
title - The query's title.
description - The query's description.
webPageURL - The query's web page URL.
owner - The query's owner.
isPublic - True if the query is public.
queryType - The query type.
queryText - The query text.

WHQuery

public WHQuery(org.w3c.dom.Node queryNode,
               java.lang.String owner)
Create a query from a DOM document node.

Parameters:
queryNode - The root node for the query.
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 query 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.

getQueryType

public int getQueryType()
Get the query type.

Returns:
The query type.

getQueryText

public java.lang.String getQueryText()
Get the query text.

Returns:
The query text.

getQuery

public java.lang.String getQuery()
Return the query text.

Specified by:
getQuery in interface UserDataObject
Returns:
The query text.

For UserDataObject interface.


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.

setIsPublic

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

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

setIsActive

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

Parameters:
isActive - True if the query is active.

setQueryType

public void setQueryType(int queryType)
Set the query type.

Parameters:
queryType - The query type.

setQueryText

public void setQueryText(java.lang.String queryText)
Set the query text.

Parameters:
queryText - The query text.

addToDOMDocument

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

Specified by:
addToDOMDocument in interface UserDataObject
Parameters:
document - DOM document to which to add query. 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 queryNode)
Set query settings from a DOM document node.

Specified by:
setFromDOMDocumentNode in interface UserDataObject
Parameters:
queryNode - The DOM node which is the root of the query to get.
Returns:
true if settings retrieved.

toString

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

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

toStringDetailed

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

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.

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 query 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 query 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