Class AuthorityDAOImpl

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy

        Policy.Arg
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAuthority​(java.util.Collection<java.lang.String> parentNames, java.lang.String childName)
      Add a child authority to the given parent authorities
      protected void addAuthorityNameIfMatches​(java.util.Set<java.lang.String> authorities, java.lang.String authorityName, org.alfresco.service.cmr.security.AuthorityType type)  
      protected void addAuthorityNameIfMatches​(java.util.Set<java.lang.String> authorities, java.lang.String authorityName, org.alfresco.service.cmr.security.AuthorityType type, java.util.regex.Pattern pattern)  
      void addAuthorityToZones​(java.lang.String authorityName, java.util.Set<java.lang.String> zones)
      Add an authority to zones
      void afterPropertiesSet()  
      boolean authorityExists​(java.lang.String name)
      Test if an authority already exists.
      void beforeDeleteNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Listen out for person removals so that we can clear cached authorities.
      void createAuthority​(java.lang.String name, java.lang.String authorityDisplayName, java.util.Set<java.lang.String> authorityZones)
      Create an authority.
      void deleteAuthority​(java.lang.String name)
      Delete an authority.
      java.util.Set<java.lang.String> findAuthorities​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String parentAuthority, boolean immediate, java.lang.String displayNamePattern, java.lang.String zoneName)
      Find authorities by display name pattern.
      java.util.Set<java.lang.String> getAllAuthoritiesInZone​(java.lang.String zoneName, org.alfresco.service.cmr.security.AuthorityType type)
      Gets the names of all authorities in a zone, optionally filtered by type.
      org.alfresco.query.PagingResults<java.lang.String> getAuthorities​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String zoneName, java.lang.String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, org.alfresco.query.PagingRequest pagingRequest)
      Get authority names by type and/or zone (both cannot be null).
      org.alfresco.query.PagingResults<AuthorityInfo> getAuthoritiesInfo​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String zoneName, java.lang.String displayNameFilter, java.lang.String sortBy, boolean sortAscending, org.alfresco.query.PagingRequest pagingRequest)
      Get AuthorityInfo by type and/or zone (both cannot be null).
      java.lang.String getAuthorityDisplayName​(java.lang.String authorityName)
      Get the display name for an authority
      java.lang.String getAuthorityName​(org.alfresco.service.cmr.repository.NodeRef authorityRef)
      Gets the name for the given authority node
      org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRefOrNull​(java.lang.String name)
      Get a node ref for the authority if one exists
      java.util.Set<java.lang.String> getAuthorityZones​(java.lang.String name)
      Gets the name of the zone containing the specified authority.
      java.lang.String getCacheId()  
      java.util.Set<java.lang.String> getContainedAuthorities​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String parentName, boolean immediate)
      Get contained authorities.
      java.util.Set<java.lang.String> getContainingAuthorities​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String name, boolean immediate)
      Get the authorities that contain the one given.
      java.util.Set<java.lang.String> getContainingAuthoritiesInZone​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String authority, java.lang.String zoneName, AuthorityService.AuthorityFilter filter, int size)
      Get a set of authorities with varying filter criteria
      long getGroupCount()
      Count groups i.e.
      java.lang.String getName​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String shortName)
      Create the full identifier for an authority given its short name and type.
      org.alfresco.service.cmr.repository.NodeRef getOrCreateZone​(java.lang.String zoneName)
      Gets or creates an authority zone node with the specified name
      long getPersonCount()
      Count people i.e.
      java.util.Set<java.lang.String> getRootAuthorities​(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String zoneName)
      Get root authorities
      java.lang.String getShortName​(java.lang.String name)
      Extract the short name of an authority from its full identifier.
      org.alfresco.service.cmr.repository.NodeRef getZone​(java.lang.String zoneName)
      Gets an authority zone node with the specified name
      void init()  
      boolean isAuthorityContained​(java.lang.String authority, java.lang.String authorityToFind, java.util.Set<java.lang.String> positiveHits, java.util.Set<java.lang.String> negativeHits)  
      void onRefreshableCacheEvent​(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)  
      void onUpdateProperties​(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> after)
      Called after a node's properties have been changed.
      void removeAuthority​(java.lang.String parentName, java.lang.String childName)
      Remove an authority.
      void removeAuthority​(java.lang.String parentName, java.lang.String childName, boolean cacheRefresh)
      Remove an authority without authorityBridgeTableCache refresh.
      void removeAuthorityFromZones​(java.lang.String authorityName, java.util.Set<java.lang.String> zones)
      Remove an authority from zones.
      void setAclDAO​(AclDAO aclDao)  
      void setAuthorityBridgeDAO​(AuthorityBridgeDAO authorityBridgeDAO)  
      void setAuthorityBridgeTableCache​(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache)  
      void setAuthorityDisplayName​(java.lang.String authorityName, java.lang.String authorityDisplayName)
      Set the display name for an authority
      void setAuthorityLookupCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​org.alfresco.service.cmr.repository.NodeRef> authorityLookupCache)  
      void setCannedQueryDAO​(CannedQueryDAO cannedQueryDAO)  
      void setCannedQueryRegistry​(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<?>> cannedQueryRegistry)  
      void setChildAuthorityCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.service.cmr.repository.NodeRef,​org.alfresco.util.Pair<java.util.Map<org.alfresco.service.cmr.repository.NodeRef,​java.lang.String>,​java.util.List<org.alfresco.service.cmr.repository.NodeRef>>> childAuthorityCache)  
      void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)  
      void setFindAuthoritiesLimit​(int findAuthoritiesLimit)  
      void setNamespacePrefixResolver​(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)  
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)  
      void setPersonService​(PersonService personService)  
      void setPolicyComponent​(PolicyComponent policyComponent)  
      void setQnameDAO​(QNameDAO qnameDAO)  
      void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)  
      void setSingletonCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.lang.Object> singletonCache)  
      void setStoreUrl​(java.lang.String storeUrl)  
      void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)  
      void setUseBridgeTable​(boolean useBridgeTable)  
      void setUserAuthorityCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.util.Set<java.lang.String>> userAuthorityCache)  
      void setZoneAuthorityCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef>> zoneAuthorityCache)  
      void setZoneAuthoritySampleSize​(int zoneAuthoritySampleSize)
      Sets number of authorities in a zone to pre-cache, allowing quick generation of 'first n' results and adaption of search technique based on hit rate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AuthorityDAOImpl

        public AuthorityDAOImpl()
    • Method Detail

      • setZoneAuthoritySampleSize

        public void setZoneAuthoritySampleSize​(int zoneAuthoritySampleSize)
        Sets number of authorities in a zone to pre-cache, allowing quick generation of 'first n' results and adaption of search technique based on hit rate.
        Parameters:
        zoneAuthoritySampleSize - the zoneAuthoritySampleSize to set
      • setStoreUrl

        public void setStoreUrl​(java.lang.String storeUrl)
      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
      • setNamespacePrefixResolver

        public void setNamespacePrefixResolver​(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      • setSearchService

        public void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)
      • setAuthorityLookupCache

        public void setAuthorityLookupCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​org.alfresco.service.cmr.repository.NodeRef> authorityLookupCache)
      • setUserAuthorityCache

        public void setUserAuthorityCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.util.Set<java.lang.String>> userAuthorityCache)
      • setZoneAuthorityCache

        public void setZoneAuthorityCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​java.util.List<org.alfresco.service.cmr.repository.ChildAssociationRef>> zoneAuthorityCache)
      • setChildAuthorityCache

        public void setChildAuthorityCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.service.cmr.repository.NodeRef,​org.alfresco.util.Pair<java.util.Map<org.alfresco.service.cmr.repository.NodeRef,​java.lang.String>,​java.util.List<org.alfresco.service.cmr.repository.NodeRef>>> childAuthorityCache)
      • setUseBridgeTable

        public void setUseBridgeTable​(boolean useBridgeTable)
        Parameters:
        useBridgeTable - the useBridgeTable to set
      • setPersonService

        public void setPersonService​(PersonService personService)
      • setTenantService

        public void setTenantService​(org.alfresco.repo.tenant.TenantService tenantService)
      • setSingletonCache

        public void setSingletonCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.lang.Object> singletonCache)
      • setQnameDAO

        public void setQnameDAO​(QNameDAO qnameDAO)
      • setCannedQueryDAO

        public void setCannedQueryDAO​(CannedQueryDAO cannedQueryDAO)
      • setAclDAO

        public void setAclDAO​(AclDAO aclDao)
      • setPolicyComponent

        public void setPolicyComponent​(PolicyComponent policyComponent)
      • setCannedQueryRegistry

        public void setCannedQueryRegistry​(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<?>> cannedQueryRegistry)
      • setAuthorityBridgeDAO

        public void setAuthorityBridgeDAO​(AuthorityBridgeDAO authorityBridgeDAO)
        Parameters:
        authorityBridgeDAO - the authorityBridgeDAO to set
      • setFindAuthoritiesLimit

        public void setFindAuthoritiesLimit​(int findAuthoritiesLimit)
      • getPersonCount

        public long getPersonCount()
        Description copied from interface: AuthorityDAO
        Count people i.e. nodes of type cm:person.
        Specified by:
        getPersonCount in interface AuthorityDAO
        Returns:
        the number of people
      • getGroupCount

        public long getGroupCount()
        Description copied from interface: AuthorityDAO
        Count groups i.e. nodes of type cm:authorityContainer.
        Specified by:
        getGroupCount in interface AuthorityDAO
        Returns:
        the number of groups
      • authorityExists

        public boolean authorityExists​(java.lang.String name)
        Description copied from interface: AuthorityDAO
        Test if an authority already exists.
        Specified by:
        authorityExists in interface AuthorityDAO
      • addAuthority

        public void addAuthority​(java.util.Collection<java.lang.String> parentNames,
                                 java.lang.String childName)
        Description copied from interface: AuthorityDAO
        Add a child authority to the given parent authorities
        Specified by:
        addAuthority in interface AuthorityDAO
      • createAuthority

        public void createAuthority​(java.lang.String name,
                                    java.lang.String authorityDisplayName,
                                    java.util.Set<java.lang.String> authorityZones)
        Description copied from interface: AuthorityDAO
        Create an authority.
        Specified by:
        createAuthority in interface AuthorityDAO
      • deleteAuthority

        public void deleteAuthority​(java.lang.String name)
        Description copied from interface: AuthorityDAO
        Delete an authority.
        Specified by:
        deleteAuthority in interface AuthorityDAO
      • getAuthoritiesInfo

        public org.alfresco.query.PagingResults<AuthorityInfo> getAuthoritiesInfo​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                                  java.lang.String zoneName,
                                                                                  java.lang.String displayNameFilter,
                                                                                  java.lang.String sortBy,
                                                                                  boolean sortAscending,
                                                                                  org.alfresco.query.PagingRequest pagingRequest)
        Description copied from interface: AuthorityDAO
        Get AuthorityInfo by type and/or zone (both cannot be null).
        Specified by:
        getAuthoritiesInfo in interface AuthorityDAO
        sortBy - either "displayName", "shortName", "authorityName" or null if no sorting.
      • getAuthorities

        public org.alfresco.query.PagingResults<java.lang.String> getAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                                 java.lang.String zoneName,
                                                                                 java.lang.String displayNameFilter,
                                                                                 boolean sortByDisplayName,
                                                                                 boolean sortAscending,
                                                                                 org.alfresco.query.PagingRequest pagingRequest)
        Description copied from interface: AuthorityDAO
        Get authority names by type and/or zone (both cannot be null).
        Specified by:
        getAuthorities in interface AuthorityDAO
      • getRootAuthorities

        public java.util.Set<java.lang.String> getRootAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                  java.lang.String zoneName)
        Description copied from interface: AuthorityDAO
        Get root authorities
        Specified by:
        getRootAuthorities in interface AuthorityDAO
      • findAuthorities

        public java.util.Set<java.lang.String> findAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                               java.lang.String parentAuthority,
                                                               boolean immediate,
                                                               java.lang.String displayNamePattern,
                                                               java.lang.String zoneName)
        Description copied from interface: AuthorityDAO
        Find authorities by display name pattern.
        Specified by:
        findAuthorities in interface AuthorityDAO
        parentAuthority - if non-null, will look only for authorities who are a child of the named parent
        immediate - if true then only search root groups if parentAuthority is null, or immediate children of parentAuthority if it is non-null.
        zoneName - - may be null to indicate all zones
      • getContainedAuthorities

        public java.util.Set<java.lang.String> getContainedAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                       java.lang.String parentName,
                                                                       boolean immediate)
        Description copied from interface: AuthorityDAO
        Get contained authorities.
        Specified by:
        getContainedAuthorities in interface AuthorityDAO
        parentName - the name of the containing authority
      • removeAuthority

        public void removeAuthority​(java.lang.String parentName,
                                    java.lang.String childName)
        Description copied from interface: AuthorityDAO
        Remove an authority.
        Specified by:
        removeAuthority in interface AuthorityDAO
      • removeAuthority

        public void removeAuthority​(java.lang.String parentName,
                                    java.lang.String childName,
                                    boolean cacheRefresh)
        Description copied from interface: AuthorityDAO
        Remove an authority without authorityBridgeTableCache refresh.
        Specified by:
        removeAuthority in interface AuthorityDAO
      • getContainingAuthorities

        public java.util.Set<java.lang.String> getContainingAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                        java.lang.String name,
                                                                        boolean immediate)
        Description copied from interface: AuthorityDAO
        Get the authorities that contain the one given.
        Specified by:
        getContainingAuthorities in interface AuthorityDAO
      • getContainingAuthoritiesInZone

        public java.util.Set<java.lang.String> getContainingAuthoritiesInZone​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                              java.lang.String authority,
                                                                              java.lang.String zoneName,
                                                                              AuthorityService.AuthorityFilter filter,
                                                                              int size)
        Description copied from interface: AuthorityDAO
        Get a set of authorities with varying filter criteria
        Specified by:
        getContainingAuthoritiesInZone in interface AuthorityDAO
        Parameters:
        type - authority type or null for all types
        authority - if non-null, only return those authorities who contain this authority
        zoneName - if non-null, only include authorities in the named zone
        filter - optional callback to apply further filter criteria or null
        size - if greater than zero, the maximum results to return. The search strategy used is varied depending on this number.
        Returns:
        a set of authorities
      • getShortName

        public java.lang.String getShortName​(java.lang.String name)
        Description copied from interface: AuthorityDAO
        Extract the short name of an authority from its full identifier.
        Specified by:
        getShortName in interface AuthorityDAO
      • getName

        public java.lang.String getName​(org.alfresco.service.cmr.security.AuthorityType type,
                                        java.lang.String shortName)
        Description copied from interface: AuthorityDAO
        Create the full identifier for an authority given its short name and type.
        Specified by:
        getName in interface AuthorityDAO
      • addAuthorityNameIfMatches

        protected void addAuthorityNameIfMatches​(java.util.Set<java.lang.String> authorities,
                                                 java.lang.String authorityName,
                                                 org.alfresco.service.cmr.security.AuthorityType type)
      • addAuthorityNameIfMatches

        protected void addAuthorityNameIfMatches​(java.util.Set<java.lang.String> authorities,
                                                 java.lang.String authorityName,
                                                 org.alfresco.service.cmr.security.AuthorityType type,
                                                 java.util.regex.Pattern pattern)
      • isAuthorityContained

        public boolean isAuthorityContained​(java.lang.String authority,
                                            java.lang.String authorityToFind,
                                            java.util.Set<java.lang.String> positiveHits,
                                            java.util.Set<java.lang.String> negativeHits)
        Specified by:
        isAuthorityContained in interface AuthorityDAO
      • getAuthorityNodeRefOrNull

        public org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRefOrNull​(java.lang.String name)
        Description copied from interface: AuthorityDAO
        Get a node ref for the authority if one exists
        Specified by:
        getAuthorityNodeRefOrNull in interface AuthorityDAO
      • getAuthorityName

        public java.lang.String getAuthorityName​(org.alfresco.service.cmr.repository.NodeRef authorityRef)
        Description copied from interface: AuthorityDAO
        Gets the name for the given authority node
        Specified by:
        getAuthorityName in interface AuthorityDAO
        Parameters:
        authorityRef - authority node
      • getAuthorityDisplayName

        public java.lang.String getAuthorityDisplayName​(java.lang.String authorityName)
        Description copied from interface: AuthorityDAO
        Get the display name for an authority
        Specified by:
        getAuthorityDisplayName in interface AuthorityDAO
        Returns:
        the display name
      • setAuthorityDisplayName

        public void setAuthorityDisplayName​(java.lang.String authorityName,
                                            java.lang.String authorityDisplayName)
        Description copied from interface: AuthorityDAO
        Set the display name for an authority
        Specified by:
        setAuthorityDisplayName in interface AuthorityDAO
      • getOrCreateZone

        public org.alfresco.service.cmr.repository.NodeRef getOrCreateZone​(java.lang.String zoneName)
        Description copied from interface: AuthorityDAO
        Gets or creates an authority zone node with the specified name
        Specified by:
        getOrCreateZone in interface AuthorityDAO
        Parameters:
        zoneName - the zone name
        Returns:
        reference to the zone node
      • getZone

        public org.alfresco.service.cmr.repository.NodeRef getZone​(java.lang.String zoneName)
        Description copied from interface: AuthorityDAO
        Gets an authority zone node with the specified name
        Specified by:
        getZone in interface AuthorityDAO
        Parameters:
        zoneName - the zone name
        Returns:
        reference to the zone node ot null if the zone does not exists
      • getAuthorityZones

        public java.util.Set<java.lang.String> getAuthorityZones​(java.lang.String name)
        Description copied from interface: AuthorityDAO
        Gets the name of the zone containing the specified authority.
        Specified by:
        getAuthorityZones in interface AuthorityDAO
        Parameters:
        name - the authority long name
        Returns:
        the set of names of all zones containing the specified authority, an empty set if the authority exists but has no zone, or null if the authority does not exist.
      • getAllAuthoritiesInZone

        public java.util.Set<java.lang.String> getAllAuthoritiesInZone​(java.lang.String zoneName,
                                                                       org.alfresco.service.cmr.security.AuthorityType type)
        Description copied from interface: AuthorityDAO
        Gets the names of all authorities in a zone, optionally filtered by type.
        Specified by:
        getAllAuthoritiesInZone in interface AuthorityDAO
        Parameters:
        zoneName - the zone name
        type - the authority type to filter by or null for all authority types
        Returns:
        the names of all authorities in a zone, optionally filtered by type
      • addAuthorityToZones

        public void addAuthorityToZones​(java.lang.String authorityName,
                                        java.util.Set<java.lang.String> zones)
        Description copied from interface: AuthorityDAO
        Add an authority to zones
        Specified by:
        addAuthorityToZones in interface AuthorityDAO
      • removeAuthorityFromZones

        public void removeAuthorityFromZones​(java.lang.String authorityName,
                                             java.util.Set<java.lang.String> zones)
        Description copied from interface: AuthorityDAO
        Remove an authority from zones.
        Specified by:
        removeAuthorityFromZones in interface AuthorityDAO
      • beforeDeleteNode

        public void beforeDeleteNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Listen out for person removals so that we can clear cached authorities.
        Specified by:
        beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
        Parameters:
        nodeRef - the node reference
      • onUpdateProperties

        public void onUpdateProperties​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                       java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> before,
                                       java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> after)
        Description copied from interface: NodeServicePolicies.OnUpdatePropertiesPolicy
        Called after a node's properties have been changed.
        Specified by:
        onUpdateProperties in interface NodeServicePolicies.OnUpdatePropertiesPolicy
        Parameters:
        nodeRef - reference to the updated node
        before - the node's properties before the change
        after - the node's properties after the change
      • init

        public void init()
      • onRefreshableCacheEvent

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

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

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