com.endeca.portal.data.functions
Class QueryFunction

java.lang.Object
  extended by com.endeca.portal.data.functions.QueryFunction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
QueryConfig, QueryFilter

public abstract class QueryFunction
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

The base class of all QueryFunctions. Wraps functionality for serializing and deserializing, cloning, and comparing. Refer to subclasses for specific types of functions.

Subclassing

For Semantic reasons, you should usually consider subclassing either QueryFilter or QueryConfig, not this class directly. Other than that, simply pay attention to the abstract methods in this class and your toString() implementation.

See Also:
QueryFilter, QueryConfig, Serialized Form

Field Summary
static java.lang.String CLASS_PROPERTY
           
 
Constructor Summary
protected QueryFunction()
           
 
Method Summary
abstract  void applyToDiscoveryServiceQuery(com.endeca.mdex.conversation.Request query)
          Apply this function to a Request.
 void beforeQueryStateAdd(QueryState state)
          Function to check for any additional conditions when adding to the query state.
 QueryFunction clone()
           
 boolean equals(java.lang.Object other)
           
 boolean equals(QueryFunction other)
          Compares two QueryFunction instances by checking class types and using the object's toString() method
 java.lang.String getName()
          Retrieve the name.
 int hashCode()
           
 void initializeFromJSON(MDEXState mdexState)
          This method is called when constructing a MDEXState's initialQueryState from a json object.
 void setName(java.lang.String name)
          Set the name.
abstract  java.lang.String toString()
          This class' toString is abstract: all concrete subclasses are expected to provide an implementation. toString is used in comparing QueryFunction instances for equality, so if you implement a QueryFunction subclass it is important that your toString implementation be consistent and deterministic.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_PROPERTY

public static final java.lang.String CLASS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

QueryFunction

protected QueryFunction()
Method Detail

getName

public java.lang.String getName()
Retrieve the name.

Returns:
the name

setName

public void setName(java.lang.String name)
Set the name.

Parameters:
name - the name to set

applyToDiscoveryServiceQuery

public abstract void applyToDiscoveryServiceQuery(com.endeca.mdex.conversation.Request query)
                                           throws QueryFunctionUnsupportedException
Apply this function to a Request. Must be implemented by subclass.

Parameters:
query -
Throws:
QueryFunctionUnsupportedException

toString

public abstract java.lang.String toString()
This class' toString is abstract: all concrete subclasses are expected to provide an implementation. toString is used in comparing QueryFunction instances for equality, so if you implement a QueryFunction subclass it is important that your toString implementation be consistent and deterministic.

Overrides:
toString in class java.lang.Object

clone

public QueryFunction clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(QueryFunction other)
Compares two QueryFunction instances by checking class types and using the object's toString() method

Parameters:
other -
Returns:
true if this QueryFunction equals the other

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

beforeQueryStateAdd

public void beforeQueryStateAdd(QueryState state)
Function to check for any additional conditions when adding to the query state. The base function won't do anything, but can be overridden as necessary.


initializeFromJSON

public void initializeFromJSON(MDEXState mdexState)
                        throws QueryFunctionInitializationException
This method is called when constructing a MDEXState's initialQueryState from a json object. Subclasses should override and implement this method if they desire to execute code upon initialization from json. The ArbitraryLQLASTFilter classes use this technique to allow different params/member vars for initialization from json vs. initialization programmatically from within Java.

Parameters:
mdexState - the MDEXState object on which this QueryFunction exists
Throws:
QueryFunctionInitializationException