|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.endeca.portal.attributes.AttributeSettingsManager
public class AttributeSettingsManager
Constructor Summary | |
---|---|
AttributeSettingsManager()
|
Method Summary | |
---|---|
static AttributeSettings |
createEmptyAttributeSettings()
Convenience method that creates a new empty instance of the AttributeSettings model. |
static AttributeSettings |
createEmptyAttributeSettings(int attrSize,
int groupSize)
Convenience method that creates a new empty instance of the AttributeSettings model with predefined collection sizes. |
static AttributeSettings |
deserializeAttributeSettings(java.lang.String attributeSettingsJson)
Deserializes an attribute settings model using Jackson. |
static AttributeSettings |
filter(AttributeSettings attributeSettings,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean removeUngroupedAttributes)
This method allows an AttributeSettings model object to be filtered in accordance with the specified filters. |
static AttributeSettings |
mergeTwoPartials(AttributeSettings base,
AttributeSettings changes,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean allowCleanup,
boolean doUnion)
Merges two attribute settings model structures. |
static AttributeSettings |
mergeTwoPartials(DataSource datasource,
AttributeSettings base,
AttributeSettings changes)
This method merges two attribute sets with each other, and adds filters for the datasource's global groups and attributes. |
static AttributeSettings |
mergeWithGlobal(DataSource datasource,
AttributeSettings changes)
This method merges the submitted changes with the global attribute settings associated with the datasource. |
static AttributeSettings |
mergeWithGlobal(DataSource datasource,
AttributeSettings changes,
BPCFilter groupFilter,
BPCFilter attributeFilter,
boolean doUnion)
Does a join between the global model associated with the datasource, and the given attribute settings object. |
static java.lang.String |
serializeAttributeSettings(AttributeSettings attributeSettings)
Serialize a given AttributeSettings object into a JSON model |
static java.lang.String |
serializeAttributeSettingsPrettyPrint(AttributeSettings attributeSettings)
Same as serializeAttributeSettings(AttributeSettings) except it uses
pretty-print format for output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AttributeSettingsManager()
Method Detail |
---|
public static AttributeSettings deserializeAttributeSettings(java.lang.String attributeSettingsJson) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
attributeSettingsJson
- - a serialized JSON representation of the AttributeSettings model.
org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static java.lang.String serializeAttributeSettings(AttributeSettings attributeSettings) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
attributeSettings
-
org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static java.lang.String serializeAttributeSettingsPrettyPrint(AttributeSettings attributeSettings) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
serializeAttributeSettings(AttributeSettings)
except it uses
pretty-print format for output.
NOTE: Do not use this except for debug/test as it is somewhat slower than serializeAttributeSettings
attributeSettings
-
org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static AttributeSettings mergeWithGlobal(DataSource datasource, AttributeSettings changes) throws DataSourceException
datasource
- changes
-
DataSourceException
public static AttributeSettings mergeWithGlobal(DataSource datasource, AttributeSettings changes, BPCFilter groupFilter, BPCFilter attributeFilter, boolean doUnion) throws DataSourceException
datasource
- - the left hand side of the merge operation is the global attribute settings object associated
with this datasource. 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).
DataSourceException
public static AttributeSettings mergeTwoPartials(DataSource datasource, AttributeSettings base, AttributeSettings changes) throws DataSourceException
AttributeSettingsManager#mergeTwoPartials(AttributeSettings base, AttributeSettings changes, datasource.getGlobalAttributeSettings().getGroupFilter(),
datasource.getGlobalAttributeSettings().getAttributeFilter(), true, true)
base
- changes
-
DataSourceException
public static AttributeSettings mergeTwoPartials(AttributeSettings base, AttributeSettings changes, BPCFilter groupFilter, BPCFilter attributeFilter, boolean allowCleanup, boolean doUnion)
mergeWithGlobal(DataSource, AttributeSettings)
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 AttributeSettings 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 AttributeSettings filter(AttributeSettings attributeSettings, BPCFilter groupFilter, BPCFilter attributeFilter, boolean removeUngroupedAttributes)
attributeSettings
- - the AttributeSettings 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 AttributeSettings createEmptyAttributeSettings()
createEmptyAttributeSettings(int, int)
method instead.
public static AttributeSettings createEmptyAttributeSettings(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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |