public class DataSource
extends java.lang.Object
QueryState
on the
connection, handles the logic of executing a
query on an MDEX to get results, and handles the logic of altering the QueryState
.QueryState
Constructor and Description |
---|
DataSource(javax.portlet.PortletRequest request) |
DataSource(javax.portlet.PortletRequest request,
long groupId) |
DataSource(javax.portlet.PortletRequest request,
MDEXState mdexState) |
DataSource(javax.portlet.PortletRequest request,
java.lang.String[] boundDataSets) |
Modifier and Type | Method and Description |
---|---|
void |
addCollectionData(java.lang.String collectionKey,
java.util.List<Record> recordList)
Add records to a collection
One of the assignments in each 'Record' object should have the unique identifier property key/value.
|
void |
addCollectionName(java.lang.String collectionName,
java.lang.String newCollectionName) |
void |
clearMetadataCaches()
Clears the caches associated with this datasource.
|
void |
clearMetadataCaches(boolean refresh) |
void |
clearViewCache()
Deprecated.
components shouldn't need to manually clear caches anymore
|
boolean |
collectionExists(java.lang.String collectionKey) |
java.lang.String |
convertEQLToString(com.endeca.mdex.eql_parser.types.Query queryAST)
Converts a full EQL Query AST into a readable EQL string.
|
java.lang.String |
convertEQLToString(com.endeca.mdex.eql_parser.types.StandaloneFilter filterAST)
Converts an EQL Filter AST into a readable EQL string.
|
java.lang.String |
convertEQLToString(com.endeca.mdex.eql_parser.types.Statement eqlStatement)
Converts an single EQL Statement into a readable EQL string.
|
com.endeca.mdex.conversation.types.Request |
createDiscoveryServiceQuery(QueryState state)
This method returns a query based on query state.
|
int |
deleteView(java.lang.String viewKey)
Deletes the view referenced by the passed keys.
|
java.lang.String |
determineStateName(QueryFunction f)
Determines the correct state name for the given
QueryFunction for use when applying the
QueryFunction to the Request. |
QueryResults |
execute()
Executes a query representing the data source's QueryState.
|
QueryResults |
execute(QueryState queryState)
Executes a query representing the QueryState.
|
com.endeca.mdex.conversation.types.Results |
execute(com.endeca.mdex.conversation.types.Request query)
Applies security and executes query against the current request's State.
|
com.endeca.mdex.config.services.types.Results |
executeConfigServiceUpdateOperation(com.endeca.mdex.config.services.types.ConfigTransaction configTransaction)
Executes update config service transactions
|
java.util.Collection<CollectionBaseView> |
getAllCollections() |
java.util.Collection<SemanticView> |
getAllCollectionsAndSemanticViews()
Get the full set of views, including both collection base views and custom semantic views.
|
java.util.Collection<SemanticView> |
getAllCollectionsAndSemanticViews(boolean includeNonActive)
Get the full set of views, including both collection base views and custom semantic views.
|
java.util.Collection<SemanticView> |
getAllSemanticViews() |
java.util.Collection<SemanticView> |
getAllSemanticViews(boolean includeNonActive) |
CollectionBaseView |
getCollection(java.lang.String collectionKey)
Get a
CollectionBaseView that represents a collection base view. |
SemanticView |
getCollectionOrSemanticView(java.lang.String viewKey)
Get a named
SemanticView , which could be either a collection base view or a custom semantic view. |
java.util.List<IncompleteCollectionState> |
getIncompleteCollections() |
QueryState |
getInitialQueryState()
Retrieve the base QueryState on this data source, which is the
InitialQueryState + baseFilte
|
protected MDEXState |
getMDEXState() |
java.util.Collection<PredefinedMetric> |
getPredefinedMetrics(java.lang.String viewKey)
Get all predefined metrics for a given view.
|
QueryState |
getQueryState()
Retrieve the current query state on this data source.
|
protected RequestIds |
getRequestIds() |
SemanticView |
getSemanticView(java.lang.String viewKey)
Get a custom
SemanticView by the specified viewKey. |
java.lang.String |
getServiceURL()
Return the service URL state for this data source.
|
java.util.List<java.lang.String> |
getTypeAheadTags()
Returns list of tags for this project.
|
protected UserSession |
getUserSession() |
void |
induceEntityCacheFlush()
Issues an empty Conversation Service request with an EQLConfig against this project's entity namespace in order
for the Dgraph Gateway to refresh its entity cache.
|
boolean |
isAvailable() |
boolean |
isOnline()
Returns the cached availability of this data domain.
|
void |
moveCollectionName(java.lang.String collectionNameToMove,
java.lang.String targetCollectionName) |
com.endeca.mdex.eql_parser.types.ExpressionBase |
parseLQLExpression(java.lang.String expression)
Parse an LQL Filter string and return a parsed ExpressionBase object form of that string.
|
com.endeca.mdex.eql_parser.types.QueryWithAttributeMetadata |
parseLQLQuery(java.lang.String query,
boolean validationEnabled)
Parse an EQL Query string and return a parsed object form of that string.
|
int |
putView(SemanticView sView)
Adds or updates a custom semantic view or a collection.
|
void |
removeCollectionName(java.lang.String collectionName) |
void |
resetQueryState()
Reset the data source's query state to what it's
initial state was.
|
void |
resetVisibleQueryState()
Removes only "visible" query filters from all collections.
|
void |
resetVisibleQueryState(CollectionBaseView collection)
Removes only "visible" query filters from a single collection.
|
boolean |
semanticViewExists(java.lang.String viewKey) |
void |
setQueryState(QueryState newState)
Set the state of this data source.
|
void |
updateCollectionData(java.lang.String collectionKey,
java.util.List<Record> recordList)
Update records in a collection
The 'recordSpecifier' in 'Record' objects should have the unique identifier property key/value.
|
com.endeca.endeca_server.sconfig.types.ValidateEntitiesResponse |
validateView(SemanticView sView)
Validates a custom semantic view.
|
public DataSource(javax.portlet.PortletRequest request) throws DataSourceException
DataSourceException
public DataSource(javax.portlet.PortletRequest request, MDEXState mdexState) throws DataSourceException
DataSourceException
public DataSource(javax.portlet.PortletRequest request, java.lang.String[] boundDataSets) throws DataSourceException
DataSourceException
public DataSource(javax.portlet.PortletRequest request, long groupId) throws DataSourceException
DataSourceException
protected UserSession getUserSession() throws UserSessionException
UserSessionException
protected MDEXState getMDEXState()
protected RequestIds getRequestIds()
public java.lang.String getServiceURL()
public boolean isAvailable()
public boolean isOnline()
MDEXState.isOnline()
public QueryState getQueryState() throws DataSourceException
DataSourceException
public void setQueryState(QueryState newState) throws DataSourceException
newState
- The new state to "push"DataSourceException
public QueryState getInitialQueryState() throws DataSourceException
DataSourceException
public void resetQueryState() throws DataSourceException
DataSourceException
public void resetVisibleQueryState() throws DataSourceException
DataSourceException
public void resetVisibleQueryState(CollectionBaseView collection) throws DataSourceException
collection
- the CollectionBaseView from whose query state to remove visible filtersDataSourceException
public QueryResults execute() throws DataSourceException
DataSourceException
public QueryResults execute(QueryState queryState) throws DataSourceException
queryState
- DataSourceException
public void clearMetadataCaches()
public void clearMetadataCaches(boolean refresh) throws DataSourceException
DataSourceException
public void clearViewCache()
DataSource.clearMetadataCaches
instead
of this method so the attribute group cache is cleared in addition to the entity cache.public boolean collectionExists(java.lang.String collectionKey)
public boolean semanticViewExists(java.lang.String viewKey)
public CollectionBaseView getCollection(java.lang.String collectionKey) throws KeyNotFoundException, DataSourceException
CollectionBaseView
that represents a collection base view. The
collection cache is initialized if necessary.collectionKey
- key of the mdex collection soughtKeyNotFoundException
- if the collection with the specified key is not foundDataSourceException
- if there was a query error when getting collection metadatapublic java.util.Collection<CollectionBaseView> getAllCollections() throws DataSourceException
DataSourceException
- if there was a query error when getting collection metadatapublic SemanticView getSemanticView(java.lang.String viewKey) throws KeyNotFoundException, DataSourceException
SemanticView
by the specified viewKey. The cache of view
information is initialized if necessary.request
- TODOviewKey
- key of the mdex view soughtKeyNotFoundException
- if the view with the specified key is not foundDataSourceExcpetion
- if there was a query error when getting view metadataDataSourceException
public java.util.Collection<SemanticView> getAllSemanticViews() throws DataSourceException
DataSourceException
- if there was a query error when getting view metadatapublic java.util.Collection<SemanticView> getAllSemanticViews(boolean includeNonActive) throws DataSourceException
Whether
- to include non-active views or not.DataSourceException
- if there was a query error when getting view metadatapublic SemanticView getCollectionOrSemanticView(java.lang.String viewKey) throws KeyNotFoundException, DataSourceException
SemanticView
, which could be either a collection base view or a custom semantic view.viewKey
- key of the collection or semantic view soughtKeyNotFoundException
- if the view with the specified key is not foundDataSourceExcpetion
- if there was a query error when getting view metadataDataSourceException
public java.util.Collection<SemanticView> getAllCollectionsAndSemanticViews() throws DataSourceException
DataSourceExcpetion
- if there was a query error when getting view metadataDataSourceException
public java.util.Collection<SemanticView> getAllCollectionsAndSemanticViews(boolean includeNonActive) throws DataSourceException
Whether
- to include non-active views or not.DataSourceExcpetion
- if there was a query error when getting view metadataDataSourceException
public com.endeca.mdex.conversation.types.Results execute(com.endeca.mdex.conversation.types.Request query) throws DataSourceException
query
- The query to executeDataSourceException
public com.endeca.mdex.config.services.types.Results executeConfigServiceUpdateOperation(com.endeca.mdex.config.services.types.ConfigTransaction configTransaction) throws DataSourceException
configTransaction
- the ConfigTransaction
to executeDataSourceException
public int deleteView(java.lang.String viewKey) throws KeyNotFoundException, DataSourceException
viewKey
- references the view to deleteKeyNotFoundException
DataSourceException
public void updateCollectionData(java.lang.String collectionKey, java.util.List<Record> recordList) throws KeyNotFoundException, DataSourceException
collectionKey
- recordList
- KeyNotFoundException
DataSourceException
public void addCollectionData(java.lang.String collectionKey, java.util.List<Record> recordList) throws KeyNotFoundException, DataSourceException
collectionKey
- recordList
- KeyNotFoundException
DataSourceException
public int putView(SemanticView sView) throws DataSourceException
sView
- a SemanticView or CollectionBaseView to add or updateDataSourceException
public com.endeca.endeca_server.sconfig.types.ValidateEntitiesResponse validateView(SemanticView sView) throws DataSourceException
sView
- a SemanticView to validateDataSourceException
public void addCollectionName(java.lang.String collectionName, java.lang.String newCollectionName) throws DataSourceException
DataSourceException
public void moveCollectionName(java.lang.String collectionNameToMove, java.lang.String targetCollectionName) throws DataSourceException
DataSourceException
public void removeCollectionName(java.lang.String collectionName) throws DataSourceException
DataSourceException
public com.endeca.mdex.eql_parser.types.ExpressionBase parseLQLExpression(java.lang.String expression) throws DataSourceException, LQLException
DataSourceFilter
and
SelectionFilter
QueryFunctions.
This method internally calls parseLQLFilter(String)
.expression
- String that represents the filtercom.endeca.mdex.eql_parser.types.ParserFault
- if the filter has a syntax or type-checking error a ParserFault will be thrownDataSourceException
- any non-expected exceptionLQLException
public com.endeca.mdex.eql_parser.types.QueryWithAttributeMetadata parseLQLQuery(java.lang.String query, boolean validationEnabled) throws DataSourceException, LQLException
query
- String that represents the queryvalidationEnabled
- boolean to enable/disable query validationcom.endeca.mdex.eql_parser.types.ParserFault
- if the filter has a syntax or type-checking error a ParserFault will be thrownDataSourceException
- any non-expected exceptionLQLException
public java.lang.String convertEQLToString(com.endeca.mdex.eql_parser.types.Query queryAST)
queryAST
- a full EQL Query (list of Statements)public java.lang.String convertEQLToString(com.endeca.mdex.eql_parser.types.Statement eqlStatement)
eqlStatement
- public java.lang.String convertEQLToString(com.endeca.mdex.eql_parser.types.StandaloneFilter filterAST)
filterAST
- a filter expressionpublic java.util.Collection<PredefinedMetric> getPredefinedMetrics(java.lang.String viewKey) throws KeyNotFoundException, DataSourceException
viewKey
- key of a view whose metrics are soughtKeyNotFoundException
- if there is no semantic view matching the provided keyDataSourceException
- if a query error is encountered loading view metadatapublic com.endeca.mdex.conversation.types.Request createDiscoveryServiceQuery(QueryState state) throws DataSourceException
state
- DataSourceException
public java.lang.String determineStateName(QueryFunction f) throws DataSourceException, KeyNotFoundException
QueryFunction
for use when applying the
QueryFunction to the Request.f
- a QueryFunction to potentially associate with a named stateDataSourceException
- if there was a problem retrieving Collections or SemanticViews underpinning this DataSourceKeyNotFoundException
- if the QueryFunction references an unknown view keypublic java.util.List<IncompleteCollectionState> getIncompleteCollections()
public void induceEntityCacheFlush() throws DataSourceException
DataSourceException
public java.util.List<java.lang.String> getTypeAheadTags() throws DataSourceException
DataSourceException
Copyright 2003, 2014, Oracle and/or its affiliates. All rights reserved.