org.kuali.rice.kns.datadictionary.view
Class ViewDictionaryIndex

java.lang.Object
  extended by org.kuali.rice.kns.datadictionary.view.ViewDictionaryIndex
All Implemented Interfaces:
Runnable

public class ViewDictionaryIndex
extends Object
implements Runnable

Indexes View bean entries for retrieval

Builds up a Map index where the key is the view id, and the value is the bean name. This is used to retrieve a View instance by its unique id. Furthermore, view of certain types (that have a ViewTypeService are indexed by their type to support retrieval of views based on parameters.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
ViewDictionaryIndex(org.springframework.beans.factory.support.DefaultListableBeanFactory ddBeans)
           
 
Method Summary
protected  String buildTypeIndex(Map<String,String> typeParameters)
          Builds up an index string from the given Map of parameters
protected  void buildViewIndicies()
          Initializes the view index Map then iterates through all the beans in the factory that implement View, adding them to the index
protected  ViewTypeDictionaryIndex getTypeIndex(String viewType)
          Retrieves the ViewTypeDictionaryIndex instance for the given view type name.
 View getViewById(String viewId)
          Retrieves the View instance with the given id from the bean factory.
 View getViewByTypeIndex(String viewTypeName, Map<String,String> indexKey)
          Retrieves a View instance that is of the given type based on the index key
 List<View> getViewsForType(String viewTypeName)
          Gets all View prototypes configured for the given view type name
protected  void indexViewForType(View view, String beanName)
          Performs additional indexing based on the view type associated with the view instance.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewDictionaryIndex

public ViewDictionaryIndex(org.springframework.beans.factory.support.DefaultListableBeanFactory ddBeans)
Method Detail

run

public void run()
Specified by:
run in interface Runnable

getViewById

public View getViewById(String viewId)
Retrieves the View instance with the given id from the bean factory. Since View instances are stateful, we need to get a new instance from Spring each time.

Parameters:
viewId - - the unique id for the view
Returns:
View instance

getViewByTypeIndex

public View getViewByTypeIndex(String viewTypeName,
                               Map<String,String> indexKey)
Retrieves a View instance that is of the given type based on the index key

Parameters:
viewTypeName - - type name for the view
indexKey - - Map of index key parameters, these are the parameters the indexer used to index the view initially and needs to identify an unique view instance
Returns:
View instance that matches the given index or Null if one is not found

getViewsForType

public List<View> getViewsForType(String viewTypeName)
Gets all View prototypes configured for the given view type name

Parameters:
viewTypeName - - view type name to retrieve
Returns:
List view prototypes with the given type name, or empty list

buildViewIndicies

protected void buildViewIndicies()
Initializes the view index Map then iterates through all the beans in the factory that implement View, adding them to the index


indexViewForType

protected void indexViewForType(View view,
                                String beanName)
Performs additional indexing based on the view type associated with the view instance. The ViewTypeService associated with the view type name on the instance is invoked to retrieve the parameter key/value pairs from the view instance, which are then used to build up an index which will key the entry

Parameters:
view - - view instance to index
beanName - - name of the view's bean in Spring

getTypeIndex

protected ViewTypeDictionaryIndex getTypeIndex(String viewType)
Retrieves the ViewTypeDictionaryIndex instance for the given view type name. If one does not exist yet for the given name, a new instance is created

Parameters:
viewType - - name of the view type to retrieve index for
Returns:
ViewTypeDictionaryIndex instance

buildTypeIndex

protected String buildTypeIndex(Map<String,String> typeParameters)
Builds up an index string from the given Map of parameters

Parameters:
typeParameters - - Map of parameters to use for index
Returns:
String index


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.