Class AuthorityDAOImpl
- java.lang.Object
-
- org.alfresco.repo.security.authority.AuthorityDAOImpl
-
- All Implemented Interfaces:
NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.OnUpdatePropertiesPolicy,ClassPolicy,Policy,AuthorityDAO,RefreshableCacheListener,org.springframework.beans.factory.InitializingBean
public class AuthorityDAOImpl extends Object implements AuthorityDAO, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, 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(Collection<String> parentNames, String childName)Add a child authority to the given parent authoritiesprotected voidaddAuthorityNameIfMatches(Set<String> authorities, String authorityName, AuthorityType type)protected voidaddAuthorityNameIfMatches(Set<String> authorities, String authorityName, AuthorityType type, Pattern pattern)voidaddAuthorityToZones(String authorityName, Set<String> zones)Add an authority to zonesvoidafterPropertiesSet()booleanauthorityExists(String name)Test if an authority already exists.voidbeforeDeleteNode(NodeRef nodeRef)Listen out for person removals so that we can clear cached authorities.voidcreateAuthority(String name, String authorityDisplayName, Set<String> authorityZones)Create an authority.voiddeleteAuthority(String name)Delete an authority.Set<String>findAuthorities(AuthorityType type, String parentAuthority, boolean immediate, String displayNamePattern, String zoneName)Find authorities by display name pattern.Set<String>getAllAuthoritiesInZone(String zoneName, AuthorityType type)Gets the names of all authorities in a zone, optionally filtered by type.PagingResults<String>getAuthorities(AuthorityType type, String zoneName, String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, PagingRequest pagingRequest)Get authority names by type and/or zone (both cannot be null).PagingResults<AuthorityInfo>getAuthoritiesInfo(AuthorityType type, String zoneName, String displayNameFilter, String sortBy, boolean sortAscending, PagingRequest pagingRequest)Get AuthorityInfo by type and/or zone (both cannot be null).StringgetAuthorityDisplayName(String authorityName)Get the display name for an authorityStringgetAuthorityName(NodeRef authorityRef)Gets the name for the given authority nodeNodeRefgetAuthorityNodeRefOrNull(String name)Get a node ref for the authority if one existsSet<String>getAuthorityZones(String name)Gets the name of the zone containing the specified authority.StringgetCacheId()Set<String>getContainedAuthorities(AuthorityType type, String parentName, boolean immediate)Get contained authorities.Set<String>getContainingAuthorities(AuthorityType type, String name, boolean immediate)Get the authorities that contain the one given.Set<String>getContainingAuthoritiesInZone(AuthorityType type, String authority, String zoneName, AuthorityService.AuthorityFilter filter, int size)Get a set of authorities with varying filter criterialonggetGroupCount()Count groups i.e.StringgetName(AuthorityType type, String shortName)Create the full identifier for an authority given its short name and type.NodeRefgetOrCreateZone(String zoneName)Gets or creates an authority zone node with the specified namelonggetPersonCount()Count people i.e.Set<String>getRootAuthorities(AuthorityType type, String zoneName)Get root authoritiesStringgetShortName(String name)Extract the short name of an authority from its full identifier.NodeRefgetZone(String zoneName)Gets an authority zone node with the specified namevoidinit()booleanisAuthorityContained(String authority, String authorityToFind, Set<String> positiveHits, Set<String> negativeHits)voidonCreateNode(ChildAssociationRef childAssocRef)voidonRefreshableCacheEvent(RefreshableCacheEvent refreshableCacheEvent)voidonUpdateProperties(NodeRef nodeRef, Map<QName,Serializable> before, Map<QName,Serializable> after)Called after a node's properties have been changed.voidremoveAuthority(String parentName, String childName)Remove an authority.voidremoveAuthority(String parentName, String childName, boolean cacheRefresh)Remove an authority without authorityBridgeTableCache refresh.voidremoveAuthorityFromZones(String authorityName, Set<String> zones)Remove an authority from zones.voidsetAclDAO(AclDAO aclDao)voidsetAuthorityBridgeDAO(AuthorityBridgeDAO authorityBridgeDAO)voidsetAuthorityBridgeTableCache(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache)voidsetAuthorityDisplayName(String authorityName, String authorityDisplayName)Set the display name for an authorityvoidsetAuthorityLookupCache(SimpleCache<Pair<String,String>,NodeRef> authorityLookupCache)voidsetCannedQueryDAO(CannedQueryDAO cannedQueryDAO)voidsetCannedQueryRegistry(NamedObjectRegistry<CannedQueryFactory<?>> cannedQueryRegistry)voidsetChildAuthorityCache(SimpleCache<NodeRef,Pair<Map<NodeRef,String>,List<NodeRef>>> childAuthorityCache)voidsetDictionaryService(DictionaryService dictionaryService)voidsetFindAuthoritiesLimit(int findAuthoritiesLimit)voidsetNamespacePrefixResolver(NamespacePrefixResolver namespacePrefixResolver)voidsetNodeService(NodeService nodeService)voidsetPersonService(PersonService personService)voidsetPolicyComponent(PolicyComponent policyComponent)voidsetQnameDAO(QNameDAO qnameDAO)voidsetSearchService(SearchService searchService)voidsetSingletonCache(SimpleCache<String,Object> singletonCache)voidsetStoreUrl(String storeUrl)voidsetTenantService(TenantService tenantService)voidsetUseBridgeTable(boolean useBridgeTable)voidsetUserAuthorityCache(SimpleCache<String,Set<String>> userAuthorityCache)voidsetZoneAuthorityCache(SimpleCache<Pair<String,String>,List<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(String storeUrl)
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
-
setNamespacePrefixResolver
public void setNamespacePrefixResolver(NamespacePrefixResolver namespacePrefixResolver)
-
setNodeService
public void setNodeService(NodeService nodeService)
-
setSearchService
public void setSearchService(SearchService searchService)
-
setAuthorityLookupCache
public void setAuthorityLookupCache(SimpleCache<Pair<String,String>,NodeRef> authorityLookupCache)
-
setUserAuthorityCache
public void setUserAuthorityCache(SimpleCache<String,Set<String>> userAuthorityCache)
-
setZoneAuthorityCache
public void setZoneAuthorityCache(SimpleCache<Pair<String,String>,List<ChildAssociationRef>> zoneAuthorityCache)
-
setChildAuthorityCache
public void setChildAuthorityCache(SimpleCache<NodeRef,Pair<Map<NodeRef,String>,List<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(TenantService tenantService)
-
setSingletonCache
public void setSingletonCache(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(NamedObjectRegistry<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(String name)
Description copied from interface:AuthorityDAOTest if an authority already exists.- Specified by:
authorityExistsin interfaceAuthorityDAO
-
addAuthority
public void addAuthority(Collection<String> parentNames, String childName)
Description copied from interface:AuthorityDAOAdd a child authority to the given parent authorities- Specified by:
addAuthorityin interfaceAuthorityDAO
-
createAuthority
public void createAuthority(String name, String authorityDisplayName, Set<String> authorityZones)
Description copied from interface:AuthorityDAOCreate an authority.- Specified by:
createAuthorityin interfaceAuthorityDAO
-
deleteAuthority
public void deleteAuthority(String name)
Description copied from interface:AuthorityDAODelete an authority.- Specified by:
deleteAuthorityin interfaceAuthorityDAO
-
getAuthoritiesInfo
public PagingResults<AuthorityInfo> getAuthoritiesInfo(AuthorityType type, String zoneName, String displayNameFilter, String sortBy, boolean sortAscending, 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 PagingResults<String> getAuthorities(AuthorityType type, String zoneName, String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, PagingRequest pagingRequest)
Description copied from interface:AuthorityDAOGet authority names by type and/or zone (both cannot be null).- Specified by:
getAuthoritiesin interfaceAuthorityDAO
-
getRootAuthorities
public Set<String> getRootAuthorities(AuthorityType type, String zoneName)
Description copied from interface:AuthorityDAOGet root authorities- Specified by:
getRootAuthoritiesin interfaceAuthorityDAO
-
findAuthorities
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate, String displayNamePattern, 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 Set<String> getContainedAuthorities(AuthorityType type, 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(String parentName, String childName)
Description copied from interface:AuthorityDAORemove an authority.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
removeAuthority
public void removeAuthority(String parentName, String childName, boolean cacheRefresh)
Description copied from interface:AuthorityDAORemove an authority without authorityBridgeTableCache refresh.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
getContainingAuthorities
public Set<String> getContainingAuthorities(AuthorityType type, String name, boolean immediate)
Description copied from interface:AuthorityDAOGet the authorities that contain the one given.- Specified by:
getContainingAuthoritiesin interfaceAuthorityDAO
-
getContainingAuthoritiesInZone
public Set<String> getContainingAuthoritiesInZone(AuthorityType type, String authority, 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 String getShortName(String name)
Description copied from interface:AuthorityDAOExtract the short name of an authority from its full identifier.- Specified by:
getShortNamein interfaceAuthorityDAO
-
getName
public String getName(AuthorityType type, 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(Set<String> authorities, String authorityName, AuthorityType type)
-
addAuthorityNameIfMatches
protected void addAuthorityNameIfMatches(Set<String> authorities, String authorityName, AuthorityType type, Pattern pattern)
-
isAuthorityContained
public boolean isAuthorityContained(String authority, String authorityToFind, Set<String> positiveHits, Set<String> negativeHits)
- Specified by:
isAuthorityContainedin interfaceAuthorityDAO
-
getAuthorityNodeRefOrNull
public NodeRef getAuthorityNodeRefOrNull(String name)
Description copied from interface:AuthorityDAOGet a node ref for the authority if one exists- Specified by:
getAuthorityNodeRefOrNullin interfaceAuthorityDAO
-
getAuthorityName
public String getAuthorityName(NodeRef authorityRef)
Description copied from interface:AuthorityDAOGets the name for the given authority node- Specified by:
getAuthorityNamein interfaceAuthorityDAO- Parameters:
authorityRef- authority node
-
getAuthorityDisplayName
public String getAuthorityDisplayName(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(String authorityName, String authorityDisplayName)
Description copied from interface:AuthorityDAOSet the display name for an authority- Specified by:
setAuthorityDisplayNamein interfaceAuthorityDAO
-
getOrCreateZone
public NodeRef getOrCreateZone(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 NodeRef getZone(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 Set<String> getAuthorityZones(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 Set<String> getAllAuthoritiesInZone(String zoneName, 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(String authorityName, Set<String> zones)
Description copied from interface:AuthorityDAOAdd an authority to zones- Specified by:
addAuthorityToZonesin interfaceAuthorityDAO
-
removeAuthorityFromZones
public void removeAuthorityFromZones(String authorityName, Set<String> zones)
Description copied from interface:AuthorityDAORemove an authority from zones.- Specified by:
removeAuthorityFromZonesin interfaceAuthorityDAO
-
beforeDeleteNode
public void beforeDeleteNode(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(NodeRef nodeRef, Map<QName,Serializable> before, Map<QName,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
-
onCreateNode
public void onCreateNode(ChildAssociationRef childAssocRef)
-
init
public void init()
-
onRefreshableCacheEvent
public void onRefreshableCacheEvent(RefreshableCacheEvent refreshableCacheEvent)
- Specified by:
onRefreshableCacheEventin interfaceRefreshableCacheListener
-
getCacheId
public String getCacheId()
- Specified by:
getCacheIdin interfaceRefreshableCacheListener
-
-