Package org.alfresco.repo.dictionary
Class DictionaryDAOImpl
java.lang.Object
org.alfresco.repo.dictionary.DictionaryDAOImpl
- All Implemented Interfaces:
EventListener,DictionaryDAO,NamespaceDAO,NamespacePrefixResolver,org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
public class DictionaryDAOImpl
extends Object
implements DictionaryDAO, NamespaceDAO, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
Default implementation of the Dictionary.
- Author:
- David Caruana, janv, sglover
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a namespace prefixvoidAdd a namespace URIvoiddestroy()Destroy the Dictionary.Return diffs between input model and model in the Dictionary.Return diffs between input model and model in the Dictionary.getAnonymousType(QName type, Collection<QName> aspects) Construct an anonymous type that combines a primary type definition and and one or more aspectsgetAspects(boolean includeInherited) getAspects(QName modelName) getAssociation(QName assocName) getAssociations(boolean includeInherited) getAssociations(QName modelName) getCompiledModel(QName modelName) getConstraint(QName constraintQName) getConstraints(QName modelName) getConstraints(QName modelName, boolean referenceableDefsOnly) getDataType(Class javaClass) getDataType(QName typeName) getDataTypes(QName modelName) get DictionaryListener registered by calls to registerListenergetDictionaryRegistry(String tenantDomain) getModels(boolean includeInherited) getNamespaces(QName modelName) getNamespaceURI(String prefix) Gets the namespace URI registered for the given prefixGets all registered PrefixesgetPrefixes(String URI) Gets the registered prefixes for the given namespace URIgetProperties(QName modelName) getProperties(QName modelName, QName dataType) Get all properties for the model and that are of the given data type.getPropertiesOfDataType(QName dataType) Get all properties for all models of the given data type.getProperty(QName propertyName) getSubAspects(QName superAspect, boolean follow) getSubTypes(QName superType, boolean follow) getTypes(boolean includeInherited) getURIs()Gets all registered Urisvoidinit()Initialise a reload of the dictionary for the current tenant.initDictionaryRegistry(String tenantDomain) For cache use only.booleanbooleanisModelInherited(QName modelName) voidonApplicationEvent(org.springframework.context.ApplicationEvent event) Adds a model to the dictionary.Adds a model to the dictionary.voidregister(DictionaryListener dictionaryListener) Deprecated.voidregisterListener(DictionaryListener dictionaryListener) Register with the DictionaryvoidremoveModel(QName modelName) Removes a model from the dictionary.voidremovePrefix(String prefix) Remove a namspace prefixvoidRemove the specified URIvoidreset()Reset the Dictionary for the current tenant.voidsetDictionaryRegistryCache(CompiledModelsCache dictionaryRegistryCache) voidsetResourceClassLoader(ClassLoader resourceClassLoader) voidsetTenantService(TenantService tenantService) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
DictionaryDAOImpl
public DictionaryDAOImpl()Construct
-
-
Method Details
-
setTenantService
-
setDictionaryRegistryCache
-
register
Deprecated.Register listener with the DictionaryThis method is deprecated, use
registerListener(DictionaryListener dictionaryListener)instead.- Specified by:
registerin interfaceDictionaryDAO- Parameters:
dictionaryListener-
-
registerListener
Register with the Dictionary- Specified by:
registerListenerin interfaceDictionaryDAO- Parameters:
dictionaryListener- DictionaryListener
-
getDictionaryListeners
Description copied from interface:DictionaryDAOget DictionaryListener registered by calls to registerListener- Specified by:
getDictionaryListenersin interfaceDictionaryDAO- Returns:
- read only list of dictionary listeners
- See Also:
-
init
public void init()Description copied from interface:DictionaryDAOInitialise a reload of the dictionary for the current tenant. The current version of the dictionary will be accessible during this call, however it will only return once the dictionary has undergone a reload for the current tenant.- Specified by:
initin interfaceDictionaryDAO
-
destroy
public void destroy()Description copied from interface:DictionaryDAODestroy the Dictionary. After this call, there will be no dictionary available for the current tenant; reloading will be done lazily as required.WARNING: This method can cause 'stutter' on user threads as they wait for the dictionary to reload. It is safer to call
DictionaryDAO.init(), which will also rebuild the dictionary but will not destroy the old one, thereby allowing other threads to continue operating.- Specified by:
destroyin interfaceDictionaryDAO
-
reset
public void reset()Description copied from interface:DictionaryDAOReset the Dictionary for the current tenant. The current dictionary will be discarded and reloaded before the method returns i.e. upon return the dictionary will be current.- Specified by:
resetin interfaceDictionaryDAO
-
putModel
Description copied from interface:DictionaryDAOAdds a model to the dictionary. The model is compiled and validated.- Specified by:
putModelin interfaceDictionaryDAO- Parameters:
model- the model to add- Returns:
- QName name of model
-
putModelIgnoringConstraints
Description copied from interface:DictionaryDAOAdds a model to the dictionary. The model is compiled and validated. Constraints are not loaded. This method should only be used to load models where the enforcement of constraints is never required. For example, SOLR read only use of the index where contraints are not required and thier definitions may not be available.- Specified by:
putModelIgnoringConstraintsin interfaceDictionaryDAO- Parameters:
model- the model to add- Returns:
- QName name of model
-
removeModel
Description copied from interface:DictionaryDAORemoves a model from the dictionary. The types and aspect in the model will no longer be available.- Specified by:
removeModelin interfaceDictionaryDAO- Parameters:
modelName- the qname of the model to remove- See Also:
-
getCompiledModel
- Parameters:
modelName- the model name- Returns:
- the compiled model of the given name
-
getDataType
-
getDataType
-
getDataTypes
- Specified by:
getDataTypesin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve property types for- Returns:
- the property types of the model
-
getType
-
getSubTypes
- Specified by:
getSubTypesin interfaceDictionaryDAO- Parameters:
superType- QNamefollow- true => follow up the super-class hierarchy, false => immediate sub types only
-
getAspect
-
getSubAspects
- Specified by:
getSubAspectsin interfaceDictionaryDAO- Parameters:
superAspect- QNamefollow- true => follow up the super-class hierarchy, false => immediate sub aspects only
-
getClass
-
getProperty
-
getConstraint
-
getAssociation
-
getAssociations
- Specified by:
getAssociationsin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve associations for- Returns:
- the associations of the model
-
getModels
- Specified by:
getModelsin interfaceDictionaryDAO
-
getModels
- Specified by:
getModelsin interfaceDictionaryDAO- Returns:
- the models known by the dictionary
-
getTypes
- Specified by:
getTypesin interfaceDictionaryDAO
-
getAssociations
- Specified by:
getAssociationsin interfaceDictionaryDAO
-
getAspects
- Specified by:
getAspectsin interfaceDictionaryDAO
-
isModelInherited
- Specified by:
isModelInheritedin interfaceDictionaryDAO
-
getModel
- Specified by:
getModelin interfaceDictionaryDAO- Parameters:
name- the model to retrieve- Returns:
- the named model definition
-
getTypes
- Specified by:
getTypesin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve types for- Returns:
- the types of the model
-
getAspects
- Specified by:
getAspectsin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve aspects for- Returns:
- the aspects of the model
-
getAnonymousType
Description copied from interface:DictionaryDAOConstruct an anonymous type that combines a primary type definition and and one or more aspects- Specified by:
getAnonymousTypein interfaceDictionaryDAO- Parameters:
type- the primary typeaspects- the aspects to combine- Returns:
- the anonymous type definition
-
getProperties
- Specified by:
getPropertiesin interfaceDictionaryDAO- Parameters:
modelName- the model for which to get properties for- Returns:
- the properties of the model
-
getProperties
Description copied from interface:DictionaryDAOGet all properties for the model and that are of the given data type. If dataType is null then the all properties will be returned.- Specified by:
getPropertiesin interfaceDictionaryDAO- Parameters:
modelName- the name of the modeldataType- null to get all properties- Returns:
- the properties associated with the model
-
getPropertiesOfDataType
Description copied from interface:DictionaryDAOGet all properties for all models of the given data type.- Specified by:
getPropertiesOfDataTypein interfaceDictionaryDAO- Parameters:
dataType- QName
-
getNamespaces
- Specified by:
getNamespacesin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve namespaces for- Returns:
- the namespaces of the model
-
getConstraints
- Specified by:
getConstraintsin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve constraint defs (including property constaint refs)- Returns:
- the constraints of the model
-
getConstraints
public Collection<ConstraintDefinition> getConstraints(QName modelName, boolean referenceableDefsOnly) - Specified by:
getConstraintsin interfaceDictionaryDAO- Parameters:
modelName- the model to retrieve constraint defs (optionally only referenceable constraints)- Returns:
- the constraints of the model
-
getDictionaryRegistry
- Specified by:
getDictionaryRegistryin interfaceDictionaryDAO
-
initDictionaryRegistry
For cache use only.- Parameters:
tenantDomain- String- Returns:
- constructed DictionaryRegistry
-
diffModel
Return diffs between input model and model in the Dictionary. If the input model does not exist in the Dictionary then no diffs will be returned.- Specified by:
diffModelin interfaceDictionaryDAO- Parameters:
model- M2Model- Returns:
- model diffs (if any)
-
diffModelIgnoringConstraints
- Specified by:
diffModelIgnoringConstraintsin interfaceDictionaryDAO
-
diffModel
Return diffs between input model and model in the Dictionary. If the input model does not exist in the Dictionary then no diffs will be returned.- Parameters:
model- M2ModelenableConstraintClassLoading- boolean- Returns:
- model diffs (if any)
-
getResourceClassLoader
- Specified by:
getResourceClassLoaderin interfaceDictionaryDAO- Returns:
- ClassLoader
-
setResourceClassLoader
- Specified by:
setResourceClassLoaderin interfaceDictionaryDAO- Parameters:
resourceClassLoader- ClassLoader
-
getNamespaceURI
Description copied from interface:NamespacePrefixResolverGets the namespace URI registered for the given prefix- Specified by:
getNamespaceURIin interfaceNamespacePrefixResolver- Parameters:
prefix- prefix to lookup- Returns:
- the namespace
-
getPrefixes
Description copied from interface:NamespacePrefixResolverGets the registered prefixes for the given namespace URI- Specified by:
getPrefixesin interfaceNamespacePrefixResolver- Parameters:
URI- namespace URI to lookup- Returns:
- the prefixes (or empty collection, if no prefixes registered against URI)
-
addURI
Description copied from interface:NamespaceDAOAdd a namespace URI- Specified by:
addURIin interfaceNamespaceDAO- Parameters:
uri- the namespace uri to add
-
getPrefixes
Description copied from interface:NamespacePrefixResolverGets all registered Prefixes- Specified by:
getPrefixesin interfaceNamespacePrefixResolver- Returns:
- collection of all registered namespace prefixes
-
getURIs
Description copied from interface:NamespacePrefixResolverGets all registered Uris- Specified by:
getURIsin interfaceNamespacePrefixResolver- Returns:
- collection of all registered namespace uris
-
removeURI
Description copied from interface:NamespaceDAORemove the specified URI- Specified by:
removeURIin interfaceNamespaceDAO- Parameters:
uri- the uri to remove
-
addPrefix
Description copied from interface:NamespaceDAOAdd a namespace prefix- Specified by:
addPrefixin interfaceNamespaceDAO- Parameters:
prefix- the prefixuri- the uri to prefix
-
removePrefix
Description copied from interface:NamespaceDAORemove a namspace prefix- Specified by:
removePrefixin interfaceNamespaceDAO- Parameters:
prefix- the prefix to remove
-
isContextRefreshed
public boolean isContextRefreshed()- Specified by:
isContextRefreshedin interfaceDictionaryDAO
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-