com.endeca.portal.data.functions
Class RecordAggregator

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

public class RecordAggregator
extends QueryFilter

This class makes it possible to set the rollup key for aggregate record queries on MDEX 6. RecordAggregator is only supported on ENE presentation API data sources. Attempting to apply RecordAggregator to a discovery service data source will result in a QueryFunctionUnsupportedException.

Author:
Endeca Technologies, Inc.
See Also:
Serialized Form

Nested Class Summary
static class RecordAggregator.AggregateCount
          Enum that parallels and abstracts the same constants in ENEQuery.
 
Field Summary
 
Fields inherited from class com.endeca.portal.data.functions.QueryFunction
CLASS_PROPERTY, operator
 
Constructor Summary
protected RecordAggregator()
           
  RecordAggregator(org.json.JSONObject jsonObject)
          initializes this query function from JSON.
  RecordAggregator(java.lang.String rollupKey)
          Convenience constructor to create this query function given a rollup key.
  RecordAggregator(java.lang.String rollupKey, RecordAggregator.AggregateCount aggCount)
          Convenience constructor to create this query function given a rollup key and the number of base records per aggregate
 
Method Summary
 void applyToDiscoveryServiceQuery(com.endeca.mdex.conversation.Request query)
          Apply this function to a Request.
 void applyToENEQuery(com.endeca.navigation.ENEQuery query)
          Apply this function to an ENEQuery.
 RecordAggregator.AggregateCount getAggCount()
          Retrieves the number of base records per aggregate.
 java.util.List<java.lang.reflect.Method> getGetters()
          Return the list of property getters on this function.
 java.lang.String getRollupKey()
          retrieves the aggregate record query rollup key
 java.util.List<java.lang.reflect.Method> getSetters()
          Return the list of property setters on this function.
 void setAggCount(RecordAggregator.AggregateCount aggCount)
          Sets the number of base records per aggregate.
 void setAggCount(java.lang.String aggCount)
          Sets the number of base records per aggregate.
 void setRollupKey(java.lang.String rollupKey)
          sets the aggregate record query rollup key
 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 com.endeca.portal.data.functions.QueryFunction
clone, equals, equals, getInstance, getInstance, getName, getOperator, hashCode, init, setName, setOperator, setOperator, toJSON, toXML
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecordAggregator

protected RecordAggregator()

RecordAggregator

public RecordAggregator(org.json.JSONObject jsonObject)
                 throws org.json.JSONException,
                        java.lang.IllegalArgumentException,
                        java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException,
                        java.lang.InstantiationException,
                        java.lang.reflect.InvocationTargetException
initializes this query function from JSON.

Parameters:
jsonObject - the JSON Object from which initialization occurs.
Throws:
org.json.JSONException
java.lang.IllegalArgumentException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException

RecordAggregator

public RecordAggregator(java.lang.String rollupKey)
Convenience constructor to create this query function given a rollup key.

Parameters:
rollupKey - the aggregate record query rollup key

RecordAggregator

public RecordAggregator(java.lang.String rollupKey,
                        RecordAggregator.AggregateCount aggCount)
Convenience constructor to create this query function given a rollup key and the number of base records per aggregate

Parameters:
rollupKey - the aggregate record query rollup key
aggCount - the number of base records per aggregate
Method Detail

getRollupKey

public java.lang.String getRollupKey()
retrieves the aggregate record query rollup key

Returns:
the aggregate record query rollup key

setRollupKey

public void setRollupKey(java.lang.String rollupKey)
sets the aggregate record query rollup key

Parameters:
rollupKey - the aggregate record query rollup key

getAggCount

public RecordAggregator.AggregateCount getAggCount()
Retrieves the number of base records per aggregate.

Returns:
the number of base records per aggregate.

setAggCount

public void setAggCount(RecordAggregator.AggregateCount aggCount)
Sets the number of base records per aggregate.

Parameters:
aggCount - the number of base records per aggregate.

setAggCount

public void setAggCount(java.lang.String aggCount)
                 throws java.lang.IllegalArgumentException
Sets the number of base records per aggregate.

Parameters:
aggCount - the number of base records per aggregate.
Throws:
java.lang.IllegalArgumentException - if the incoming String does not map to an AggregateCount value

getSetters

public java.util.List<java.lang.reflect.Method> getSetters()
Description copied from class: QueryFunction
Return the list of property setters on this function. Must be implemented by subclass. Required for correct JSON serialization/deserialization support. For most subclasses, implementing this method should be simple, as long as your setter methods follow standard Java naming conventions (e.g. "setPropertyName(PropertyType)"). All you should need to write is:
 private static List setters = Reflection.getSetters(MyFunctionClass.class);
 \@Override
 public List getSetters() {
        return setters;
 }
 

Specified by:
getSetters in class QueryFunction
Returns:
the list of setters

getGetters

public java.util.List<java.lang.reflect.Method> getGetters()
Description copied from class: QueryFunction
Return the list of property getters on this function. Must be implemented by subclass. Required for correct JSON serialization/deserialization support. For most subclasses, implementing this method should be simple, as long as your getter methods follow standard Java naming conventions (e.g. "getPropertyName()"). All you should need to write is:
 private static List getters = Reflection.getGetters(MyFunctionClass.class);
 \@Override
 public List getGetters() {
        return getters;
 }
 

Specified by:
getGetters in class QueryFunction
Returns:
the list of getters

applyToENEQuery

public void applyToENEQuery(com.endeca.navigation.ENEQuery query)
Description copied from class: QueryFunction
Apply this function to an ENEQuery. Must be implemented by subclass.

Specified by:
applyToENEQuery in class QueryFunction

applyToDiscoveryServiceQuery

public void applyToDiscoveryServiceQuery(com.endeca.mdex.conversation.Request query)
                                  throws QueryFunctionUnsupportedException
Description copied from class: QueryFunction
Apply this function to a Request. Must be implemented by subclass.

Specified by:
applyToDiscoveryServiceQuery in class QueryFunction
Throws:
QueryFunctionUnsupportedException

toString

public java.lang.String toString()
Description copied from class: QueryFunction
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.

Specified by:
toString in class QueryFunction