com.endeca.portal.data
Class MDEXStateRelationshipUtil

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

public class MDEXStateRelationshipUtil
extends java.lang.Object

Utility class providing convenient methods for navigating data source relationships, based on the use of the "parentDataSource" configuration property.


Field Summary
static java.lang.String CONFIG_PROPERTY_PARENT_DATA_SOURCE
           
 
Constructor Summary
MDEXStateRelationshipUtil()
           
 
Method Summary
static java.util.List<MDEXState> getDescendants(MDEXState mdexState, UserSession userSession)
          Gets a list of MDEXState objects that are descendants of the provided MDEXState, determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations.
static MDEXState getParentMDEXState(MDEXState mdexState, UserSession userSession)
          Gets the parent MDEXState object determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations.
static MDEXState getRootMDEXState(MDEXState mdexState, UserSession userSession)
          Gets the MDEXState object representing the top of the ancestor tree determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_PROPERTY_PARENT_DATA_SOURCE

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

MDEXStateRelationshipUtil

public MDEXStateRelationshipUtil()
Method Detail

getParentMDEXState

public static MDEXState getParentMDEXState(MDEXState mdexState,
                                           UserSession userSession)
Gets the parent MDEXState object determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations.

Parameters:
mdexState - the MDEXState object containing the CONFIG_PROPERTY_PARENT_DATA_SOURCE property which references the requested parent
userSession - the UserSession
Returns:
the parent MDEXState, or null if the configuration does not contain the "parentDataSource" property or if a configuration error is caught.

getRootMDEXState

public static MDEXState getRootMDEXState(MDEXState mdexState,
                                         UserSession userSession)
Gets the MDEXState object representing the top of the ancestor tree determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations.

Parameters:
mdexState - the MDEXState object containing the CONFIG_PROPERTY_PARENT_DATA_SOURCE property which references a parent MDEXState (which presumably also includes the property and thus defines an ancestor tree)
userSession - the UserSession
Returns:
the root MDEXState, or null if the configuration does not contain the "parentDataSource" property or if a configuration error is caught.

getDescendants

public static java.util.List<MDEXState> getDescendants(MDEXState mdexState,
                                                       UserSession userSession)
Gets a list of MDEXState objects that are descendants of the provided MDEXState, determined by the CONFIG_PROPERTY_PARENT_DATA_SOURCE property used in data source configurations. This method will look for any other MDEXState defined in session containing a reference to the provided MDEXState's ID, and will recursively traverse the relationship tree looking for all descendants.

Parameters:
mdexState - the MDEXState object for which all descendants are requested.
userSession - the UserSession
Returns:
a List of MDEXStates, which may be an empty list if the "parentDataSource" is not found on other MDEXStates in session or if a configuration error is caught.