Package org.alfresco.repo.dictionary
Class DictionaryComponent
- java.lang.Object
-
- org.alfresco.repo.dictionary.DictionaryComponent
-
- All Implemented Interfaces:
TenantDeployer,DictionaryService,MessageLookup
- Direct Known Subclasses:
FilteredDictionaryComponent
public class DictionaryComponent extends Object implements DictionaryService, TenantDeployer
Data Dictionary Service Implementation- Author:
- David Caruana, sglover
-
-
Constructor Summary
Constructors Constructor Description DictionaryComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Collection<QName>getAllAspects()Collection<QName>getAllAspects(boolean includeInherited)Collection<QName>getAllAssociations()Get all the association definitionsCollection<QName>getAllAssociations(boolean includeInherited)Collection<QName>getAllDataTypes()Collection<QName>getAllModels()Collection<QName>getAllModels(boolean includeInherited)Collection<QName>getAllProperties(QName dataType)Get all properties defined across all models with the given data type.Collection<QName>getAllTypes()Collection<QName>getAllTypes(boolean includeInherited)TypeDefinitiongetAnonymousType(QName name)Creates an anonymousTypeDefinitionwith all the mandatoryAspectsapplied.TypeDefinitiongetAnonymousType(QName type, Collection<QName> aspects)Construct an anonymous type that combines the definitions of the specified type and aspects.AspectDefinitiongetAspect(QName name)Collection<QName>getAspects(QName model)AssociationDefinitiongetAssociation(QName associationName)Gets the definition of the association as defined by its owning Class.Collection<QName>getAssociations(QName model)ClassDefinitiongetClass(QName name)ConstraintDefinitiongetConstraint(QName constraintQName)Gets the definition of the constraintCollection<ConstraintDefinition>getConstraints(QName model)Get constraints for the specified modelCollection<ConstraintDefinition>getConstraints(QName model, boolean referenceableDefsOnly)Get constraints for the specified model Optionally return referenceable (ie.DataTypeDefinitiongetDataType(Class<?> javaClass)DataTypeDefinitiongetDataType(QName name)Collection<QName>getDataTypes(QName model)StringgetMessage(String messageKey)Get message from registered resource bundle.StringgetMessage(String messageKey, Object... params)Get a localised message string, parameterized using standard MessageFormatter.StringgetMessage(String messageKey, Locale locale)Get a localised message stringStringgetMessage(String messageKey, Locale locale, Object... params)Get a localised message string, parameterized using standard MessageFormatter.ModelDefinitiongetModel(QName model)ModelDefinitiongetModelByNamespaceUri(String uri)Collection<QName>getProperties(QName model)Get all properties for the specified modelCollection<QName>getProperties(QName model, QName dataType)Get all properties defined for the given model with the given data type.PropertyDefinitiongetProperty(QName propertyName)Gets the definition of the property as defined by its owning Class.PropertyDefinitiongetProperty(QName className, QName propertyName)Gets the definition of the property as defined by the specified Class.Map<QName,PropertyDefinition>getPropertyDefs(QName className)Gets the definitions of the properties defined by the specified Class.Collection<QName>getSubAspects(QName superAspect, boolean follow)Collection<QName>getSubTypes(QName superType, boolean follow)Get the sub types of the type.TypeDefinitiongetType(QName name)Collection<QName>getTypes(QName model)voidinit()booleanisSubClass(QName className, QName ofClassName)Determines whether a class is a sub-class of another classvoidonDisableTenant()voidonEnableTenant()voidsetDictionaryDAO(DictionaryDAO dictionaryDAO)Sets the Meta Model DAOvoidsetMessageLookup(MessageLookup messageLookup)Sets the message lookup service
-
-
-
Method Detail
-
setDictionaryDAO
public void setDictionaryDAO(DictionaryDAO dictionaryDAO)
Sets the Meta Model DAO- Parameters:
dictionaryDAO- dictionary DAO
-
setMessageLookup
public void setMessageLookup(MessageLookup messageLookup)
Sets the message lookup service- Parameters:
messageLookup- the message lookup service
-
getAllModels
public Collection<QName> getAllModels()
- Specified by:
getAllModelsin interfaceDictionaryService- Returns:
- the names of all models that have been registered with the Repository
-
getAllModels
public Collection<QName> getAllModels(boolean includeInherited)
-
getModel
public ModelDefinition getModel(QName model)
- Specified by:
getModelin interfaceDictionaryService- Parameters:
model- the model name to retrieve- Returns:
- the specified model (never null)
-
getAllDataTypes
public Collection<QName> getAllDataTypes()
- Specified by:
getAllDataTypesin interfaceDictionaryService- Returns:
- the names of all data types that have been registered with the Repository
-
getDataTypes
public Collection<QName> getDataTypes(QName model)
- Specified by:
getDataTypesin interfaceDictionaryService- Parameters:
model- the model to retrieve data types for- Returns:
- the names of all data types defined within the specified model
-
getAllTypes
public Collection<QName> getAllTypes()
- Specified by:
getAllTypesin interfaceDictionaryService- Returns:
- the names of all types that have been registered with the Repository
-
getAllTypes
public Collection<QName> getAllTypes(boolean includeInherited)
- Specified by:
getAllTypesin interfaceDictionaryService
-
getSubTypes
public Collection<QName> getSubTypes(QName superType, boolean follow)
Description copied from interface:DictionaryServiceGet the sub types of the type. The returned list includes the base type which is passed in as a parameter.- Specified by:
getSubTypesin interfaceDictionaryService- Parameters:
superType- the qualified name of the typefollow- true => all sub-type descendants, false => immediate sub-type children- Returns:
- the names of the sub types of the specified type, including the value passed in.
-
getTypes
public Collection<QName> getTypes(QName model)
- Specified by:
getTypesin interfaceDictionaryService- Parameters:
model- the model to retrieve types for- Returns:
- the names of all types defined within the specified model
-
getAllAspects
public Collection<QName> getAllAspects()
- Specified by:
getAllAspectsin interfaceDictionaryService- Returns:
- the names of all aspects that have been registered with the Repository
-
getAllAspects
public Collection<QName> getAllAspects(boolean includeInherited)
- Specified by:
getAllAspectsin interfaceDictionaryService
-
getAllAssociations
public Collection<QName> getAllAssociations()
Description copied from interface:DictionaryServiceGet all the association definitions- Specified by:
getAllAssociationsin interfaceDictionaryService- Returns:
- all the association qnames
-
getAllAssociations
public Collection<QName> getAllAssociations(boolean includeInherited)
- Specified by:
getAllAssociationsin interfaceDictionaryService
-
getSubAspects
public Collection<QName> getSubAspects(QName superAspect, boolean follow)
- Specified by:
getSubAspectsin interfaceDictionaryService- Parameters:
superAspect- QNamefollow- true => follow up the super-class hierarchy, false => immediate sub aspects only- Returns:
- the sub aspects of specified aspect
-
getAspects
public Collection<QName> getAspects(QName model)
- Specified by:
getAspectsin interfaceDictionaryService- Parameters:
model- the model to retrieve aspects for- Returns:
- the names of all aspects defined within the specified model
-
getAssociations
public Collection<QName> getAssociations(QName model)
- Specified by:
getAssociationsin interfaceDictionaryService- Parameters:
model- the model to retrieve associations for- Returns:
- the names of all associations defined within the specified model
-
isSubClass
public boolean isSubClass(QName className, QName ofClassName)
Description copied from interface:DictionaryServiceDetermines whether a class is a sub-class of another class- Specified by:
isSubClassin interfaceDictionaryService- Parameters:
className- the sub-class to testofClassName- the class to test against- Returns:
- true => the class is a sub-class (or itself)
-
getDataType
public DataTypeDefinition getDataType(QName name)
- Specified by:
getDataTypein interfaceDictionaryService- Parameters:
name- the name of the data type to retrieve- Returns:
- the data type definition (or null, if it doesn't exist)
-
getDataType
public DataTypeDefinition getDataType(Class<?> javaClass)
- Specified by:
getDataTypein interfaceDictionaryService- Parameters:
javaClass- java class to find datatype for- Returns:
- the data type definition (or null, if a mapping does not exist)
-
getType
public TypeDefinition getType(QName name)
- Specified by:
getTypein interfaceDictionaryService- Parameters:
name- the name of the type to retrieve- Returns:
- the type definition (or null, if it doesn't exist)
-
getAspect
public AspectDefinition getAspect(QName name)
- Specified by:
getAspectin interfaceDictionaryService- Parameters:
name- the name of the aspect to retrieve- Returns:
- the aspect definition (or null, if it doesn't exist)
-
getClass
public ClassDefinition getClass(QName name)
- Specified by:
getClassin interfaceDictionaryService- Parameters:
name- the name of the class (type or aspect) to retrieve- Returns:
- the class definition (or null, if it doesn't exist)
-
getAnonymousType
public TypeDefinition getAnonymousType(QName type, Collection<QName> aspects)
Description copied from interface:DictionaryServiceConstruct an anonymous type that combines the definitions of the specified type and aspects.- Specified by:
getAnonymousTypein interfaceDictionaryService- Parameters:
type- the type to start withaspects- the aspects to combine with the type- Returns:
- the anonymous type definition
-
getAnonymousType
public TypeDefinition getAnonymousType(QName name)
Creates an anonymousTypeDefinitionwith all the mandatoryAspectsapplied. This collapses all mandatoryAspectsinto a singleTypeDefinition.- Specified by:
getAnonymousTypein interfaceDictionaryService- Parameters:
name- the name of the type definition.- Returns:
- the anonymous type definition
-
getProperty
public PropertyDefinition getProperty(QName className, QName propertyName)
Description copied from interface:DictionaryServiceGets the definition of the property as defined by the specified Class. Note: A sub-class may override the definition of a property that's defined in a super-class.- Specified by:
getPropertyin interfaceDictionaryService- Parameters:
className- the class namepropertyName- the property name- Returns:
- the property definition (or null, if it doesn't exist)
-
getPropertyDefs
public Map<QName,PropertyDefinition> getPropertyDefs(QName className)
Description copied from interface:DictionaryServiceGets the definitions of the properties defined by the specified Class.- Specified by:
getPropertyDefsin interfaceDictionaryService- Parameters:
className- the class name- Returns:
- the property definitions
-
getProperty
public PropertyDefinition getProperty(QName propertyName)
Description copied from interface:DictionaryServiceGets the definition of the property as defined by its owning Class.- Specified by:
getPropertyin interfaceDictionaryService- Parameters:
propertyName- the property name- Returns:
- the property definition (or null, if it doesn't exist)
-
getAssociation
public AssociationDefinition getAssociation(QName associationName)
Description copied from interface:DictionaryServiceGets the definition of the association as defined by its owning Class.- Specified by:
getAssociationin interfaceDictionaryService- Parameters:
associationName- the property name- Returns:
- the association definition (or null, if it doesn't exist)
-
getAllProperties
public Collection<QName> getAllProperties(QName dataType)
Description copied from interface:DictionaryServiceGet all properties defined across all models with the given data type. Note that DataTypeDefinition.ANY will only match this type and can not be used as get all properties. If dataType is null then this method will return *ALL* properties regardless of data type.- Specified by:
getAllPropertiesin interfaceDictionaryService- Parameters:
dataType- QName
-
getProperties
public Collection<QName> getProperties(QName model, QName dataType)
Description copied from interface:DictionaryServiceGet all properties defined for the given model with the given data type. Note that DataTypeDefinition.ANY will only match this type and can not be used as get all properties. If dataType is null then this method will return *ALL* properties regardless of data type.- Specified by:
getPropertiesin interfaceDictionaryService- Parameters:
model- QNamedataType- QName
-
getProperties
public Collection<QName> getProperties(QName model)
Description copied from interface:DictionaryServiceGet all properties for the specified model- Specified by:
getPropertiesin interfaceDictionaryService- Parameters:
model- QName
-
getConstraint
public ConstraintDefinition getConstraint(QName constraintQName)
Description copied from interface:DictionaryServiceGets the definition of the constraint- Specified by:
getConstraintin interfaceDictionaryService- Parameters:
constraintQName- the constraint name- Returns:
- the constraint definition (or null, if it doesn't exist)
-
getConstraints
public Collection<ConstraintDefinition> getConstraints(QName model)
Description copied from interface:DictionaryServiceGet constraints for the specified model- Specified by:
getConstraintsin interfaceDictionaryService- Parameters:
model- QName
-
getConstraints
public Collection<ConstraintDefinition> getConstraints(QName model, boolean referenceableDefsOnly)
Description copied from interface:DictionaryServiceGet constraints for the specified model Optionally return referenceable (ie. non-property specific) constraints only- Specified by:
getConstraintsin interfaceDictionaryService- Parameters:
model- QNamereferenceableDefsOnly- boolean
-
init
public void init()
- Specified by:
initin interfaceTenantDeployer
-
destroy
public void destroy()
- Specified by:
destroyin interfaceTenantDeployer
-
onEnableTenant
public void onEnableTenant()
- Specified by:
onEnableTenantin interfaceTenantDeployer
-
onDisableTenant
public void onDisableTenant()
- Specified by:
onDisableTenantin interfaceTenantDeployer
-
getMessage
public String getMessage(String messageKey)
Description copied from interface:MessageLookupGet message from registered resource bundle.- Specified by:
getMessagein interfaceMessageLookup- Parameters:
messageKey- message key- Returns:
- localised message string, null if not found
-
getMessage
public String getMessage(String messageKey, Locale locale)
Description copied from interface:MessageLookupGet a localised message string- Specified by:
getMessagein interfaceMessageLookup- Parameters:
messageKey- the message keylocale- override the current locale- Returns:
- the localised message string, null if not found
-
getMessage
public String getMessage(String messageKey, Object... params)
Description copied from interface:MessageLookupGet a localised message string, parameterized using standard MessageFormatter.- Specified by:
getMessagein interfaceMessageLookup- Parameters:
messageKey- message keyparams- format parameters- Returns:
- the localised string, null if not found
-
getMessage
public String getMessage(String messageKey, Locale locale, Object... params)
Description copied from interface:MessageLookupGet a localised message string, parameterized using standard MessageFormatter.- Specified by:
getMessagein interfaceMessageLookup- Parameters:
messageKey- the message keylocale- override current localeparams- the localised message string- Returns:
- the localised string, null if not found
-
getModelByNamespaceUri
public ModelDefinition getModelByNamespaceUri(String uri)
- Specified by:
getModelByNamespaceUriin interfaceDictionaryService- Parameters:
uri- the namespace uri for search for- Returns:
- the named model definition
-
-