public class SemanticViewManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SemanticViewManager.GroupAllFilter
Nested class implementation of a filter that removes group named 'all'
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AGG_ARB |
static java.lang.String |
AGG_COUNT |
static java.lang.String |
AGG_COUNTDISTINCT |
static java.lang.String |
AGG_SET |
static java.lang.String |
AVAIL_DATETIME_PARTS |
static java.lang.String |
AVAILABLE_AGGRAGATIONS_DELIMITER |
static java.lang.String |
DEFAULT_AGG_ORD |
static java.lang.String |
DEFAULT_AVAIL_AGG_BOOL |
static java.lang.String |
DEFAULT_AVAIL_AGG_DATETIME |
static java.lang.String |
DEFAULT_AVAIL_AGG_DURATION |
static java.lang.String |
DEFAULT_AVAIL_AGG_GEO |
static java.lang.String |
DEFAULT_AVAIL_AGG_NUM |
static java.lang.String |
DEFAULT_AVAIL_AGG_SET |
static java.lang.String |
DEFAULT_AVAIL_AGG_STRING |
static java.lang.String |
DEFAULT_AVAIL_AGG_TIME |
static java.lang.String |
DEFAULT_AVAIL_DATETIME_PARTS |
static java.lang.String |
DEFAULT_DATETIME_COMBOS |
static java.lang.String |
EID_PROPERTY_PREFIX |
static java.lang.String |
INCL_DETAILS_PROPERTY_DEFAULT_VALUE |
static java.lang.String |
INCL_NAV_PROPERTY_DEFAULT_VALUE |
static java.lang.String |
MDEX_TYPE_SET_SUFFIX |
static java.lang.String |
SYSTEM_AVAILABLE_AGGREGATIONS |
static java.lang.String |
SYSTEM_DATETIME_COMBOS_ENABLED_PROPERTY |
static java.lang.String |
SYSTEM_DEFAULT_AGGREGATION |
static java.lang.String |
SYSTEM_DESCRIPTION |
static java.lang.String |
SYSTEM_FORMAT_SETTINGS |
static java.lang.String |
SYSTEM_IS_DIMENSION |
static java.lang.String |
SYSTEM_IS_SINGLE_ASSIGN |
static java.lang.String |
SYSTEM_LOCALIZED_ATTRIBUTE_METADATA |
static java.lang.String |
SYSTEM_LOCALIZED_DESC_SETTINGS |
static java.lang.String |
SYSTEM_LOCALIZED_DN_SETTINGS |
Constructor and Description |
---|
SemanticViewManager() |
Modifier and Type | Method and Description |
---|---|
protected static java.util.Collection<SemanticView> |
buildSemanticViews(javax.portlet.PortletRequest request,
MDEXState state,
RequestIds requestIds) |
static SemanticView |
createEmptySemanticView(java.lang.String key)
Convenience method that creates a new empty instance of the SemanticView model.
|
static SemanticView |
createEmptySemanticView(java.lang.String key,
int attrSize,
int groupSize)
Convenience method that creates a new empty instance of the SemanticView model with predefined collection sizes.
|
protected static com.endeca.endeca_server.sconfig.types.DeleteEntitiesResponse |
deleteView(javax.portlet.PortletRequest request,
SemanticView sView,
MDEXState state,
RequestIds requestIds)
Deletes one or more views from the Endeca Server.
|
static SemanticView |
deserializeSemanticView(java.lang.String semanticViewJson)
Deserializes an attribute settings model using Jackson.
|
static SemanticView |
filter(SemanticView semanticView,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean removeUngroupedAttributes)
This method allows an SemanticView model object to be filtered in accordance with the specified filters.
|
protected static Attribute |
genAttributeInstance(SemanticView semanticView,
com.endeca.endeca_server.sconfig.types.Attribute semanticAttr,
java.util.Map<java.lang.String,Attribute> sourceAttributes,
java.util.Map<java.lang.String,com.endeca.mdex.config.xquery._2009._09.AttributeDescription> schemaAttrs,
java.util.Locale locale) |
protected static Group |
genGroupInstance(com.endeca.endeca_server.sconfig.types.Group semanticGroup,
SemanticView semanticView,
java.util.Locale locale) |
static java.lang.String |
getDefaultAggregation(java.lang.String availableAggregations) |
static java.lang.String |
getDefaultAvailAggregation(java.lang.String datatype,
boolean isSingleAssign)
Get default enabled available aggregation methods by datatype.
|
static java.lang.String |
getLocalized(java.util.Locale locale,
java.lang.String localizedStr,
java.lang.String defaultStr)
Get localized string.
|
static java.lang.String |
getLocalizedDescription(com.endeca.endeca_server.sconfig.types.Attribute attribute,
java.util.Locale locale)
Get localized description from semantic attribute
|
static java.lang.String |
getLocalizedDisplayName(com.endeca.endeca_server.sconfig.types.Attribute attribute,
java.util.Locale locale)
Get localized display name from semantic attribute
|
protected static ViewCache<SemanticView> |
getOrLoadViewCache(javax.portlet.PortletRequest request,
MDEXState state,
RequestIds requestIds)
Retrieves view cache from
MDEXState or (re-)builds this cache if it has been cleared. |
protected static void |
invalidateViewCache(MDEXState state)
Marks a specific application's view cache as invalid, causing subsequent reads to reload the cache from Endeca Server.
|
protected static <T extends BasePropertyContainer> |
mergeBasePropertyContainer(T baseBpc,
T changedBpc,
boolean allowCleanup) |
protected static <T extends BasePropertyContainer> |
mergeBasePropertyContainers(java.util.HashMap<java.lang.String,T> base,
java.util.HashMap<java.lang.String,T> changes,
boolean allowCleanup,
boolean doUnion)
Generic helper method that contains the bulk of the logic for merging two BPC containers.
|
static SemanticView |
mergeTwoPartials(DataSource datasource,
java.lang.String semanticKey,
SemanticView base,
SemanticView changes)
This method merges two attribute sets with each other, and adds filters for the datasource's global groups and attributes.
|
static SemanticView |
mergeTwoPartials(SemanticView base,
SemanticView changes,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean allowCleanup,
boolean doUnion)
Merges two attribute settings model structures.
|
static SemanticView |
mergeWithGlobal(DataSource datasource,
java.lang.String semanticKey,
SemanticView changes)
This method merges the submitted changes with the global attribute settings associated with the datasource.
|
static SemanticView |
mergeWithGlobal(DataSource datasource,
java.lang.String semanticKey,
SemanticView changes,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean doUnion)
Does a join between the global model associated with the datasource, and the given attribute settings object.
|
protected static com.endeca.endeca_server.sconfig.types.PutEntitiesResponse |
putView(javax.portlet.PortletRequest request,
SemanticView sView,
MDEXState state,
RequestIds requestIds)
Adds or replaces an entity definitions in the Endeca Server.
|
protected static com.endeca.endeca_server.sconfig.types.PutEntitiesResponse |
putView(javax.portlet.PortletRequest request,
SemanticView sView,
MDEXState state,
RequestIds requestIds,
long groupId) |
static java.lang.String |
serializeSemanticView(SemanticView semanticView)
Serialize a given SemanticView object into a JSON model
|
protected static com.endeca.endeca_server.sconfig.types.SemanticEntity |
serializeSemanticView(SemanticView sView,
java.util.Locale locale) |
static void |
sortAttributesByDisplayNameAsc(java.util.Map<java.lang.String,Attribute> attributes,
java.util.List<java.lang.String> attrKeys,
java.util.Locale locale)
Sort attribute keys by display name asc
|
protected static com.endeca.endeca_server.sconfig.types.ValidateEntitiesResponse |
validateView(javax.portlet.PortletRequest request,
SemanticView sView,
MDEXState state,
RequestIds requestIds) |
public static final java.lang.String EID_PROPERTY_PREFIX
public static final java.lang.String SYSTEM_DATETIME_COMBOS_ENABLED_PROPERTY
public static final java.lang.String SYSTEM_AVAILABLE_AGGREGATIONS
public static final java.lang.String SYSTEM_DEFAULT_AGGREGATION
public static final java.lang.String SYSTEM_DESCRIPTION
public static final java.lang.String SYSTEM_LOCALIZED_DN_SETTINGS
public static final java.lang.String SYSTEM_LOCALIZED_DESC_SETTINGS
public static final java.lang.String SYSTEM_FORMAT_SETTINGS
public static final java.lang.String SYSTEM_IS_DIMENSION
public static final java.lang.String SYSTEM_LOCALIZED_ATTRIBUTE_METADATA
public static final java.lang.String SYSTEM_IS_SINGLE_ASSIGN
public static final java.lang.String AVAILABLE_AGGRAGATIONS_DELIMITER
public static final java.lang.String DEFAULT_AGG_ORD
public static final java.lang.String DEFAULT_AVAIL_AGG_NUM
public static final java.lang.String DEFAULT_AVAIL_AGG_STRING
public static final java.lang.String DEFAULT_AVAIL_AGG_DATETIME
public static final java.lang.String DEFAULT_AVAIL_AGG_TIME
public static final java.lang.String DEFAULT_AVAIL_AGG_DURATION
public static final java.lang.String DEFAULT_AVAIL_AGG_GEO
public static final java.lang.String DEFAULT_AVAIL_AGG_SET
public static final java.lang.String DEFAULT_AVAIL_AGG_BOOL
public static final java.lang.String AGG_ARB
public static final java.lang.String AGG_SET
public static final java.lang.String AGG_COUNT
public static final java.lang.String AGG_COUNTDISTINCT
public static final java.lang.String AVAIL_DATETIME_PARTS
public static final java.lang.String DEFAULT_AVAIL_DATETIME_PARTS
public static final java.lang.String DEFAULT_DATETIME_COMBOS
public static final java.lang.String INCL_NAV_PROPERTY_DEFAULT_VALUE
public static final java.lang.String INCL_DETAILS_PROPERTY_DEFAULT_VALUE
public static final java.lang.String MDEX_TYPE_SET_SUFFIX
public static SemanticView deserializeSemanticView(java.lang.String semanticViewJson) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
semanticViewJson
- - a serialized JSON representation of the SemanticView model.org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static java.lang.String serializeSemanticView(SemanticView semanticView) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
semanticView
- org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static SemanticView mergeWithGlobal(DataSource datasource, java.lang.String semanticKey, SemanticView changes) throws DataSourceException, KeyNotFoundException
datasource
- semanticKey
- changes
- DataSourceException
KeyNotFoundException
public static SemanticView mergeWithGlobal(DataSource datasource, java.lang.String semanticKey, SemanticView changes, BPCFilter groupFilter, BPCFilter attributeFilter, boolean doUnion) throws DataSourceException, KeyNotFoundException
datasource
- - the left hand side of the merge operation is the global attribute settings object associated with this datasource.
Required.semanticKey
- - the semantic view key. Required.changes
- - the right hand side of the merge operation. This should be an instance of an attribute settings model that contains changes
that should be applied to the global attribute settings. Required.groupFilter
- - optional BPC Filter object that is used to filter the groups in the final result of the merge operation before it is
returned. If this parameter is set to null, no filtering occurs. Otherwise, only the groups that pass the filter test will be
included in the results. This filter will also be applied to the groupOrder list. However, this filter will NOT prevent
ungrouped attributes from appearing in the result.attributeFilter
- - a BPC Filter object that is used to filter the attributes portion of the merge operation before it is returned. If this
parameter is set to null, no filtering occurs. Otherwise, only the attributes that pass the filter test will be included in
the results.doUnion
- - when true, this merge will be a union of the two maps with some special handling surrounding null values. If this parameter
is false, this merge will be a left join, with global attributes on the left side of the join (objects only appearing on the
right hand side will not be included in the results).locale
- - Localized group/attribute/metric display name and view display name, descriptionDataSourceException
KeyNotFoundException
public static SemanticView mergeTwoPartials(DataSource datasource, java.lang.String semanticKey, SemanticView base, SemanticView changes) throws DataSourceException, KeyNotFoundException
SemanticViewManager#mergeTwoPartials(SemanticView base, SemanticView changes, datasource.getGlobalAttributeSettings().getGroupFilter(),
datasource.getGlobalAttributeSettings().getAttributeFilter(), true, true)
base
- changes
- DataSourceException
KeyNotFoundException
public static SemanticView mergeTwoPartials(SemanticView base, SemanticView changes, BPCFilter groupFilter, BPCFilter attributeFilter, boolean allowCleanup, boolean doUnion)
SemanticViewManager#mergeWithGlobal(DataSource, SemanticView)
is
recommended.
This method also takes additional parameters that define whether or not empty value cleanup is allowed, whether to do a union style
merge or a left join, and whether the Attribute Groups should be filtered.base
- - the Left-Hand Side of the merge operation. This should be an instance of an attribute settings model, to which the changes
should be applied. Required.changes
- - the Right-Hand Side of the merge operation. This should be an instance of an attribute settings model that contains changes
that should be applied to the "base". Required.groupFilter
- - a BPC Filter object that is used to filter the final result of the merge operation before it is returned. This parameter
provides a filtering mechanism that allows the resulting SemanticView model to only contain information limited to the
specified groups. If this parameter is set to null, no filtering occurs. Otherwise, only the groups that pass the filter test
will be included in the results. This filter will also be applied to the groupOrder list. However, this filter will NOT
prevent ungrouped attributes from appearing in the result.attributeFilter
- - a BPC Filter object that is used to filter the attributes portion of the merge operation before it is returned. If this
parameter is set to null, no filtering occurs. Otherwise, only the attributes that pass the filter test will be included in
the results.allowCleanup
- - when true allows individual properties or whole attributes/groups to be removed from the result of the merge. Generally,
this should be set to true when merging to partial models and false when merging a global model with the partial diff. The
removal works as follows. If a property is specified in the changes but its value is set to null, that property is removed
from the merged attribute/group. If an attribute/group key is specified in the "changes" but the corresponding value is set
to null, that attribute/group is excluded from the model. If after all properties for a given attribute/group have been
merged that attribute/group ends up being empty (as defined by the isEmpty() method), that attribute/group is excluded from
the merged model.doUnion
- - when true, this merge will be a union of the two maps with some special handling surrounding null values. If this parameter
is false, this merge will be a left join on the base map. In general, this value should be set to false when doing global
merges, and true when doing partial diff merges.public static SemanticView filter(SemanticView semanticView, BPCFilter groupFilter, BPCFilter attributeFilter, boolean removeUngroupedAttributes)
semanticView
- - the SemanticView model to be filteredgroupFilter
- - a filter to be applied to the groups collection and the groupOrder list. Only the groups that pass the filter test will be
included. This filter can also be applied to attributes indirectly depending on the value of the removeUngroupedProperties
flagattributeFilter
- - a filter to be applied to the attributes collection. Only the attributes that pass the filter test will be included. This
filter can also be indirectly combined with the groupFilter depending on the value of the removeUngroupedProperties flag.
Additionally, if this filter is specified, the Groups will be checked to make sure that they only reference valid attributes.
This will always be done to preserve referential integrity of the model.removeUngroupedAttributes
- - this is a rather confusing setting that controls whether or not the attributes not contained in the groups that remain
after filtering should also be removed from the model. In other words, when this parameter is set to true, an additional
ExclusiveSetFilter
will be created to represent only the attributes contained by the remaining groups. This new
filter will be and-chained with the attributeFilter if necessary.public static SemanticView createEmptySemanticView(java.lang.String key)
#createEmptyAttributeSettings(int, int)
method instead.public static SemanticView createEmptySemanticView(java.lang.String key, int attrSize, int groupSize)
attrSize
- - expected size of the attributes collection. This is used to calculate the initial capacity of the HashMap that contains
attributes.groupSize
- - expected size of the groups collection. This is used to calculate the initial capacity of the HashMap that contains groups.protected static <T extends BasePropertyContainer> java.util.HashMap<java.lang.String,T> mergeBasePropertyContainers(java.util.HashMap<java.lang.String,T> base, java.util.HashMap<java.lang.String,T> changes, boolean allowCleanup, boolean doUnion)
T
- - a model object that extends BasePropertyContainerbase
- - the base collection of BPC objects. This is the left hand side of the merge.changes
- - the collection containing the changes to be merged. This is the right hand side of the merge.allowCleanup
- - enables cleanup mode as described in
SemanticViewManager#mergeAttributeSettings(SemanticView, SemanticView, Set, boolean)
doUnion
- - toggles between a left join and a doUnion join as described in
SemanticViewManager#mergeAttributeSettings(SemanticView, SemanticView, Set, boolean)
protected static <T extends BasePropertyContainer> T mergeBasePropertyContainer(T baseBpc, T changedBpc, boolean allowCleanup)
T
- baseBpc
- changedBpc
- allowCleanup
- protected static Attribute genAttributeInstance(SemanticView semanticView, com.endeca.endeca_server.sconfig.types.Attribute semanticAttr, java.util.Map<java.lang.String,Attribute> sourceAttributes, java.util.Map<java.lang.String,com.endeca.mdex.config.xquery._2009._09.AttributeDescription> schemaAttrs, java.util.Locale locale)
public static java.lang.String getDefaultAvailAggregation(java.lang.String datatype, boolean isSingleAssign)
datatype
- public static java.lang.String getDefaultAggregation(java.lang.String availableAggregations)
protected static Group genGroupInstance(com.endeca.endeca_server.sconfig.types.Group semanticGroup, SemanticView semanticView, java.util.Locale locale)
public static java.lang.String getLocalized(java.util.Locale locale, java.lang.String localizedStr, java.lang.String defaultStr)
locale
- locale objectlocalizedStr
- A string contains localized information, the syntax is '{"zh_CN":"Test"}'defaultStr
- The default stringpublic static java.lang.String getLocalizedDisplayName(com.endeca.endeca_server.sconfig.types.Attribute attribute, java.util.Locale locale)
attribute
- locale
- public static java.lang.String getLocalizedDescription(com.endeca.endeca_server.sconfig.types.Attribute attribute, java.util.Locale locale)
attribute
- locale
- protected static ViewCache<SemanticView> getOrLoadViewCache(javax.portlet.PortletRequest request, MDEXState state, RequestIds requestIds) throws DataSourceException
MDEXState
or (re-)builds this cache if it has been cleared. This method should only be used by
framework classes. Components should use )
or
com.endeca.portal.data.DataSource#getAllSemanticViews(Locale))
for caching benefits.request
- state
- MDEXState object providing service ports for the backend metadata queriesrequestIds
- RequestIds object used to correlate requests in Timer logginglocale
- Locale to use when generating viewsDataSourceException
- if some kind of query error occurred while fetching view metadataprotected static java.util.Collection<SemanticView> buildSemanticViews(javax.portlet.PortletRequest request, MDEXState state, RequestIds requestIds) throws DataSourceException
DataSourceException
protected static com.endeca.endeca_server.sconfig.types.PutEntitiesResponse putView(javax.portlet.PortletRequest request, SemanticView sView, MDEXState state, RequestIds requestIds) throws DataSourceException
request
- state
- requestIds
- se
- the semantic entities to add or replacelanguageId
- DataSourceException
protected static com.endeca.endeca_server.sconfig.types.PutEntitiesResponse putView(javax.portlet.PortletRequest request, SemanticView sView, MDEXState state, RequestIds requestIds, long groupId) throws DataSourceException
DataSourceException
protected static com.endeca.endeca_server.sconfig.types.DeleteEntitiesResponse deleteView(javax.portlet.PortletRequest request, SemanticView sView, MDEXState state, RequestIds requestIds) throws DataSourceException
request
- sView
- the view to delete; must be a semantic view, not a collectionstate
- requestIds
- languageId
- DataSourceException
protected static com.endeca.endeca_server.sconfig.types.ValidateEntitiesResponse validateView(javax.portlet.PortletRequest request, SemanticView sView, MDEXState state, RequestIds requestIds) throws DataSourceException
DataSourceException
protected static void invalidateViewCache(MDEXState state)
state
- MDEXState
whose cache should be clearedprotected static com.endeca.endeca_server.sconfig.types.SemanticEntity serializeSemanticView(SemanticView sView, java.util.Locale locale)
public static void sortAttributesByDisplayNameAsc(java.util.Map<java.lang.String,Attribute> attributes, java.util.List<java.lang.String> attrKeys, java.util.Locale locale)
attributes
- attrKeys
- locale
- Copyright 2003, 2014, Oracle and/or its affiliates. All rights reserved.