Package org.alfresco.repo.dictionary
Interface DictionaryDAO
-
- All Known Implementing Classes:
DictionaryDAOImpl
public interface DictionaryDAO
Dictionary Data Access- Author:
- David Caruana, sglover
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
destroy()
Destroy the Dictionary.List<M2ModelDiff>
diffModel(M2Model model)
Return diffs between input model and model in the Dictionary.List<M2ModelDiff>
diffModelIgnoringConstraints(M2Model model)
TypeDefinition
getAnonymousType(QName type, Collection<QName> aspects)
Construct an anonymous type that combines a primary type definition and and one or more aspectsAspectDefinition
getAspect(QName name)
Gets the specified aspectCollection<QName>
getAspects(boolean includeInherited)
Collection<AspectDefinition>
getAspects(QName model)
AssociationDefinition
getAssociation(QName name)
Gets the specified associationCollection<QName>
getAssociations(boolean includeInherited)
Collection<AssociationDefinition>
getAssociations(QName model)
ClassDefinition
getClass(QName name)
Gets the specified classConstraintDefinition
getConstraint(QName name)
Gets the specified property constraintCollection<ConstraintDefinition>
getConstraints(QName model)
Collection<ConstraintDefinition>
getConstraints(QName model, boolean referenceableDefsOnly)
DataTypeDefinition
getDataType(Class javaClass)
Gets the data type for the specified Java ClassDataTypeDefinition
getDataType(QName name)
Gets the specified data typeCollection<DataTypeDefinition>
getDataTypes(QName model)
String
getDefaultAnalyserResourceBundleName()
List<DictionaryListener>
getDictionaryListeners()
get DictionaryListener registered by calls to registerListenerDictionaryRegistry
getDictionaryRegistry(String tenantDomain)
ModelDefinition
getModel(QName name)
Collection<QName>
getModels()
Collection<QName>
getModels(boolean includeInherited)
Collection<NamespaceDefinition>
getNamespaces(QName modelName)
Collection<PropertyDefinition>
getProperties(QName model)
Collection<PropertyDefinition>
getProperties(QName modelName, QName dataType)
Get all properties for the model and that are of the given data type.Collection<PropertyDefinition>
getPropertiesOfDataType(QName dataType)
Get all properties for all models of the given data type.PropertyDefinition
getProperty(QName name)
Gets the specified propertyClassLoader
getResourceClassLoader()
Collection<QName>
getSubAspects(QName superAspect, boolean follow)
Collection<QName>
getSubTypes(QName superType, boolean follow)
TypeDefinition
getType(QName name)
Gets the specified typeCollection<QName>
getTypes(boolean includeInherited)
Collection<TypeDefinition>
getTypes(QName model)
void
init()
Initialise a reload of the dictionary for the current tenant.boolean
isContextRefreshed()
boolean
isModelInherited(QName name)
QName
putModel(M2Model model)
Adds a model to the dictionary.QName
putModelIgnoringConstraints(M2Model model)
Adds a model to the dictionary.void
register(DictionaryListener dictionaryListener)
Deprecated.void
registerListener(DictionaryListener dictionaryListener)
Register listener with the Dictionaryvoid
removeModel(QName model)
Removes a model from the dictionary.void
reset()
Reset the Dictionary for the current tenant.void
setResourceClassLoader(ClassLoader resourceClassLoader)
-
-
-
Method Detail
-
getDictionaryListeners
List<DictionaryListener> getDictionaryListeners()
get DictionaryListener registered by calls to registerListener- Returns:
- read only list of dictionary listeners
- See Also:
DictionaryListener
-
getDictionaryRegistry
DictionaryRegistry getDictionaryRegistry(String tenantDomain)
-
isContextRefreshed
boolean isContextRefreshed()
-
getModels
Collection<QName> getModels()
- Returns:
- the models known by the dictionary
-
getModels
Collection<QName> getModels(boolean includeInherited)
-
getTypes
Collection<QName> getTypes(boolean includeInherited)
-
getAssociations
Collection<QName> getAssociations(boolean includeInherited)
-
getAspects
Collection<QName> getAspects(boolean includeInherited)
-
getModel
ModelDefinition getModel(QName name)
- Parameters:
name
- the model to retrieve- Returns:
- the named model definition
-
getDataTypes
Collection<DataTypeDefinition> getDataTypes(QName model)
- Parameters:
model
- the model to retrieve property types for- Returns:
- the property types of the model
-
getTypes
Collection<TypeDefinition> getTypes(QName model)
- Parameters:
model
- the model to retrieve types for- Returns:
- the types of the model
-
getSubTypes
Collection<QName> getSubTypes(QName superType, boolean follow)
- Parameters:
superType
- QNamefollow
- true => follow up the super-class hierarchy, false => immediate sub types only
-
getAspects
Collection<AspectDefinition> getAspects(QName model)
- Parameters:
model
- the model to retrieve aspects for- Returns:
- the aspects of the model
-
getAssociations
Collection<AssociationDefinition> getAssociations(QName model)
- Parameters:
model
- the model to retrieve associations for- Returns:
- the associations of the model
-
getSubAspects
Collection<QName> getSubAspects(QName superAspect, boolean follow)
- Parameters:
superAspect
- QNamefollow
- true => follow up the super-class hierarchy, false => immediate sub aspects only
-
getProperties
Collection<PropertyDefinition> getProperties(QName model)
- Parameters:
model
- the model for which to get properties for- Returns:
- the properties of the model
-
getAnonymousType
TypeDefinition getAnonymousType(QName type, Collection<QName> aspects)
Construct an anonymous type that combines a primary type definition and and one or more aspects- Parameters:
type
- the primary typeaspects
- the aspects to combine- Returns:
- the anonymous type definition
-
putModel
QName putModel(M2Model model)
Adds a model to the dictionary. The model is compiled and validated.- Parameters:
model
- the model to add- Returns:
- QName name of model
-
putModelIgnoringConstraints
QName putModelIgnoringConstraints(M2Model model)
Adds 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.- Parameters:
model
- the model to add- Returns:
- QName name of model
-
removeModel
void removeModel(QName model)
Removes a model from the dictionary. The types and aspect in the model will no longer be available.- Parameters:
model
- the qname of the model to remove
-
getProperties
Collection<PropertyDefinition> getProperties(QName modelName, QName dataType)
Get all properties for the model and that are of the given data type. If dataType is null then the all properties will be returned.- Parameters:
modelName
- the name of the modeldataType
- null to get all properties- Returns:
- the properties associated with the model
-
getPropertiesOfDataType
Collection<PropertyDefinition> getPropertiesOfDataType(QName dataType)
Get all properties for all models of the given data type.- Parameters:
dataType
- QName
-
getNamespaces
Collection<NamespaceDefinition> getNamespaces(QName modelName)
- Parameters:
modelName
- the model to retrieve namespaces for- Returns:
- the namespaces of the model
-
getConstraints
Collection<ConstraintDefinition> getConstraints(QName model)
- Parameters:
model
- the model to retrieve constraint defs (including property constaint refs)- Returns:
- the constraints of the model
-
getConstraints
Collection<ConstraintDefinition> getConstraints(QName model, boolean referenceableDefsOnly)
- Parameters:
model
- the model to retrieve constraint defs (optionally only referenceable constraints)- Returns:
- the constraints of the model
-
diffModel
List<M2ModelDiff> diffModel(M2Model model)
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
- M2Model- Returns:
- model diffs (if any)
-
diffModelIgnoringConstraints
List<M2ModelDiff> diffModelIgnoringConstraints(M2Model model)
-
register
@Deprecated void register(DictionaryListener dictionaryListener)
Deprecated.Register listener with the DictionaryThis method is deprecated, use
registerListener(DictionaryListener dictionaryListener)
instead.- Parameters:
dictionaryListener
-
-
registerListener
void registerListener(DictionaryListener dictionaryListener)
Register listener with the Dictionary- Parameters:
dictionaryListener
- DictionaryListener
-
reset
void reset()
Reset 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.
-
init
void init()
Initialise 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.
-
destroy
void destroy()
Destroy 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
init()
, which will also rebuild the dictionary but will not destroy the old one, thereby allowing other threads to continue operating.
-
isModelInherited
boolean isModelInherited(QName name)
-
getDefaultAnalyserResourceBundleName
String getDefaultAnalyserResourceBundleName()
- Returns:
- String
-
getResourceClassLoader
ClassLoader getResourceClassLoader()
- Returns:
- ClassLoader
-
setResourceClassLoader
void setResourceClassLoader(ClassLoader resourceClassLoader)
- Parameters:
resourceClassLoader
- ClassLoader
-
getDataType
DataTypeDefinition getDataType(QName name)
Gets the specified data type- Parameters:
name
- name of the data type- Returns:
- data type definition
-
getDataType
DataTypeDefinition getDataType(Class javaClass)
Gets the data type for the specified Java Class- Parameters:
javaClass
- the java class- Returns:
- the data type definition (or null, if mapping is not available)
-
getType
TypeDefinition getType(QName name)
Gets the specified type- Parameters:
name
- name of the type- Returns:
- type definition
-
getAspect
AspectDefinition getAspect(QName name)
Gets the specified aspect- Parameters:
name
- name of the aspect- Returns:
- aspect definition
-
getClass
ClassDefinition getClass(QName name)
Gets the specified class- Parameters:
name
- name of the class- Returns:
- class definition
-
getProperty
PropertyDefinition getProperty(QName name)
Gets the specified property- Parameters:
name
- name of the property- Returns:
- property definition
-
getConstraint
ConstraintDefinition getConstraint(QName name)
Gets the specified property constraint- Parameters:
name
- the qualified name of the property constraint- Returns:
- ConstraintDefinition
-
getAssociation
AssociationDefinition getAssociation(QName name)
Gets the specified association- Parameters:
name
- name of the association- Returns:
- association definition
-
-