Class AuthorityDAOImpl

    • 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​(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<String,​String>,​org.alfresco.service.cmr.repository.NodeRef> authorityLookupCache)
      • setUserAuthorityCache

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

        public void setZoneAuthorityCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<String,​String>,​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<Map<org.alfresco.service.cmr.repository.NodeRef,​String>,​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<String,​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
      • getAuthoritiesInfo

        public org.alfresco.query.PagingResults<AuthorityInfo> getAuthoritiesInfo​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                                  String zoneName,
                                                                                  String displayNameFilter,
                                                                                  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<String> getAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                                       String zoneName,
                                                                       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
      • findAuthorities

        public Set<String> findAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                           String parentAuthority,
                                           boolean immediate,
                                           String displayNamePattern,
                                           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 Set<String> getContainedAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                   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​(String parentName,
                                    String childName,
                                    boolean cacheRefresh)
        Description copied from interface: AuthorityDAO
        Remove an authority without authorityBridgeTableCache refresh.
        Specified by:
        removeAuthority in interface AuthorityDAO
      • getContainingAuthorities

        public Set<String> getContainingAuthorities​(org.alfresco.service.cmr.security.AuthorityType type,
                                                    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 Set<String> getContainingAuthoritiesInZone​(org.alfresco.service.cmr.security.AuthorityType type,
                                                          String authority,
                                                          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
      • getName

        public String getName​(org.alfresco.service.cmr.security.AuthorityType type,
                              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​(Set<String> authorities,
                                                 String authorityName,
                                                 org.alfresco.service.cmr.security.AuthorityType type)
      • addAuthorityNameIfMatches

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

        public org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRefOrNull​(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 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
      • getOrCreateZone

        public org.alfresco.service.cmr.repository.NodeRef getOrCreateZone​(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​(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 Set<String> getAuthorityZones​(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 Set<String> getAllAuthoritiesInZone​(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
      • 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
      • 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 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