com.endeca.portal.mdex
Class DiscoveryServiceUtil

java.lang.Object
  extended by com.endeca.portal.mdex.DiscoveryServiceUtil

public class DiscoveryServiceUtil
extends java.lang.Object


Field Summary
static java.lang.String CATCH_ALL_GROUP_KEY
           
static java.lang.String CATCH_ALL_GROUP_NAME
           
static java.lang.String CORPUS_STATE_NAME
           
static java.lang.String DISCOVERY_PROPERTY_SORT_RECORD_COUNT
           
static java.lang.String DISCOVERY_SERVICE
           
static java.lang.String EID_PROPERTY_PREFIX
          Deprecated. 
static java.lang.String MDEX_DIMENSION_KEY
           
static java.lang.String MDEX_GROUP_DISPLAYNAME
           
static java.lang.String MDEX_IS_SINGLE_ASSIGN
           
static java.lang.String MDEX_IS_UNIQUE
           
static java.lang.String MDEX_PROPERTY_DISPLAYNAME
           
static java.lang.String MDEX_PROPERTY_IS_VALUE_SEARCHABLE
           
static java.lang.String MDEX_PROPERTY_KEY
           
static java.lang.String MDEX_PROPERTY_LANGUAGE
           
static java.lang.String MDEX_PROPERTY_MULTI_SELECT
           
static java.lang.String MDEX_PROPERTY_PREFIX
           
static java.lang.String MDEX_PROPERTY_SORTING
           
static java.lang.String MDEX_PROPERTY_TYPE
           
static java.lang.String MDEX_SEMANTIC_PREFIX
           
static java.lang.String NAMESPACE
           
static java.lang.String REQUEST_XML_HEADER
           
static java.lang.String SOAP_FOOTER
           
static java.lang.String SOAP_HEADER
           
static java.lang.String SYSTEM_LOCALIZED_ATTRIBUTE_METADATA
           
static java.lang.String SYSTEM_PROPERTY_PREFIX
           
 
Constructor Summary
DiscoveryServiceUtil()
           
 
Method Summary
static void addConfigElement(com.endeca.mdex.conversation.Request request, com.endeca.mdex.conversation.ContentElementConfig config)
           
static com.endeca.mdex.conversation.ConversationPort addQueryTracking(com.endeca.mdex.conversation.ConversationPort servicePort, RequestIds requestIds)
          instrument a MDEX 7 query by setting HTTP headers
static void addQueryTracking(java.net.HttpURLConnection connection, RequestIds requestIds)
          Instrument a MDEX 7 query by setting HTTP headers
static com.endeca.mdex.conversation.Request clone(com.endeca.mdex.conversation.Request request)
           
static com.endeca.mdex.conversation.Request cloneRequest(com.endeca.mdex.conversation.Request request)
           
static org.w3c.dom.Element createElement(org.w3c.dom.Document document, java.lang.String elementName)
           
static com.endeca.mdex.conversation.Results execute(MDEXState mdexState, com.endeca.mdex.conversation.Request query, RequestIds requestIds)
           
static java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> findAllAutoAppliedFilters(com.endeca.mdex.conversation.Results res, QueryState queryState)
          Scans CS results, gathering all QueryFilters that were implicitly created via filter rules.
static
<T extends QueryFilter>
java.util.List<AutoAppliedFilter<T>>
findAutoAppliedFilters(com.endeca.mdex.conversation.Results res, QueryState queryState, java.lang.String stateName, java.lang.Class<T> filterType)
          Scans CS results, gathering QueryFilters of the specified type and applied to the specified base view that were implicitly created via filter rules.
static
<T> T
fromXML(java.lang.String xmlString, java.lang.Class<T> klass)
           
static java.util.List<com.endeca.mdex.conversation.ValueSearch> getAllAttributeValueSearches(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.Breadcrumbs> getAllBreadcrumbs(com.endeca.mdex.conversation.Results results)
           
static
<T extends com.endeca.mdex.conversation.ContentElementConfig>
java.util.List<T>
getAllContentElementConfigs(com.endeca.mdex.conversation.Request request, java.lang.Class<T> klass)
           
static
<T extends com.endeca.mdex.conversation.ContentElement>
java.util.List<T>
getAllContentElements(com.endeca.mdex.conversation.Results results, java.lang.Class<T> klass)
           
static java.util.List<com.endeca.mdex.conversation.EQL> getAllEQL(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.NavigationMenu> getAllNavigationMenus(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.RecordCount> getAllRecordCounts(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.RecordDetails> getAllRecordDetails(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.RecordList> getAllRecordLists(com.endeca.mdex.conversation.Results results)
           
static java.util.List<com.endeca.mdex.conversation.SearchAdjustments> getAllSearchAdjustments(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.AttributeGroupList getAttributeGroups(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.ValueSearch getAttributeValueSearch(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.AvailableSearchKeys getAvailableSearchKeys(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.Breadcrumbs getBreadcrumbs(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.ContentElementConfig getConfigById(com.endeca.mdex.conversation.Request request, java.lang.String id)
           
static
<T extends com.endeca.mdex.conversation.ContentElement>
T
getContentElement(com.endeca.mdex.conversation.Results results, java.lang.Class<T> klass)
           
static
<T extends com.endeca.mdex.conversation.ContentElementConfig>
T
getContentElementConfig(com.endeca.mdex.conversation.Request request, java.lang.Class<T> klass)
           
static com.endeca.mdex.conversation.EQL getEQL(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.State getNamedState(com.endeca.mdex.conversation.Request req, java.lang.String stateName)
          Find a named State in a conversation service Request.
static com.endeca.mdex.conversation.State getNamedState(com.endeca.mdex.conversation.Results res, java.lang.String stateName)
          Find a named State in conversation service Results.
static com.endeca.mdex.conversation.NavigationMenu getNavigationMenu(com.endeca.mdex.conversation.Results results)
           
static long getNumRecords(com.endeca.mdex.conversation.Results results)
          Convenience method to return the number of records in the result from either a RecordCount or RecordList element
static com.endeca.mdex.conversation.State getOrCreateNamedState(com.endeca.mdex.conversation.Request req, java.lang.String stateName)
          Tries to find the named state if it already exists on the Request.
static com.endeca.mdex.conversation.State getOrCreateSingletonState(com.endeca.mdex.conversation.Request req)
          Tries to find the single unnamed state if it already exists on the Request.
static com.endeca.mdex.conversation.PropertyList getPropertyList(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.RecordCount getRecordCount(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.RecordDetails getRecordDetails(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.RecordList getRecordList(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.SearchAdjustments getSearchAdjustments(com.endeca.mdex.conversation.Results results)
           
static com.endeca.mdex.conversation.State getSingletonState(com.endeca.mdex.conversation.Request req)
          Find the single unnamed State which can be used in lieu of Collections-based named states.
static com.endeca.mdex.conversation.State getSingletonState(com.endeca.mdex.conversation.Results res)
          Find the single unnamed state in conversation service Results.
static void setupNamedStates(com.endeca.mdex.conversation.Request req, java.util.Collection<CollectionBaseView> baseViews)
          Initializes named states on the specified CS Request for all Collections in the system.
static java.lang.String toSoap(com.endeca.mdex.conversation.Request request)
          Create a SOAP request corresponding with the given request object
static java.lang.String toXML(com.endeca.mdex.eql_parser.types.ExpressionBase expr)
           
static java.lang.String toXML(com.endeca.mdex.eql_parser.types.Query Query)
           
static java.lang.String toXML(com.endeca.mdex.conversation.Request request)
           
static java.lang.String toXML(com.endeca.mdex.conversation.Results results)
           
static java.lang.String toXML(com.endeca.mdex.eql_parser.types.StandaloneFilter standaloneFilter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final java.lang.String NAMESPACE
See Also:
Constant Field Values

DISCOVERY_SERVICE

public static final java.lang.String DISCOVERY_SERVICE
See Also:
Constant Field Values

MDEX_PROPERTY_KEY

public static final java.lang.String MDEX_PROPERTY_KEY
See Also:
Constant Field Values

MDEX_PROPERTY_TYPE

public static final java.lang.String MDEX_PROPERTY_TYPE
See Also:
Constant Field Values

MDEX_IS_UNIQUE

public static final java.lang.String MDEX_IS_UNIQUE
See Also:
Constant Field Values

MDEX_IS_SINGLE_ASSIGN

public static final java.lang.String MDEX_IS_SINGLE_ASSIGN
See Also:
Constant Field Values

MDEX_PROPERTY_DISPLAYNAME

public static final java.lang.String MDEX_PROPERTY_DISPLAYNAME
See Also:
Constant Field Values

MDEX_GROUP_DISPLAYNAME

public static final java.lang.String MDEX_GROUP_DISPLAYNAME
See Also:
Constant Field Values

MDEX_DIMENSION_KEY

public static final java.lang.String MDEX_DIMENSION_KEY
See Also:
Constant Field Values

MDEX_PROPERTY_IS_VALUE_SEARCHABLE

public static final java.lang.String MDEX_PROPERTY_IS_VALUE_SEARCHABLE
See Also:
Constant Field Values

MDEX_PROPERTY_LANGUAGE

public static final java.lang.String MDEX_PROPERTY_LANGUAGE
See Also:
Constant Field Values

MDEX_PROPERTY_MULTI_SELECT

public static final java.lang.String MDEX_PROPERTY_MULTI_SELECT
See Also:
Constant Field Values

MDEX_PROPERTY_SORTING

public static final java.lang.String MDEX_PROPERTY_SORTING
See Also:
Constant Field Values

SYSTEM_LOCALIZED_ATTRIBUTE_METADATA

public static final java.lang.String SYSTEM_LOCALIZED_ATTRIBUTE_METADATA
See Also:
Constant Field Values

MDEX_PROPERTY_PREFIX

public static final java.lang.String MDEX_PROPERTY_PREFIX
See Also:
Constant Field Values

MDEX_SEMANTIC_PREFIX

public static final java.lang.String MDEX_SEMANTIC_PREFIX
See Also:
Constant Field Values

SYSTEM_PROPERTY_PREFIX

public static final java.lang.String SYSTEM_PROPERTY_PREFIX
See Also:
Constant Field Values

DISCOVERY_PROPERTY_SORT_RECORD_COUNT

public static final java.lang.String DISCOVERY_PROPERTY_SORT_RECORD_COUNT
See Also:
Constant Field Values

EID_PROPERTY_PREFIX

@Deprecated
public static final java.lang.String EID_PROPERTY_PREFIX
Deprecated. 
See Also:
Constant Field Values

CATCH_ALL_GROUP_KEY

public static final java.lang.String CATCH_ALL_GROUP_KEY
See Also:
Constant Field Values

CATCH_ALL_GROUP_NAME

public static final java.lang.String CATCH_ALL_GROUP_NAME
See Also:
Constant Field Values

REQUEST_XML_HEADER

public static final java.lang.String REQUEST_XML_HEADER
See Also:
Constant Field Values

SOAP_HEADER

public static final java.lang.String SOAP_HEADER
See Also:
Constant Field Values

SOAP_FOOTER

public static final java.lang.String SOAP_FOOTER
See Also:
Constant Field Values

CORPUS_STATE_NAME

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

DiscoveryServiceUtil

public DiscoveryServiceUtil()
Method Detail

getNamedState

public static com.endeca.mdex.conversation.State getNamedState(com.endeca.mdex.conversation.Request req,
                                                               java.lang.String stateName)
                                                        throws StateNotFoundException
Find a named State in a conversation service Request.

Parameters:
req - a conversation service Request
stateName - name of the State to seek in req
Returns:
matching State
Throws:
StateNotFoundException - if the specified named state cannot be found in the Request
Since:
3.1 (Collections epic)

getSingletonState

public static com.endeca.mdex.conversation.State getSingletonState(com.endeca.mdex.conversation.Request req)
                                                            throws StateNotFoundException
Find the single unnamed State which can be used in lieu of Collections-based named states.

Parameters:
req - a conversation service Request
Returns:
State singleton State
Throws:
StateNotFoundException - if there is no singleton state on the request

getOrCreateNamedState

public static com.endeca.mdex.conversation.State getOrCreateNamedState(com.endeca.mdex.conversation.Request req,
                                                                       java.lang.String stateName)
Tries to find the named state if it already exists on the Request. If it doesn't yet exist, a new State is created and added to the Request.

Parameters:
req - a conversation service Request
stateName - name of a State to seek in req
Returns:
State matching specified name or a newly created one
Since:
3.1 (Collections epic)

getOrCreateSingletonState

public static com.endeca.mdex.conversation.State getOrCreateSingletonState(com.endeca.mdex.conversation.Request req)
Tries to find the single unnamed state if it already exists on the Request. If it doesn't yet exist, a new singleton state is created and added to the Request.

Parameters:
req - a conversation service Request
Returns:
State singleton State

setupNamedStates

public static void setupNamedStates(com.endeca.mdex.conversation.Request req,
                                    java.util.Collection<CollectionBaseView> baseViews)
Initializes named states on the specified CS Request for all Collections in the system.

Parameters:
req - a CS Request
baseViews - all collections for which to generate named states

getNamedState

public static com.endeca.mdex.conversation.State getNamedState(com.endeca.mdex.conversation.Results res,
                                                               java.lang.String stateName)
                                                        throws StateNotFoundException
Find a named State in conversation service Results.

Parameters:
res - conversation service Results
stateName - name of the State to seek in res
Returns:
matching State
Throws:
StateNotFoundException - if the specified named state cannot be found in the Results
Since:
3.1 (Collections epic)

getSingletonState

public static com.endeca.mdex.conversation.State getSingletonState(com.endeca.mdex.conversation.Results res)
                                                            throws StateNotFoundException
Find the single unnamed state in conversation service Results.

Parameters:
res - conversation service Results
Returns:
singleton State
Throws:
StateNotFoundException - if there is no singleton state on the request

findAutoAppliedFilters

public static <T extends QueryFilter> java.util.List<AutoAppliedFilter<T>> findAutoAppliedFilters(com.endeca.mdex.conversation.Results res,
                                                                                                  QueryState queryState,
                                                                                                  java.lang.String stateName,
                                                                                                  java.lang.Class<T> filterType)
Scans CS results, gathering QueryFilters of the specified type and applied to the specified base view that were implicitly created via filter rules.

Parameters:
res - a CS results object containing round-tripped named states
queryState - the original QueryState submitted to Endeca Server
stateName - name of state from which to gather auto-applied filters (null to gather all states' auto-applied filters)
filterType - specific type of auto-applied filters to gather
Returns:
list of auto-applied QueryFilters matching the specified type from the specified named state

findAllAutoAppliedFilters

public static java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> findAllAutoAppliedFilters(com.endeca.mdex.conversation.Results res,
                                                                                                                       QueryState queryState)
Scans CS results, gathering all QueryFilters that were implicitly created via filter rules.

Parameters:
res - CS Results object
queryState -
Returns:
Map keyed by state name string; stored values are the lists of auto-applied QueryFilters

getRecordList

public static com.endeca.mdex.conversation.RecordList getRecordList(com.endeca.mdex.conversation.Results results)

getAllRecordLists

public static java.util.List<com.endeca.mdex.conversation.RecordList> getAllRecordLists(com.endeca.mdex.conversation.Results results)

getRecordDetails

public static com.endeca.mdex.conversation.RecordDetails getRecordDetails(com.endeca.mdex.conversation.Results results)

getAllRecordDetails

public static java.util.List<com.endeca.mdex.conversation.RecordDetails> getAllRecordDetails(com.endeca.mdex.conversation.Results results)

getAttributeValueSearch

public static com.endeca.mdex.conversation.ValueSearch getAttributeValueSearch(com.endeca.mdex.conversation.Results results)

getAllAttributeValueSearches

public static java.util.List<com.endeca.mdex.conversation.ValueSearch> getAllAttributeValueSearches(com.endeca.mdex.conversation.Results results)

getBreadcrumbs

public static com.endeca.mdex.conversation.Breadcrumbs getBreadcrumbs(com.endeca.mdex.conversation.Results results)

getAllBreadcrumbs

public static java.util.List<com.endeca.mdex.conversation.Breadcrumbs> getAllBreadcrumbs(com.endeca.mdex.conversation.Results results)

getAvailableSearchKeys

public static com.endeca.mdex.conversation.AvailableSearchKeys getAvailableSearchKeys(com.endeca.mdex.conversation.Results results)

getNavigationMenu

public static com.endeca.mdex.conversation.NavigationMenu getNavigationMenu(com.endeca.mdex.conversation.Results results)

getAllNavigationMenus

public static java.util.List<com.endeca.mdex.conversation.NavigationMenu> getAllNavigationMenus(com.endeca.mdex.conversation.Results results)

getEQL

public static com.endeca.mdex.conversation.EQL getEQL(com.endeca.mdex.conversation.Results results)

getAllEQL

public static java.util.List<com.endeca.mdex.conversation.EQL> getAllEQL(com.endeca.mdex.conversation.Results results)

getSearchAdjustments

public static com.endeca.mdex.conversation.SearchAdjustments getSearchAdjustments(com.endeca.mdex.conversation.Results results)

getAllSearchAdjustments

public static java.util.List<com.endeca.mdex.conversation.SearchAdjustments> getAllSearchAdjustments(com.endeca.mdex.conversation.Results results)

getRecordCount

public static com.endeca.mdex.conversation.RecordCount getRecordCount(com.endeca.mdex.conversation.Results results)

getAllRecordCounts

public static java.util.List<com.endeca.mdex.conversation.RecordCount> getAllRecordCounts(com.endeca.mdex.conversation.Results results)

getAttributeGroups

public static com.endeca.mdex.conversation.AttributeGroupList getAttributeGroups(com.endeca.mdex.conversation.Results results)

getPropertyList

public static com.endeca.mdex.conversation.PropertyList getPropertyList(com.endeca.mdex.conversation.Results results)

getNumRecords

public static long getNumRecords(com.endeca.mdex.conversation.Results results)
Convenience method to return the number of records in the result from either a RecordCount or RecordList element

Parameters:
results -
Returns:
the numer of records

getConfigById

public static com.endeca.mdex.conversation.ContentElementConfig getConfigById(com.endeca.mdex.conversation.Request request,
                                                                              java.lang.String id)

getContentElement

public static <T extends com.endeca.mdex.conversation.ContentElement> T getContentElement(com.endeca.mdex.conversation.Results results,
                                                                                          java.lang.Class<T> klass)

getAllContentElements

public static <T extends com.endeca.mdex.conversation.ContentElement> java.util.List<T> getAllContentElements(com.endeca.mdex.conversation.Results results,
                                                                                                              java.lang.Class<T> klass)

getContentElementConfig

public static <T extends com.endeca.mdex.conversation.ContentElementConfig> T getContentElementConfig(com.endeca.mdex.conversation.Request request,
                                                                                                      java.lang.Class<T> klass)

getAllContentElementConfigs

public static <T extends com.endeca.mdex.conversation.ContentElementConfig> java.util.List<T> getAllContentElementConfigs(com.endeca.mdex.conversation.Request request,
                                                                                                                          java.lang.Class<T> klass)

addConfigElement

public static void addConfigElement(com.endeca.mdex.conversation.Request request,
                                    com.endeca.mdex.conversation.ContentElementConfig config)

createElement

public static org.w3c.dom.Element createElement(org.w3c.dom.Document document,
                                                java.lang.String elementName)
                                         throws javax.xml.parsers.ParserConfigurationException
Throws:
javax.xml.parsers.ParserConfigurationException

toSoap

public static java.lang.String toSoap(com.endeca.mdex.conversation.Request request)
                               throws javax.xml.bind.JAXBException
Create a SOAP request corresponding with the given request object

Parameters:
request -
Returns:
String containing the SOAP request
Throws:
javax.xml.bind.JAXBException

toXML

public static java.lang.String toXML(com.endeca.mdex.conversation.Request request)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

toXML

public static java.lang.String toXML(com.endeca.mdex.conversation.Results results)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

toXML

public static java.lang.String toXML(com.endeca.mdex.eql_parser.types.StandaloneFilter standaloneFilter)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

toXML

public static java.lang.String toXML(com.endeca.mdex.eql_parser.types.ExpressionBase expr)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

toXML

public static java.lang.String toXML(com.endeca.mdex.eql_parser.types.Query Query)
                              throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

fromXML

public static <T> T fromXML(java.lang.String xmlString,
                            java.lang.Class<T> klass)
                 throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

clone

public static com.endeca.mdex.conversation.Request clone(com.endeca.mdex.conversation.Request request)
                                                  throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

cloneRequest

public static com.endeca.mdex.conversation.Request cloneRequest(com.endeca.mdex.conversation.Request request)
                                                         throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

execute

public static com.endeca.mdex.conversation.Results execute(MDEXState mdexState,
                                                           com.endeca.mdex.conversation.Request query,
                                                           RequestIds requestIds)
                                                    throws DataSourceException
Throws:
DataSourceException

addQueryTracking

public static com.endeca.mdex.conversation.ConversationPort addQueryTracking(com.endeca.mdex.conversation.ConversationPort servicePort,
                                                                             RequestIds requestIds)
instrument a MDEX 7 query by setting HTTP headers

Parameters:
servicePort - the ConversationPort for the query
requestIds - the tracker containing the session, request, etc. tokens
Returns:
the modified ConversationPort

addQueryTracking

public static void addQueryTracking(java.net.HttpURLConnection connection,
                                    RequestIds requestIds)
Instrument a MDEX 7 query by setting HTTP headers

Parameters:
connection - the connection for the query
requestIds - the tracker containing the session, request, etc. tokens