Class EntityDictionaryServiceImpl

java.lang.Object
org.alfresco.repo.dictionary.DictionaryComponent
fr.becpg.repo.entity.impl.EntityDictionaryServiceImpl
All Implemented Interfaces:
EntityDictionaryService, org.alfresco.repo.tenant.TenantDeployer, org.alfresco.service.cmr.dictionary.DictionaryService, org.alfresco.service.cmr.i18n.MessageLookup, org.alfresco.util.cache.RefreshableCacheListener, org.springframework.beans.factory.InitializingBean

public class EntityDictionaryServiceImpl extends org.alfresco.repo.dictionary.DictionaryComponent implements org.alfresco.service.cmr.dictionary.DictionaryService, EntityDictionaryService, org.alfresco.util.cache.RefreshableCacheListener, org.springframework.beans.factory.InitializingBean
Enhanced implementation of EntityDictionaryService with performance optimizations including improved caching, reduced object creation, and optimized data structures.
Version:
$Id: $Id
Author:
matthieu Fast and cached access to dataDictionary
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
     
    private static final String
     
     
    private static final String
     
    private static final String
     
    private static final String
     
    private static final String
     
    private static final String
     
    private org.alfresco.repo.dictionary.DictionaryDAO
     
    private final Map<org.alfresco.service.namespace.QName,Set<org.alfresco.service.namespace.QName>>
     
    private static final String
     
    private static final org.apache.commons.logging.Log
     
    private org.alfresco.repo.i18n.MessageService
     
    private static final String
     
    private org.alfresco.service.namespace.NamespaceService
     
    private final Map<String,String>
     
    private static final String
     
    private final Map<org.alfresco.service.namespace.QName,String>
     
    private static final String
     
    private final Map<org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName>
     
    private org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry
     
     
    private static final String
     
    private static final String
     
    private static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    private String
    Efficiently builds cache keys by concatenating strings
    private boolean
    computeIsSubClass(org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName ofClassName)
    Computes the actual isSubClass logic separated for better readability
    private String
    computeOverrideKey(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)
    Computes override keys with caching to avoid repeated string operations
    org.alfresco.service.cmr.dictionary.ClassAttributeDefinition
    findMatchingPropDef(org.alfresco.service.namespace.QName itemType, org.alfresco.service.namespace.QName newItemType, org.alfresco.service.namespace.QName fieldQname)
    findMatchingPropDef.
    org.alfresco.service.namespace.QName
    getAssocIndexQName(org.alfresco.service.namespace.QName assocQName)
    getAssocIndexQName.
    org.alfresco.service.cmr.dictionary.ClassDefinition
    getClass(org.alfresco.service.namespace.QName name)
    org.alfresco.service.namespace.QName
    getDefaultPivotAssoc(org.alfresco.service.namespace.QName dataListItemType)
    getDefaultPivotAssoc.
    getDescription(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)
    getDescription.
    org.alfresco.service.namespace.QName
    getMultiLevelGroupProperty(org.alfresco.service.namespace.QName dataListItemType)
    getMultiLevelGroupProperty.
    org.alfresco.service.namespace.QName
    getMultiLevelSecondaryPivot(org.alfresco.service.namespace.QName dataListItemType)
    getMultiLevelSecondaryPivot.
    List<org.alfresco.service.cmr.dictionary.AssociationDefinition>
    getPivotAssocDefs(org.alfresco.service.namespace.QName sourceType)
    getPivotAssocDefs.
    List<org.alfresco.service.cmr.dictionary.AssociationDefinition>
    getPivotAssocDefs(org.alfresco.service.namespace.QName sourceType, boolean exactMatch)
    getPivotAssocDefs.
    org.alfresco.service.cmr.dictionary.ClassAttributeDefinition
    getPropDef(org.alfresco.service.namespace.QName fieldQname)
    getPropDef.
    Collection<org.alfresco.service.namespace.QName>
    getSubAspects(org.alfresco.service.namespace.QName superAspect, boolean follow)
    Collection<org.alfresco.service.namespace.QName>
    getSubTypes(org.alfresco.service.namespace.QName typeQname)
    getSubTypes.
    Collection<org.alfresco.service.namespace.QName>
    getSubTypes(org.alfresco.service.namespace.QName superType, boolean follow)
    org.alfresco.service.namespace.QName
    getTargetType(org.alfresco.service.namespace.QName assocName)
    getTargetType.
    getTitle(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)
    getTitle.
    boolean
    isAssoc(org.alfresco.service.namespace.QName assocName)
    isAssoc.
    boolean
    isMultiLevelDataList(org.alfresco.service.namespace.QName dataListItemType)
    isMultiLevelDataList.
    boolean
    isMultiLevelLeaf(org.alfresco.service.namespace.QName entityType)
    isMultiLevelLeaf.
    boolean
    isSubClass(org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName ofClassName)
    void
    onRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)
    void
    registerExtraAssocsDefMapping(org.alfresco.service.namespace.QName orig, org.alfresco.service.namespace.QName dest)
    registerExtraAssocsDefMapping.
    void
    registerPropDefMapping(org.alfresco.service.namespace.QName orig, org.alfresco.service.namespace.QName dest)
    registerPropDefMapping.
    void
    Setter for the field beCPGCacheService.
    void
    setDictionaryDAO(org.alfresco.repo.dictionary.DictionaryDAO dictionaryDAO)
    void
    setMessageService(org.alfresco.repo.i18n.MessageService messageService)
    Setter for the field messageService.
    void
    setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
    Setter for the field namespaceService.
    void
    setRegistry(org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry registry)
    Setter for the field registry.
    void
    Setter for the field repositoryEntityDefReader.
    toPrefixString(org.alfresco.service.namespace.QName propertyQName)
    toPrefixString.

    Methods inherited from class org.alfresco.repo.dictionary.DictionaryComponent

    destroy, getAllAspects, getAllAspects, getAllAssociations, getAllAssociations, getAllDataTypes, getAllModels, getAllModels, getAllProperties, getAllTypes, getAllTypes, getAnonymousType, getAnonymousType, getAspect, getAspects, getAssociation, getAssociations, getConstraint, getConstraints, getConstraints, getDataType, getDataType, getDataTypes, getMessage, getMessage, getMessage, getMessage, getModel, getModelByNamespaceUri, getProperties, getProperties, getProperty, getProperty, getPropertyDefs, getType, getTypes, init, onDisableTenant, onEnableTenant, setMessageLookup

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.alfresco.service.cmr.dictionary.DictionaryService

    getAllAspects, getAllAspects, getAllAssociations, getAllAssociations, getAllDataTypes, getAllModels, getAllProperties, getAllTypes, getAllTypes, getAnonymousType, getAnonymousType, getAspect, getAspects, getAssociation, getAssociations, getConstraint, getConstraints, getConstraints, getDataType, getDataType, getDataTypes, getModel, getModelByNamespaceUri, getProperties, getProperties, getProperty, getProperty, getPropertyDefs, getType, getTypes

    Methods inherited from interface org.alfresco.service.cmr.i18n.MessageLookup

    getMessage, getMessage, getMessage, getMessage
  • Field Details

    • logger

      private static final org.apache.commons.logging.Log logger
    • PROP_DEF_CACHE_SUFFIX

      private static final String PROP_DEF_CACHE_SUFFIX
      See Also:
    • CLASS_DEF_CACHE_SUFFIX

      private static final String CLASS_DEF_CACHE_SUFFIX
      See Also:
    • SUB_TYPES_CACHE_SUFFIX

      private static final String SUB_TYPES_CACHE_SUFFIX
      See Also:
    • SUB_ASPECTS_CACHE_SUFFIX

      private static final String SUB_ASPECTS_CACHE_SUFFIX
      See Also:
    • PREFIX_STRING_CACHE_SUFFIX

      private static final String PREFIX_STRING_CACHE_SUFFIX
      See Also:
    • IS_SUB_CLASS_CACHE_SUFFIX

      private static final String IS_SUB_CLASS_CACHE_SUFFIX
      See Also:
    • ASSOC_INDEX_CACHE_SUFFIX

      private static final String ASSOC_INDEX_CACHE_SUFFIX
      See Also:
    • ASSOC_INDEX_PROPERTY_SUFFIX

      private static final String ASSOC_INDEX_PROPERTY_SUFFIX
      See Also:
    • CACHE_SEPARATOR

      private static final String CACHE_SEPARATOR
      See Also:
    • MODEL_OVERRIDE_PREFIX

      private static final String MODEL_OVERRIDE_PREFIX
      See Also:
    • TITLE_SUFFIX

      private static final String TITLE_SUFFIX
      See Also:
    • DESCRIPTION_SUFFIX

      private static final String DESCRIPTION_SUFFIX
      See Also:
    • COLON_REPLACEMENT

      private static final String COLON_REPLACEMENT
      See Also:
    • COMPILED_MODELS_CACHE

      private static final String COMPILED_MODELS_CACHE
      See Also:
    • dictionaryDAO

      private org.alfresco.repo.dictionary.DictionaryDAO dictionaryDAO
    • beCPGCacheService

      private BeCPGCacheService beCPGCacheService
    • registry

      private org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry registry
    • repositoryEntityDefReader

      private RepositoryEntityDefReader<RepositoryEntity> repositoryEntityDefReader
    • namespaceService

      private org.alfresco.service.namespace.NamespaceService namespaceService
    • messageService

      private org.alfresco.repo.i18n.MessageService messageService
    • propDefMapping

      private final Map<org.alfresco.service.namespace.QName,org.alfresco.service.namespace.QName> propDefMapping
    • extraAssocsDefMapping

      private final Map<org.alfresco.service.namespace.QName,Set<org.alfresco.service.namespace.QName>> extraAssocsDefMapping
    • prefixStringCache

      private final Map<org.alfresco.service.namespace.QName,String> prefixStringCache
    • overrideKeyCache

      private final Map<String,String> overrideKeyCache
  • Constructor Details

    • EntityDictionaryServiceImpl

      public EntityDictionaryServiceImpl()
  • Method Details

    • setMessageService

      public void setMessageService(org.alfresco.repo.i18n.MessageService messageService)

      Setter for the field messageService.

      Parameters:
      messageService - a MessageService object
    • setRepositoryEntityDefReader

      public void setRepositoryEntityDefReader(RepositoryEntityDefReader<RepositoryEntity> repositoryEntityDefReader)

      Setter for the field repositoryEntityDefReader.

      Parameters:
      repositoryEntityDefReader - a RepositoryEntityDefReader object
    • setRegistry

      public void setRegistry(org.alfresco.util.cache.AsynchronouslyRefreshedCacheRegistry registry)

      Setter for the field registry.

      Parameters:
      registry - a AsynchronouslyRefreshedCacheRegistry object
      Since:
      23.4.2.28
    • setBeCPGCacheService

      public void setBeCPGCacheService(BeCPGCacheService beCPGCacheService)

      Setter for the field beCPGCacheService.

      Parameters:
      beCPGCacheService - a BeCPGCacheService object
      Since:
      23.4.2.28
    • setNamespaceService

      public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)

      Setter for the field namespaceService.

      Parameters:
      namespaceService - a NamespaceService object
    • setDictionaryDAO

      public void setDictionaryDAO(org.alfresco.repo.dictionary.DictionaryDAO dictionaryDAO)
      Overrides:
      setDictionaryDAO in class org.alfresco.repo.dictionary.DictionaryComponent
    • getDefaultPivotAssoc

      public org.alfresco.service.namespace.QName getDefaultPivotAssoc(org.alfresco.service.namespace.QName dataListItemType)

      getDefaultPivotAssoc.

      Specified by:
      getDefaultPivotAssoc in interface EntityDictionaryService
      Parameters:
      dataListItemType - a QName object.
      Returns:
      a QName object.
    • isMultiLevelDataList

      public boolean isMultiLevelDataList(org.alfresco.service.namespace.QName dataListItemType)

      isMultiLevelDataList.

      Specified by:
      isMultiLevelDataList in interface EntityDictionaryService
      Parameters:
      dataListItemType - a QName object.
      Returns:
      a boolean.
    • isMultiLevelLeaf

      public boolean isMultiLevelLeaf(org.alfresco.service.namespace.QName entityType)

      isMultiLevelLeaf.

      Specified by:
      isMultiLevelLeaf in interface EntityDictionaryService
      Parameters:
      entityType - a QName object.
      Returns:
      a boolean.
    • getMultiLevelSecondaryPivot

      public org.alfresco.service.namespace.QName getMultiLevelSecondaryPivot(org.alfresco.service.namespace.QName dataListItemType)

      getMultiLevelSecondaryPivot.

      Specified by:
      getMultiLevelSecondaryPivot in interface EntityDictionaryService
      Parameters:
      dataListItemType - a QName object.
      Returns:
      a QName object.
    • getMultiLevelGroupProperty

      public org.alfresco.service.namespace.QName getMultiLevelGroupProperty(org.alfresco.service.namespace.QName dataListItemType)

      getMultiLevelGroupProperty.

      Specified by:
      getMultiLevelGroupProperty in interface EntityDictionaryService
      Parameters:
      dataListItemType - a QName object.
      Returns:
      a QName object.
    • registerPropDefMapping

      public void registerPropDefMapping(org.alfresco.service.namespace.QName orig, org.alfresco.service.namespace.QName dest)

      registerPropDefMapping.

      Specified by:
      registerPropDefMapping in interface EntityDictionaryService
      Parameters:
      orig - a QName object.
      dest - a QName object.
    • registerExtraAssocsDefMapping

      public void registerExtraAssocsDefMapping(org.alfresco.service.namespace.QName orig, org.alfresco.service.namespace.QName dest)

      registerExtraAssocsDefMapping.

      Specified by:
      registerExtraAssocsDefMapping in interface EntityDictionaryService
      Parameters:
      orig - a QName object
      dest - a QName object
    • getPivotAssocDefs

      public List<org.alfresco.service.cmr.dictionary.AssociationDefinition> getPivotAssocDefs(org.alfresco.service.namespace.QName sourceType)

      getPivotAssocDefs.

      Specified by:
      getPivotAssocDefs in interface EntityDictionaryService
      Parameters:
      sourceType - a QName object.
      Returns:
      a List object.
    • getPivotAssocDefs

      public List<org.alfresco.service.cmr.dictionary.AssociationDefinition> getPivotAssocDefs(org.alfresco.service.namespace.QName sourceType, boolean exactMatch)

      getPivotAssocDefs.

      Specified by:
      getPivotAssocDefs in interface EntityDictionaryService
      Parameters:
      sourceType - a QName object.
      exactMatch - a Boolean object.
      Returns:
      a List object.
    • getTargetType

      public org.alfresco.service.namespace.QName getTargetType(org.alfresco.service.namespace.QName assocName)

      getTargetType.

      Specified by:
      getTargetType in interface EntityDictionaryService
      Parameters:
      assocName - a QName object.
      Returns:
      a QName object.
    • findMatchingPropDef

      public org.alfresco.service.cmr.dictionary.ClassAttributeDefinition findMatchingPropDef(org.alfresco.service.namespace.QName itemType, org.alfresco.service.namespace.QName newItemType, org.alfresco.service.namespace.QName fieldQname)

      findMatchingPropDef.

      Specified by:
      findMatchingPropDef in interface EntityDictionaryService
      Parameters:
      itemType - a QName object.
      newItemType - a QName object.
      fieldQname - a QName object.
      Returns:
      a ClassAttributeDefinition object.
    • getPropDef

      public org.alfresco.service.cmr.dictionary.ClassAttributeDefinition getPropDef(org.alfresco.service.namespace.QName fieldQname)

      getPropDef.

      Specified by:
      getPropDef in interface EntityDictionaryService
      Parameters:
      fieldQname - a QName object.
      Returns:
      a ClassAttributeDefinition object.
    • isAssoc

      public boolean isAssoc(org.alfresco.service.namespace.QName assocName)

      isAssoc.

      Specified by:
      isAssoc in interface EntityDictionaryService
      Parameters:
      assocName - a QName object.
      Returns:
      a boolean.
    • getSubTypes

      public Collection<org.alfresco.service.namespace.QName> getSubTypes(org.alfresco.service.namespace.QName typeQname)

      getSubTypes.

      Specified by:
      getSubTypes in interface EntityDictionaryService
      Parameters:
      typeQname - a QName object.
      Returns:
      a Collection object.
    • getSubTypes

      public Collection<org.alfresco.service.namespace.QName> getSubTypes(org.alfresco.service.namespace.QName superType, boolean follow)
      Specified by:
      getSubTypes in interface org.alfresco.service.cmr.dictionary.DictionaryService
      Overrides:
      getSubTypes in class org.alfresco.repo.dictionary.DictionaryComponent
    • getSubAspects

      public Collection<org.alfresco.service.namespace.QName> getSubAspects(org.alfresco.service.namespace.QName superAspect, boolean follow)
      Specified by:
      getSubAspects in interface org.alfresco.service.cmr.dictionary.DictionaryService
      Overrides:
      getSubAspects in class org.alfresco.repo.dictionary.DictionaryComponent
    • toPrefixString

      public String toPrefixString(org.alfresco.service.namespace.QName propertyQName)

      toPrefixString.

      Specified by:
      toPrefixString in interface EntityDictionaryService
      Parameters:
      propertyQName - a QName object
      Returns:
      a String object
    • isSubClass

      public boolean isSubClass(org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName ofClassName)

      isSubClass.

      Specified by:
      isSubClass in interface org.alfresco.service.cmr.dictionary.DictionaryService
      Specified by:
      isSubClass in interface EntityDictionaryService
      Overrides:
      isSubClass in class org.alfresco.repo.dictionary.DictionaryComponent
    • onRefreshableCacheEvent

      public void onRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)
      Specified by:
      onRefreshableCacheEvent in interface org.alfresco.util.cache.RefreshableCacheListener
    • getCacheId

      public String getCacheId()
      Specified by:
      getCacheId in interface org.alfresco.util.cache.RefreshableCacheListener
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • getTitle

      public String getTitle(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)

      getTitle.

      Specified by:
      getTitle in interface EntityDictionaryService
      Parameters:
      attributeDefinition - a ClassAttributeDefinition object
      nodeType - a QName object
      Returns:
      a String object
    • getDescription

      public String getDescription(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)

      getDescription.

      Specified by:
      getDescription in interface EntityDictionaryService
      Parameters:
      attributeDefinition - a ClassAttributeDefinition object
      nodeType - a QName object
      Returns:
      a String object
    • getAssocIndexQName

      public org.alfresco.service.namespace.QName getAssocIndexQName(org.alfresco.service.namespace.QName assocQName)

      getAssocIndexQName.

      Specified by:
      getAssocIndexQName in interface EntityDictionaryService
      Parameters:
      assocQName - a QName object
      Returns:
      a QName object
    • getClass

      public org.alfresco.service.cmr.dictionary.ClassDefinition getClass(org.alfresco.service.namespace.QName name)
      Specified by:
      getClass in interface org.alfresco.service.cmr.dictionary.DictionaryService
      Overrides:
      getClass in class org.alfresco.repo.dictionary.DictionaryComponent
    • buildCacheKey

      private String buildCacheKey(String... parts)
      Efficiently builds cache keys by concatenating strings
    • computeIsSubClass

      private boolean computeIsSubClass(org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName ofClassName)
      Computes the actual isSubClass logic separated for better readability
    • computeOverrideKey

      private String computeOverrideKey(org.alfresco.service.cmr.dictionary.ClassAttributeDefinition attributeDefinition, org.alfresco.service.namespace.QName nodeType)
      Computes override keys with caching to avoid repeated string operations