com.endeca.portal.data
Class CollectionManager

java.lang.Object
  extended by com.endeca.portal.data.CollectionManager

public class CollectionManager
extends java.lang.Object

This class provides helper static methods to fetch Collection information from Endeca Server and translate that raw metadata into Studio's CollectionBaseView model objects.


Field Summary
static java.lang.String SYSTEM_DS_BASE_FILTER
           
static java.lang.String SYSTEM_DS_CREATION_DATE
           
static java.lang.String SYSTEM_DS_DATA_SCOPE
           
static java.lang.String SYSTEM_DS_LAST_LOAD_DATE
           
static java.lang.String SYSTEM_DS_PS_WORKFLOW_ID
           
static java.lang.String SYSTEM_DS_RECORD_LIMIT_STATUS
           
static java.lang.String SYSTEM_DS_SOURCE_DETAILS
           
static java.lang.String SYSTEM_LOCALIZED_DESCRIPTION
           
static java.lang.String SYSTEM_LOCALIZED_DISPLAY_NAME
           
static java.lang.String UNKNOWN_LANGUAGE
           
 
Constructor Summary
CollectionManager()
           
 
Method Summary
static void clearCollectionCache(MDEXState state)
          Clears the collection cache, causing subsequent reads to reload the cache from Endeca Server.
protected static void deleteBaseView(MDEXState state, RequestIds requestIds, CollectionBaseView collection, java.util.List<com.endeca.mdex.sconfig._2010.types.FilterRule> filterRules, java.util.Locale locale, java.lang.String outerTransactionId)
          Deleting a collection includes: 1.
static java.util.Collection<CollectionBaseView> findCollectionsContainingAttribute(java.util.Collection<CollectionBaseView> collections, java.lang.String attributeKey)
          Scans multiple collections for an attribute matching a given key.
static java.util.Set<java.lang.String> getAttributeLanguages(java.util.Collection<CollectionBaseView> collections, javax.portlet.PortletRequest request)
          Returns all language codes associated with the provided collections.
protected static java.util.Map<java.lang.String,CollectionBaseView> getOrLoadCollectionCache(MDEXState state, RequestIds requestIds, java.util.Locale locale)
          Retrieves collection cache from MDEXState or (re-)builds this cache if it has been cleared.
static Attribute getUniqueAttribute(CollectionBaseView collection)
          Find out the attribute that is marked unique.
protected static void saveBaseView(MDEXState state, RequestIds requestIds, CollectionBaseView baseView, javax.portlet.PortletRequest request)
          Saves to the Endeca Server modifiable elements of a collection base view, like attribute and group metadata.
static Attribute translateAttributeModel(Attribute in, java.util.Locale locale)
           
static Group translateGroupModel(Group in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_DS_SOURCE_DETAILS

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

SYSTEM_LOCALIZED_DISPLAY_NAME

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

SYSTEM_LOCALIZED_DESCRIPTION

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

SYSTEM_DS_CREATION_DATE

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

SYSTEM_DS_LAST_LOAD_DATE

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

SYSTEM_DS_BASE_FILTER

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

SYSTEM_DS_DATA_SCOPE

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

SYSTEM_DS_RECORD_LIMIT_STATUS

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

SYSTEM_DS_PS_WORKFLOW_ID

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

UNKNOWN_LANGUAGE

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

CollectionManager

public CollectionManager()
Method Detail

getOrLoadCollectionCache

protected static java.util.Map<java.lang.String,CollectionBaseView> getOrLoadCollectionCache(MDEXState state,
                                                                                             RequestIds requestIds,
                                                                                             java.util.Locale locale)
                                                                                      throws DataSourceException
Retrieves collection cache from MDEXState or (re-)builds this cache if it has been cleared. This method should only be used by framework classes. Components should use com.endeca.portal.data.DataSource#getCollection(String) or com.endeca.portal.data.DataSource#getAllCollections() for caching benefits.

Parameters:
state - MDEXState object providing service ports for the backend metadata queries
locale - user Locale to use for localized elements of the collection (e.g. attribute display names)
Returns:
freshly loaded collection cache
Throws:
DataSourceException - if some kind of query error occurred while fetching collection metadata

clearCollectionCache

public static void clearCollectionCache(MDEXState state)
Clears the collection cache, causing subsequent reads to reload the cache from Endeca Server.

Parameters:
state - MDEXState whose cache should be cleared

saveBaseView

protected static void saveBaseView(MDEXState state,
                                   RequestIds requestIds,
                                   CollectionBaseView baseView,
                                   javax.portlet.PortletRequest request)
                            throws DataSourceException
Saves to the Endeca Server modifiable elements of a collection base view, like attribute and group metadata.

Parameters:
state - the MDEXState associated with the Endeca Server to update
requestIds - RequestIds associated with this update
baseView - modified CollectionBaseView to persist to Endeca Server
Throws:
DataSourceException

deleteBaseView

protected static void deleteBaseView(MDEXState state,
                                     RequestIds requestIds,
                                     CollectionBaseView collection,
                                     java.util.List<com.endeca.mdex.sconfig._2010.types.FilterRule> filterRules,
                                     java.util.Locale locale,
                                     java.lang.String outerTransactionId)
                              throws java.lang.UnsupportedOperationException,
                                     DataSourceException
Deleting a collection includes: 1. Deleting all records in the collection 2. Deleting search interfaces in the collection 3. Deleting all PDRs, GDRs and DDRs 4. Deleting attribute groups 5. Deleting all corresponding refinement rules 6. Deleting Enrichment rules 7. Deleting the collection itself(CDR)

Parameters:
state -
requestIds -
viewKey -
locale -
Throws:
DataSourceException
java.lang.UnsupportedOperationException

getUniqueAttribute

public static Attribute getUniqueAttribute(CollectionBaseView collection)
Find out the attribute that is marked unique.

Parameters:
collection - - the collection to search the attribute within
Returns:
the Attribute instance that is marked unique

translateAttributeModel

public static Attribute translateAttributeModel(Attribute in,
                                                java.util.Locale locale)

translateGroupModel

public static Group translateGroupModel(Group in)

findCollectionsContainingAttribute

public static java.util.Collection<CollectionBaseView> findCollectionsContainingAttribute(java.util.Collection<CollectionBaseView> collections,
                                                                                          java.lang.String attributeKey)
Scans multiple collections for an attribute matching a given key.

Parameters:
collections - Collections to scan
attributeKey - key sought
Returns:
the (potentially multiple) CollectionBaseView(s) containing the specified key

getAttributeLanguages

public static java.util.Set<java.lang.String> getAttributeLanguages(java.util.Collection<CollectionBaseView> collections,
                                                                    javax.portlet.PortletRequest request)
Returns all language codes associated with the provided collections.

Parameters:
collections -
request -
Returns: