Class AuthorityDAOImpl
- java.lang.Object
-
- org.alfresco.repo.security.authority.AuthorityDAOImpl
-
- All Implemented Interfaces:
NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.OnUpdatePropertiesPolicy,ClassPolicy,Policy,AuthorityDAO,org.alfresco.util.cache.RefreshableCacheListener,org.springframework.beans.factory.InitializingBean
public class AuthorityDAOImpl extends java.lang.Object implements AuthorityDAO, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.util.cache.RefreshableCacheListener, org.springframework.beans.factory.InitializingBean
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
-
-
Field Summary
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME
-
-
Constructor Summary
Constructors Constructor Description AuthorityDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuthority(java.util.Collection<java.lang.String> parentNames, java.lang.String childName)Add a child authority to the given parent authoritiesprotected voidaddAuthorityNameIfMatches(java.util.Set<java.lang.String> authorities, java.lang.String authorityName, org.alfresco.service.cmr.security.AuthorityType type)protected voidaddAuthorityNameIfMatches(java.util.Set<java.lang.String> authorities, java.lang.String authorityName, org.alfresco.service.cmr.security.AuthorityType type, java.util.regex.Pattern pattern)voidaddAuthorityToZones(java.lang.String authorityName, java.util.Set<java.lang.String> zones)Add an authority to zonesvoidafterPropertiesSet()booleanauthorityExists(java.lang.String name)Test if an authority already exists.voidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)Listen out for person removals so that we can clear cached authorities.voidcreateAuthority(java.lang.String name, java.lang.String authorityDisplayName, java.util.Set<java.lang.String> authorityZones)Create an authority.voiddeleteAuthority(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.StringgetAuthorityDisplayName(java.lang.String authorityName)Get the display name for an authorityjava.lang.StringgetAuthorityName(org.alfresco.service.cmr.repository.NodeRef authorityRef)Gets the name for the given authority nodeorg.alfresco.service.cmr.repository.NodeRefgetAuthorityNodeRefOrNull(java.lang.String name)Get a node ref for the authority if one existsjava.util.Set<java.lang.String>getAuthorityZones(java.lang.String name)Gets the name of the zone containing the specified authority.java.lang.StringgetCacheId()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 criterialonggetGroupCount()Count groups i.e.java.lang.StringgetName(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.NodeRefgetOrCreateZone(java.lang.String zoneName)Gets or creates an authority zone node with the specified namelonggetPersonCount()Count people i.e.java.util.Set<java.lang.String>getRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String zoneName)Get root authoritiesjava.lang.StringgetShortName(java.lang.String name)Extract the short name of an authority from its full identifier.org.alfresco.service.cmr.repository.NodeRefgetZone(java.lang.String zoneName)Gets an authority zone node with the specified namevoidinit()booleanisAuthorityContained(java.lang.String authority, java.lang.String authorityToFind, java.util.Set<java.lang.String> positiveHits, java.util.Set<java.lang.String> negativeHits)voidonRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)voidonUpdateProperties(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.voidremoveAuthority(java.lang.String parentName, java.lang.String childName)Remove an authority.voidremoveAuthority(java.lang.String parentName, java.lang.String childName, boolean cacheRefresh)Remove an authority without authorityBridgeTableCache refresh.voidremoveAuthorityFromZones(java.lang.String authorityName, java.util.Set<java.lang.String> zones)Remove an authority from zones.voidsetAclDAO(AclDAO aclDao)voidsetAuthorityBridgeDAO(AuthorityBridgeDAO authorityBridgeDAO)voidsetAuthorityBridgeTableCache(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache)voidsetAuthorityDisplayName(java.lang.String authorityName, java.lang.String authorityDisplayName)Set the display name for an authorityvoidsetAuthorityLookupCache(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,java.lang.String>,org.alfresco.service.cmr.repository.NodeRef> authorityLookupCache)voidsetCannedQueryDAO(CannedQueryDAO cannedQueryDAO)voidsetCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<?>> cannedQueryRegistry)voidsetChildAuthorityCache(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)voidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)voidsetFindAuthoritiesLimit(int findAuthoritiesLimit)voidsetNamespacePrefixResolver(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPersonService(PersonService personService)voidsetPolicyComponent(PolicyComponent policyComponent)voidsetQnameDAO(QNameDAO qnameDAO)voidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)voidsetSingletonCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,java.lang.Object> singletonCache)voidsetStoreUrl(java.lang.String storeUrl)voidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)voidsetUseBridgeTable(boolean useBridgeTable)voidsetUserAuthorityCache(org.alfresco.repo.cache.SimpleCache<java.lang.String,java.util.Set<java.lang.String>> userAuthorityCache)voidsetZoneAuthorityCache(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)voidsetZoneAuthoritySampleSize(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.
-
-
-
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)
-
setAuthorityBridgeTableCache
public void setAuthorityBridgeTableCache(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache)
-
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:AuthorityDAOCount people i.e. nodes oftype cm:person.- Specified by:
getPersonCountin interfaceAuthorityDAO- Returns:
- the number of people
-
getGroupCount
public long getGroupCount()
Description copied from interface:AuthorityDAOCount groups i.e. nodes oftype cm:authorityContainer.- Specified by:
getGroupCountin interfaceAuthorityDAO- Returns:
- the number of groups
-
authorityExists
public boolean authorityExists(java.lang.String name)
Description copied from interface:AuthorityDAOTest if an authority already exists.- Specified by:
authorityExistsin interfaceAuthorityDAO
-
addAuthority
public void addAuthority(java.util.Collection<java.lang.String> parentNames, java.lang.String childName)Description copied from interface:AuthorityDAOAdd a child authority to the given parent authorities- Specified by:
addAuthorityin interfaceAuthorityDAO
-
createAuthority
public void createAuthority(java.lang.String name, java.lang.String authorityDisplayName, java.util.Set<java.lang.String> authorityZones)Description copied from interface:AuthorityDAOCreate an authority.- Specified by:
createAuthorityin interfaceAuthorityDAO
-
deleteAuthority
public void deleteAuthority(java.lang.String name)
Description copied from interface:AuthorityDAODelete an authority.- Specified by:
deleteAuthorityin interfaceAuthorityDAO
-
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:AuthorityDAOGet AuthorityInfo by type and/or zone (both cannot be null).- Specified by:
getAuthoritiesInfoin interfaceAuthorityDAOsortBy- 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:AuthorityDAOGet authority names by type and/or zone (both cannot be null).- Specified by:
getAuthoritiesin interfaceAuthorityDAO
-
getRootAuthorities
public java.util.Set<java.lang.String> getRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String zoneName)Description copied from interface:AuthorityDAOGet root authorities- Specified by:
getRootAuthoritiesin interfaceAuthorityDAO
-
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:AuthorityDAOFind authorities by display name pattern.- Specified by:
findAuthoritiesin interfaceAuthorityDAOparentAuthority- if non-null, will look only for authorities who are a child of the named parentimmediate- iftruethen 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:AuthorityDAOGet contained authorities.- Specified by:
getContainedAuthoritiesin interfaceAuthorityDAOparentName- the name of the containing authority
-
removeAuthority
public void removeAuthority(java.lang.String parentName, java.lang.String childName)Description copied from interface:AuthorityDAORemove an authority.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
removeAuthority
public void removeAuthority(java.lang.String parentName, java.lang.String childName, boolean cacheRefresh)Description copied from interface:AuthorityDAORemove an authority without authorityBridgeTableCache refresh.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
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:AuthorityDAOGet the authorities that contain the one given.- Specified by:
getContainingAuthoritiesin interfaceAuthorityDAO
-
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:AuthorityDAOGet a set of authorities with varying filter criteria- Specified by:
getContainingAuthoritiesInZonein interfaceAuthorityDAO- Parameters:
type- authority type or null for all typesauthority- if non-null, only return those authorities who contain this authorityzoneName- if non-null, only include authorities in the named zonefilter- optional callback to apply further filter criteria or nullsize- 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:AuthorityDAOExtract the short name of an authority from its full identifier.- Specified by:
getShortNamein interfaceAuthorityDAO
-
getName
public java.lang.String getName(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String shortName)Description copied from interface:AuthorityDAOCreate the full identifier for an authority given its short name and type.- Specified by:
getNamein interfaceAuthorityDAO
-
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:
isAuthorityContainedin interfaceAuthorityDAO
-
getAuthorityNodeRefOrNull
public org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRefOrNull(java.lang.String name)
Description copied from interface:AuthorityDAOGet a node ref for the authority if one exists- Specified by:
getAuthorityNodeRefOrNullin interfaceAuthorityDAO
-
getAuthorityName
public java.lang.String getAuthorityName(org.alfresco.service.cmr.repository.NodeRef authorityRef)
Description copied from interface:AuthorityDAOGets the name for the given authority node- Specified by:
getAuthorityNamein interfaceAuthorityDAO- Parameters:
authorityRef- authority node
-
getAuthorityDisplayName
public java.lang.String getAuthorityDisplayName(java.lang.String authorityName)
Description copied from interface:AuthorityDAOGet the display name for an authority- Specified by:
getAuthorityDisplayNamein interfaceAuthorityDAO- Returns:
- the display name
-
setAuthorityDisplayName
public void setAuthorityDisplayName(java.lang.String authorityName, java.lang.String authorityDisplayName)Description copied from interface:AuthorityDAOSet the display name for an authority- Specified by:
setAuthorityDisplayNamein interfaceAuthorityDAO
-
getOrCreateZone
public org.alfresco.service.cmr.repository.NodeRef getOrCreateZone(java.lang.String zoneName)
Description copied from interface:AuthorityDAOGets or creates an authority zone node with the specified name- Specified by:
getOrCreateZonein interfaceAuthorityDAO- 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:AuthorityDAOGets an authority zone node with the specified name- Specified by:
getZonein interfaceAuthorityDAO- 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:AuthorityDAOGets the name of the zone containing the specified authority.- Specified by:
getAuthorityZonesin interfaceAuthorityDAO- 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
nullif 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:AuthorityDAOGets the names of all authorities in a zone, optionally filtered by type.- Specified by:
getAllAuthoritiesInZonein interfaceAuthorityDAO- Parameters:
zoneName- the zone nametype- the authority type to filter by ornullfor 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:AuthorityDAOAdd an authority to zones- Specified by:
addAuthorityToZonesin interfaceAuthorityDAO
-
removeAuthorityFromZones
public void removeAuthorityFromZones(java.lang.String authorityName, java.util.Set<java.lang.String> zones)Description copied from interface:AuthorityDAORemove an authority from zones.- Specified by:
removeAuthorityFromZonesin interfaceAuthorityDAO
-
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:
beforeDeleteNodein interfaceNodeServicePolicies.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.OnUpdatePropertiesPolicyCalled after a node's properties have been changed.- Specified by:
onUpdatePropertiesin interfaceNodeServicePolicies.OnUpdatePropertiesPolicy- Parameters:
nodeRef- reference to the updated nodebefore- the node's properties before the changeafter- the node's properties after the change
-
init
public void init()
-
onRefreshableCacheEvent
public void onRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent)
- Specified by:
onRefreshableCacheEventin interfaceorg.alfresco.util.cache.RefreshableCacheListener
-
getCacheId
public java.lang.String getCacheId()
- Specified by:
getCacheIdin interfaceorg.alfresco.util.cache.RefreshableCacheListener
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
-