com.endeca.portal.data
Class MDEXStateManager

java.lang.Object
  extended by com.endeca.portal.data.MDEXStateManager

public class MDEXStateManager
extends java.lang.Object

The MDEXStateManager class provides helper static functions used by DataSource methods to work with QueryStates.

Author:
Endeca Technologies, Inc.

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
MDEXStateManager()
           
 
Method Summary
protected static void addEventTrigger(javax.portlet.PortletRequest request, MDEXState ds)
          Use this method to make sure an appropriate change event will be triggered for an altered MDEXState.
protected static UserSession fetchUserSession(javax.portlet.PortletRequest request)
          Method to fetch the current UserSession.
protected static java.util.List<QueryFunction> getSubtractedFilterList(QueryState baseState, QueryState stateToSubtract)
           
static QueryState handleStateInitial(javax.portlet.PortletRequest request, MDEXState mdexState)
          Returns specified MDEXState's initial QueryState.
static QueryState handleStateMerge(javax.portlet.PortletRequest request, MDEXState mdexState)
          Returns a QueryState after any necessary merge operations with other QueryStates.
static void handleStateReset(javax.portlet.PortletRequest request, MDEXState mdexState)
          Resets an MDEXState, then publishes the event trigger.
static void handleStateUpdate(javax.portlet.PortletRequest request, MDEXState mdexState, QueryState newQueryState)
          Sets the given QueryState onto the specified MDEXState, then publishes the event trigger.
protected static void publishEventTriggersForState(javax.portlet.PortletRequest request, MDEXState mdexState, UserSession userSession)
          Publishes an event trigger for a data source change event on this state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

MDEXStateManager

public MDEXStateManager()
Method Detail

handleStateMerge

public static QueryState handleStateMerge(javax.portlet.PortletRequest request,
                                          MDEXState mdexState)
                                   throws QueryStateException
Returns a QueryState after any necessary merge operations with other QueryStates. The returned QueryState is independent of the supplied MDEXState's QueryState because the input state is deep-cloned during this merge operation.

Throws:
QueryStateException

handleStateUpdate

public static void handleStateUpdate(javax.portlet.PortletRequest request,
                                     MDEXState mdexState,
                                     QueryState newQueryState)
                              throws QueryStateException
Sets the given QueryState onto the specified MDEXState, then publishes the event trigger.

Throws:
QueryStateException

handleStateReset

public static void handleStateReset(javax.portlet.PortletRequest request,
                                    MDEXState mdexState)
                             throws QueryStateException
Resets an MDEXState, then publishes the event trigger.

Parameters:
request - the PortletRequest
mdexState - the current data source state
Throws:
QueryStateException - on error

handleStateInitial

public static QueryState handleStateInitial(javax.portlet.PortletRequest request,
                                            MDEXState mdexState)
                                     throws QueryStateException
Returns specified MDEXState's initial QueryState.

Throws:
QueryStateException

getSubtractedFilterList

protected static java.util.List<QueryFunction> getSubtractedFilterList(QueryState baseState,
                                                                       QueryState stateToSubtract)

publishEventTriggersForState

protected static void publishEventTriggersForState(javax.portlet.PortletRequest request,
                                                   MDEXState mdexState,
                                                   UserSession userSession)
Publishes an event trigger for a data source change event on this state.

Parameters:
request - current request
mdexState - mdexState undergoing state change
userSession - current user session

fetchUserSession

protected static UserSession fetchUserSession(javax.portlet.PortletRequest request)
                                       throws UserSessionException
Method to fetch the current UserSession. The separate method facilitates testing.

Parameters:
request - the current request
Returns:
the UserSession associated with the current request
Throws:
UserSessionException

addEventTrigger

protected static void addEventTrigger(javax.portlet.PortletRequest request,
                                      MDEXState ds)
Use this method to make sure an appropriate change event will be triggered for an altered MDEXState. Implementers should call this method from handleStateReset(PortletRequest, MDEXState) and from handleStateUpdate(PortletRequest, MDEXState, QueryState) to ensure all portlets are aware of the change.

Parameters:
request - the current PortletRequest
ds - The MDEXState representing the data source that has changed and needs an event triggered