com.endeca.portal.data
Class SemanticView

java.lang.Object
  extended by com.endeca.portal.data.SemanticView
All Implemented Interfaces:
AttributeKeyConverter
Direct Known Subclasses:
CollectionBaseView

public class SemanticView
extends java.lang.Object
implements AttributeKeyConverter

This class represents the top-level container for the Unified Attribute Model (UAM). It contains attribute and group hash map collections, as well as an ordered list representing the order of groups. Instances of this class can be converted to JSON using Jackson.

Author:
Endeca Technologies,, Inc TODO: make setters and constructors protected

Field Summary
static java.lang.String PERMANENT_GROUP_ALL_DN
           
static java.lang.String PERMANENT_GROUP_ALL_KEY
           
static java.lang.String PERMANENT_GROUP_OTHER_DN
           
static java.lang.String PERMANENT_GROUP_OTHER_KEY
           
 
Constructor Summary
SemanticView()
          Still required for JSON deserialization by components that store SemanticViews as a delta from application-wide defaults.
SemanticView(java.lang.String viewKey)
          Create a new SemanticView.
 
Method Summary
 void addAllSourceCollections(java.util.Collection<CollectionBaseView> sources)
          Adds all source collections at once.
 void addDependentSource(java.lang.String source)
           
 SemanticView copyBPCs()
          This method creates a shallow copy of SemanticView by cloning it's containers (attributes, predefinedMetrics, metadata, groups and GroupOrder).
 void generateDefaultAttributeKeyMap()
          Function to generate mappings from attribute key to default locale attribute key
 java.util.HashMap<java.lang.String,Attribute> getAllAttributes()
          This call returns the master list of all attributes including all attributes use for localization.
 Group getAllGroup()
          Get all group, create the all group dynamically
 BPCFilter getAttributeFilter()
          An AttributeSettings instance can contain pre-constructed BPC filters for attributes and groups.
 java.util.HashMap<java.lang.String,Attribute> getAttributes()
          This returns the reduced attributes for default locale only
 java.lang.String getDefaultKey(java.lang.String attributeKey)
          Function to get the default locale attribute key for the given attribute key.
 java.util.HashMap<java.lang.String,Attribute> getDefaultLocaleAttributes()
           
 java.util.Set<java.lang.String> getDependentSources()
           
 BPCFilter getGroupFilter()
          An AttributeSettings instance can contain pre-constructed BPC filters for attributes and groups.
 java.util.List<java.lang.String> getGroupOrder()
           
 java.util.HashMap<java.lang.String,Group> getGroups()
           
 java.lang.String getKey()
           
 java.util.Locale getLocaleString(java.lang.String attributeKey, java.util.Locale locale)
           
 java.lang.String getLocalizedKey(java.lang.String attributeKey, java.util.Locale locale)
          Function to get the locale specific attribute key for the given attribute key and locale.
 ViewMetadata getMetadata()
           
 java.util.List<java.lang.String> getOtherAttrKeys()
           
 Group getOtherGroup()
          Get other group, create the other group dynamically
 com.endeca.mdex.eql_parser.types.Query getParsedDefinition()
           
 java.util.LinkedHashMap<java.lang.String,PredefinedMetric> getPredefinedMetrics()
           
 Group getRealOtherGroup()
           
protected  com.endeca.mdex.sconfig._2010.types.SemanticEntity getSemanticEntity()
           
 java.util.Set<CollectionBaseView> getSourceCollections()
           
 boolean hasLocalizedAttributes()
           
 boolean isActive()
           
 boolean isValid()
           
 void reduceAttributes()
          All in one method for trickling down locale specific attributes to just default attributes.
 void setActive(boolean isActive)
           
 void setAllAttributes(java.util.HashMap<java.lang.String,Attribute> attributes)
           
 void setAllGroup(Group allGroup)
           
 void setAttributeFilter(BPCFilter attributeFilter)
           
 void setAttributes(java.util.HashMap<java.lang.String,Attribute> attributes)
           
 void setGroupFilter(BPCFilter groupFilter)
           
 void setGroupOrder(java.util.List<java.lang.String> groupOrder)
           
 void setGroups(java.util.HashMap<java.lang.String,Group> groups)
           
protected  void setKey(java.lang.String viewKey)
           
 void setMetadata(ViewMetadata metadata)
           
 void setOtherGroup(Group otherGroup)
           
 void setParsedDefinition(com.endeca.mdex.eql_parser.types.Query parsedDefinition)
           
 void setPredefinedMetrics(java.util.LinkedHashMap<java.lang.String,PredefinedMetric> predefinedMetrics)
           
protected  void setSemanticEntity(com.endeca.mdex.sconfig._2010.types.SemanticEntity se)
           
 void setValid(boolean isValid)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERMANENT_GROUP_ALL_KEY

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

PERMANENT_GROUP_ALL_DN

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

PERMANENT_GROUP_OTHER_KEY

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

PERMANENT_GROUP_OTHER_DN

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

SemanticView

public SemanticView()
Still required for JSON deserialization by components that store SemanticViews as a delta from application-wide defaults.


SemanticView

public SemanticView(java.lang.String viewKey)
Create a new SemanticView.

Parameters:
viewKey -
Method Detail

setKey

protected void setKey(java.lang.String viewKey)

getKey

public java.lang.String getKey()

setSemanticEntity

protected void setSemanticEntity(com.endeca.mdex.sconfig._2010.types.SemanticEntity se)

getSemanticEntity

protected com.endeca.mdex.sconfig._2010.types.SemanticEntity getSemanticEntity()

setAttributes

public void setAttributes(java.util.HashMap<java.lang.String,Attribute> attributes)
Parameters:
attributes - the attributes to set

setAllAttributes

public void setAllAttributes(java.util.HashMap<java.lang.String,Attribute> attributes)
Parameters:
attributes - the attributes to set

getAttributes

public java.util.HashMap<java.lang.String,Attribute> getAttributes()
This returns the reduced attributes for default locale only

Returns:
the attributes

getAllAttributes

public java.util.HashMap<java.lang.String,Attribute> getAllAttributes()
This call returns the master list of all attributes including all attributes use for localization. All changes to the view should be done with this list followed by a call to reduceAttributes

Returns:
the attributes

setGroups

public void setGroups(java.util.HashMap<java.lang.String,Group> groups)
Parameters:
groups - the groups to set

getGroups

public java.util.HashMap<java.lang.String,Group> getGroups()
Returns:
the groups

setGroupOrder

public void setGroupOrder(java.util.List<java.lang.String> groupOrder)
Parameters:
groupOrder - the groupOrder to set

getGroupOrder

public java.util.List<java.lang.String> getGroupOrder()
Returns:
the groupOrder

isActive

public boolean isActive()

setActive

public void setActive(boolean isActive)

isValid

public boolean isValid()

setValid

public void setValid(boolean isValid)

setAttributeFilter

public void setAttributeFilter(BPCFilter attributeFilter)
Parameters:
attributeFilter - the attributeFilter to set

getAttributeFilter

public BPCFilter getAttributeFilter()
An AttributeSettings instance can contain pre-constructed BPC filters for attributes and groups. These filter objects can be used as a convenience mechanism for storing a filter constructed based on the information contained in the global settings. These filter objects will be cached along with this AttributeSettings instance and can be reused by various portlets during merging.

Returns:
the attribute filter or null if it has not been set

setGroupFilter

public void setGroupFilter(BPCFilter groupFilter)
Parameters:
groupFilter - the groupFilter to set

getGroupFilter

public BPCFilter getGroupFilter()
An AttributeSettings instance can contain pre-constructed BPC filters for attributes and groups. These filter objects can be used as a convenience mechanism for storing a filter constructed based on the information contained in the global settings. These filter objects will be cached along with this AttributeSettings instance and can be reused by various portlets during merging.

Returns:
the group filter or null if it has not been set

getPredefinedMetrics

public java.util.LinkedHashMap<java.lang.String,PredefinedMetric> getPredefinedMetrics()

setPredefinedMetrics

public void setPredefinedMetrics(java.util.LinkedHashMap<java.lang.String,PredefinedMetric> predefinedMetrics)

getMetadata

public ViewMetadata getMetadata()

setMetadata

public void setMetadata(ViewMetadata metadata)

getParsedDefinition

public com.endeca.mdex.eql_parser.types.Query getParsedDefinition()

setParsedDefinition

public void setParsedDefinition(com.endeca.mdex.eql_parser.types.Query parsedDefinition)

setAllGroup

public void setAllGroup(Group allGroup)
Parameters:
allGroup -

getAllGroup

public Group getAllGroup()
Get all group, create the all group dynamically

Returns:

setOtherGroup

public void setOtherGroup(Group otherGroup)

getOtherGroup

public Group getOtherGroup()
Get other group, create the other group dynamically

Returns:

addAllSourceCollections

public void addAllSourceCollections(java.util.Collection<CollectionBaseView> sources)
Adds all source collections at once.

Parameters:
sourceCollections - a Collection of CollectionBaseViews
Throws:
java.lang.IllegalArgumentException - if specified Collection is null

getSourceCollections

public java.util.Set<CollectionBaseView> getSourceCollections()

addDependentSource

public void addDependentSource(java.lang.String source)

getDependentSources

public java.util.Set<java.lang.String> getDependentSources()

getOtherAttrKeys

public java.util.List<java.lang.String> getOtherAttrKeys()

getRealOtherGroup

public Group getRealOtherGroup()

copyBPCs

public SemanticView copyBPCs()
This method creates a shallow copy of SemanticView by cloning it's containers (attributes, predefinedMetrics, metadata, groups and GroupOrder). The members of these containers are added by reference, so any change to these will be changed in both the new copy and the existing version. However, this method will allow you to add/delete members of these containers without effecting the original version.

Returns:
SemanticView

getLocalizedKey

public java.lang.String getLocalizedKey(java.lang.String attributeKey,
                                        java.util.Locale locale)
Description copied from interface: AttributeKeyConverter
Function to get the locale specific attribute key for the given attribute key and locale. If there is no separate locale specific attribute key, it returns the original attribute key

Specified by:
getLocalizedKey in interface AttributeKeyConverter
Returns:

getDefaultKey

public java.lang.String getDefaultKey(java.lang.String attributeKey)
Description copied from interface: AttributeKeyConverter
Function to get the default locale attribute key for the given attribute key. If there is no separate default locale attribute key, it returns the original attribute key

Specified by:
getDefaultKey in interface AttributeKeyConverter
Returns:

getLocaleString

public java.util.Locale getLocaleString(java.lang.String attributeKey,
                                        java.util.Locale locale)

getDefaultLocaleAttributes

public java.util.HashMap<java.lang.String,Attribute> getDefaultLocaleAttributes()

generateDefaultAttributeKeyMap

public void generateDefaultAttributeKeyMap()
Function to generate mappings from attribute key to default locale attribute key


hasLocalizedAttributes

public boolean hasLocalizedAttributes()

reduceAttributes

public void reduceAttributes()
All in one method for trickling down locale specific attributes to just default attributes. This should be called after adding new attributes to the view individually. If the entire set of attributes is pushed using setAllAttributes, then this is called for you.