org.kuali.rice.krad.datadictionary
Class DataDictionary

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.DataDictionary
Direct Known Subclasses:
ReloadingDataDictionary

public class DataDictionary
extends Object

Encapsulates a bean factory and indexes to the beans within the factory for providing framework metadata

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

Field Summary
protected  ArrayList<String> beanValidationFiles
           
protected  KualiDefaultListableBeanFactory ddBeans
           
protected  DataDictionaryIndex ddIndex
           
protected  DataDictionaryMapper ddMapper
           
protected  Map<String,List<String>> moduleDictionaryFiles
           
protected  List<String> moduleLoadOrder
           
static PersistenceStructureService persistenceStructureService
           
protected  UifDictionaryIndex uifIndex
           
protected static boolean validateEBOs
           
protected  org.springframework.beans.factory.xml.XmlBeanDefinitionReader xmlReader
           
 
Constructor Summary
DataDictionary()
           
 
Method Summary
 void addConfigFileLocation(String namespaceCode, String location)
          Adds a location of files or a individual resource to the data dictionary
protected  void addModuleDictionaryFile(String namespaceCode, String location)
          Adds a file location to the list of dictionary files for the given namespace code
static PropertyDescriptor buildReadDescriptor(Class propertyClass, String propertyName)
           
static PropertyDescriptor buildSimpleReadDescriptor(Class propertyClass, String propertyName)
           
 boolean containsDictionaryObject(String id)
          Indicates whether the data dictionary contains a bean with the given id
 Set<InactivationBlockingMetadata> getAllInactivationBlockingMetadatas(Class blockedClass)
           
static Class getAttributeClass(Class boClass, String attributeName)
          This method determines the Class of the attributeName passed in.
 List<String> getBeanNamesForNamespace(String namespaceCode)
          Retrieves the list of dictionary bean names that are associated with the given namespace code
 List<String> getBusinessObjectClassNames()
           
 Map<String,BusinessObjectEntry> getBusinessObjectEntries()
           
 BusinessObjectEntry getBusinessObjectEntry(String className)
          Deprecated. 
 BusinessObjectEntry getBusinessObjectEntryForConcreteClass(String className)
          This method gets the business object entry for a concrete class
static Class getCollectionElementClass(Class boClass, String collectionName)
          This method determines the Class of the elements in the collectionName passed in.
 DataObjectEntry getDataObjectEntry(String className)
           
 Object getDictionaryObject(String beanName)
          Returns an object from the dictionary by its spring bean name
 DataDictionaryEntry getDictionaryObjectEntry(String className)
           
 Map<String,DocumentEntry> getDocumentEntries()
           
 DocumentEntry getDocumentEntry(String documentTypeDDKey)
          Returns the KNS document entry for the given lookup key.
protected  org.springframework.core.io.Resource getFileResource(String sourceName)
           
 MaintenanceDocumentEntry getMaintenanceDocumentEntryForBusinessObjectClass(Class<?> businessObjectClass)
          Note: only MaintenanceDocuments are indexed by businessObject Class This is a special case that is referenced in one location.
 Map<String,List<String>> getModuleDictionaryFiles()
          Mapping of namespace codes to dictionary files that are associated with that namespace
 List<String> getModuleLoadOrder()
          Order modules should be loaded into the dictionary
 String getNamespaceForBeanDefinition(String beanName)
          Retrieves the namespace code the given bean name is associated with
static PersistenceStructureService getPersistenceStructureService()
           
 View getViewById(String viewId)
          Returns the View entry identified by the given id
 View getViewByTypeIndex(UifConstants.ViewType viewTypeName, Map<String,String> indexKey)
          Returns View instance identified by the view type name and index
 org.springframework.beans.PropertyValues getViewPropertiesById(String viewId)
          Retrieves the configured property values for the view bean definition associated with the given id
 org.springframework.beans.PropertyValues getViewPropertiesByType(UifConstants.ViewType viewTypeName, Map<String,String> indexKey)
          Retrieves the configured property values for the view bean definition associated with the given type and index
 List<View> getViewsForType(UifConstants.ViewType viewTypeName)
          Gets all View prototypes configured for the given view type name
protected  void indexSource(String namespaceCode, File dir)
           
protected  void indexSource(String namespaceCode, String sourceName)
          Processes a given source for XML files to populate the dictionary with
static boolean isCollectionPropertyOf(Class targetClass, String propertyName)
           
static boolean isPropertyOf(Class targetClass, String propertyName)
           
 void loadDictionaryBeans(KualiDefaultListableBeanFactory beans, Map<String,List<String>> moduleDictionaryFiles, DataDictionaryIndex index, ArrayList<String> validationFiles)
          Populates and processes the dictionary bean factory based on the configured files
 void parseDataDictionaryConfigurationFiles(boolean allowConcurrentValidation)
          Populates and processes the dictionary bean factory based on the configured files and performs indexing
 void performBeanOverrides()
          This method gathers beans of type BeanOverride and invokes each one's performOverride() method.
 void performDictionaryPostProcessing(boolean allowConcurrentValidation)
          Invokes post processors and builds indexes for the beans contained in the dictionary
 void setDataDictionaryMapper(DataDictionaryMapper mapper)
          Sets the DataDictionaryMapper
 void setModuleDictionaryFiles(Map<String,List<String>> moduleDictionaryFiles)
          Setter for the map of module dictionary files
 void setModuleLoadOrder(List<String> moduleLoadOrder)
          Setter for the list of namespace codes indicating the module load order
static void setupProcessor(KualiDefaultListableBeanFactory beans)
          Sets up the bean post processor and conversion service
 void validateDD()
           
 void validateDD(boolean validateEbos)
           
 boolean viewByTypeExist(UifConstants.ViewType viewTypeName, Map<String,String> indexKey)
          Indicates whether a View exists for the given view type and index information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validateEBOs

protected static boolean validateEBOs

ddBeans

protected KualiDefaultListableBeanFactory ddBeans

xmlReader

protected org.springframework.beans.factory.xml.XmlBeanDefinitionReader xmlReader

ddIndex

protected DataDictionaryIndex ddIndex

uifIndex

protected UifDictionaryIndex uifIndex

ddMapper

protected DataDictionaryMapper ddMapper

moduleDictionaryFiles

protected Map<String,List<String>> moduleDictionaryFiles

moduleLoadOrder

protected List<String> moduleLoadOrder

beanValidationFiles

protected ArrayList<String> beanValidationFiles

persistenceStructureService

public static PersistenceStructureService persistenceStructureService
Constructor Detail

DataDictionary

public DataDictionary()
Method Detail

parseDataDictionaryConfigurationFiles

public void parseDataDictionaryConfigurationFiles(boolean allowConcurrentValidation)
Populates and processes the dictionary bean factory based on the configured files and performs indexing

Parameters:
allowConcurrentValidation - - indicates whether the indexing should occur on a different thread or the same thread

setupProcessor

public static void setupProcessor(KualiDefaultListableBeanFactory beans)
Sets up the bean post processor and conversion service

Parameters:
beans - - The bean factory for the the dictionary beans

loadDictionaryBeans

public void loadDictionaryBeans(KualiDefaultListableBeanFactory beans,
                                Map<String,List<String>> moduleDictionaryFiles,
                                DataDictionaryIndex index,
                                ArrayList<String> validationFiles)
Populates and processes the dictionary bean factory based on the configured files

Parameters:
beans - - The bean factory for the dictionary bean
moduleDictionaryFiles - - List of bean xml files
index - - Index of the data dictionary beans
validationFiles - - The List of bean xml files loaded into the bean file

performDictionaryPostProcessing

public void performDictionaryPostProcessing(boolean allowConcurrentValidation)
Invokes post processors and builds indexes for the beans contained in the dictionary

Parameters:
allowConcurrentValidation - - indicates whether the indexing should occur on a different thread or the same thread

validateDD

public void validateDD(boolean validateEbos)

validateDD

public void validateDD()

addConfigFileLocation

public void addConfigFileLocation(String namespaceCode,
                                  String location)
                           throws IOException
Adds a location of files or a individual resource to the data dictionary

The location can either be an XML file on the classpath or a file or folder location within the file system. If a folder location is given, the folder and all sub-folders will be traversed and any XML files will be added to the dictionary

Parameters:
namespaceCode - - namespace the beans loaded from the location should be associated with
location - - classpath resource or file system location
Throws:
IOException

indexSource

protected void indexSource(String namespaceCode,
                           String sourceName)
                    throws IOException
Processes a given source for XML files to populate the dictionary with

Parameters:
namespaceCode - - namespace the beans loaded from the location should be associated with
sourceName - - a file system or classpath resource locator
Throws:
IOException

getFileResource

protected org.springframework.core.io.Resource getFileResource(String sourceName)

indexSource

protected void indexSource(String namespaceCode,
                           File dir)

addModuleDictionaryFile

protected void addModuleDictionaryFile(String namespaceCode,
                                       String location)
Adds a file location to the list of dictionary files for the given namespace code

Parameters:
namespaceCode - - namespace to add location for
location - - file or resource location to add

getModuleDictionaryFiles

public Map<String,List<String>> getModuleDictionaryFiles()
Mapping of namespace codes to dictionary files that are associated with that namespace

Returns:
Map> where map key is namespace code, and value is list of dictionary file locations

setModuleDictionaryFiles

public void setModuleDictionaryFiles(Map<String,List<String>> moduleDictionaryFiles)
Setter for the map of module dictionary files

Parameters:
moduleDictionaryFiles -

getModuleLoadOrder

public List<String> getModuleLoadOrder()
Order modules should be loaded into the dictionary

Modules are loaded in the order they are found in this list. If not explicity set, they will be loaded in the order their dictionary file locations are added

Returns:
List list of namespace codes indicating the module load order

setModuleLoadOrder

public void setModuleLoadOrder(List<String> moduleLoadOrder)
Setter for the list of namespace codes indicating the module load order

Parameters:
moduleLoadOrder -

setDataDictionaryMapper

public void setDataDictionaryMapper(DataDictionaryMapper mapper)
Sets the DataDictionaryMapper

Parameters:
mapper - the datadictionary mapper

getBusinessObjectEntry

@Deprecated
public BusinessObjectEntry getBusinessObjectEntry(String className)
Deprecated. 

Parameters:
className -
Returns:
BusinessObjectEntry for the named class, or null if none exists

getDataObjectEntry

public DataObjectEntry getDataObjectEntry(String className)
Parameters:
className -
Returns:
BusinessObjectEntry for the named class, or null if none exists

getBusinessObjectEntryForConcreteClass

public BusinessObjectEntry getBusinessObjectEntryForConcreteClass(String className)
This method gets the business object entry for a concrete class

Parameters:
className -
Returns:

getBusinessObjectClassNames

public List<String> getBusinessObjectClassNames()
Returns:
List of businessObject classnames

getBusinessObjectEntries

public Map<String,BusinessObjectEntry> getBusinessObjectEntries()
Returns:
Map of (classname, BusinessObjectEntry) pairs

getDictionaryObjectEntry

public DataDictionaryEntry getDictionaryObjectEntry(String className)
Parameters:
className -
Returns:
DataDictionaryEntryBase for the named class, or null if none exists

getDocumentEntry

public DocumentEntry getDocumentEntry(String documentTypeDDKey)
Returns the KNS document entry for the given lookup key. The documentTypeDDKey is interpreted successively in the following ways until a mapping is found (or none if found):
  1. KEW/workflow document type
  2. business object class name
  3. maintainable class name
This mapping is compiled when DataDictionary files are parsed on startup (or demand). Currently this means the mapping is static, and one-to-one (one KNS document maps directly to one and only one key).

Parameters:
documentTypeDDKey - the KEW/workflow document type name
Returns:
the KNS DocumentEntry if it exists

getMaintenanceDocumentEntryForBusinessObjectClass

public MaintenanceDocumentEntry getMaintenanceDocumentEntryForBusinessObjectClass(Class<?> businessObjectClass)
Note: only MaintenanceDocuments are indexed by businessObject Class This is a special case that is referenced in one location. Do we need another map for this stuff??

Parameters:
businessObjectClass -
Returns:
DocumentEntry associated with the given Class, or null if there is none

getDocumentEntries

public Map<String,DocumentEntry> getDocumentEntries()

getViewById

public View getViewById(String viewId)
Returns the View entry identified by the given id

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

getViewByTypeIndex

public View getViewByTypeIndex(UifConstants.ViewType viewTypeName,
                               Map<String,String> indexKey)
Returns View instance identified by the view type name and index

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

viewByTypeExist

public boolean viewByTypeExist(UifConstants.ViewType viewTypeName,
                               Map<String,String> indexKey)
Indicates whether a View exists for the given view type and index information

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:
boolean true if view exists, false if not

getViewsForType

public List<View> getViewsForType(UifConstants.ViewType 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

getDictionaryObject

public Object getDictionaryObject(String beanName)
Returns an object from the dictionary by its spring bean name

Parameters:
beanName - - id or name for the bean definition
Returns:
Object object instance created or the singleton being maintained

containsDictionaryObject

public boolean containsDictionaryObject(String id)
Indicates whether the data dictionary contains a bean with the given id

Parameters:
id - - id of the bean to check for
Returns:
boolean true if dictionary contains bean, false otherwise

getViewPropertiesById

public org.springframework.beans.PropertyValues getViewPropertiesById(String viewId)
Retrieves the configured property values for the view bean definition associated with the given id

Since constructing the View object can be expensive, when metadata only is needed this method can be used to retrieve the configured property values. Note this looks at the merged bean definition

Parameters:
viewId - - id for the view to retrieve
Returns:
PropertyValues configured on the view bean definition, or null if view is not found

getViewPropertiesByType

public org.springframework.beans.PropertyValues getViewPropertiesByType(UifConstants.ViewType viewTypeName,
                                                                        Map<String,String> indexKey)
Retrieves the configured property values for the view bean definition associated with the given type and index

Since constructing the View object can be expensive, when metadata only is needed this method can be used to retrieve the configured property values. Note this looks at the merged bean definition

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:
PropertyValues configured on the view bean definition, or null if view is not found

getBeanNamesForNamespace

public List<String> getBeanNamesForNamespace(String namespaceCode)
Retrieves the list of dictionary bean names that are associated with the given namespace code

Parameters:
namespaceCode - - namespace code to retrieve associated bean names for
Returns:
List bean names associated with the namespace

getNamespaceForBeanDefinition

public String getNamespaceForBeanDefinition(String beanName)
Retrieves the namespace code the given bean name is associated with

Parameters:
beanName - - name of the dictionary bean to find namespace code for
Returns:
String namespace code the bean is associated with, or null if a namespace was not found

isPropertyOf

public static boolean isPropertyOf(Class targetClass,
                                   String propertyName)
Parameters:
targetClass -
propertyName -
Returns:
true if the given propertyName names a property of the given class
Throws:
CompletionException - if there is a problem accessing the named property on the given class

isCollectionPropertyOf

public static boolean isCollectionPropertyOf(Class targetClass,
                                             String propertyName)
Parameters:
targetClass -
propertyName -
Returns:
true if the given propertyName names a Collection property of the given class
Throws:
CompletionException - if there is a problem accessing the named property on the given class

getPersistenceStructureService

public static PersistenceStructureService getPersistenceStructureService()
Returns:
the persistenceStructureService

getAttributeClass

public static Class getAttributeClass(Class boClass,
                                      String attributeName)
This method determines the Class of the attributeName passed in. Null will be returned if the member is not available, or if a reflection exception is thrown.

Parameters:
boClass - - Class that the attributeName property exists in.
attributeName - - Name of the attribute you want a class for.
Returns:
The Class of the attributeName, if the attribute exists on the rootClass. Null otherwise.

getCollectionElementClass

public static Class getCollectionElementClass(Class boClass,
                                              String collectionName)
This method determines the Class of the elements in the collectionName passed in.

Parameters:
boClass - Class that the collectionName collection exists in.
collectionName - the name of the collection you want the element class for
Returns:

buildReadDescriptor

public static PropertyDescriptor buildReadDescriptor(Class propertyClass,
                                                     String propertyName)
Parameters:
propertyClass -
propertyName -
Returns:
PropertyDescriptor for the getter for the named property of the given class, if one exists.

buildSimpleReadDescriptor

public static PropertyDescriptor buildSimpleReadDescriptor(Class propertyClass,
                                                           String propertyName)
Parameters:
propertyClass -
propertyName -
Returns:
PropertyDescriptor for the getter for the named property of the given class, if one exists.

getAllInactivationBlockingMetadatas

public Set<InactivationBlockingMetadata> getAllInactivationBlockingMetadatas(Class blockedClass)

performBeanOverrides

public void performBeanOverrides()
This method gathers beans of type BeanOverride and invokes each one's performOverride() method.



Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.