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 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
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthority(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 zonesvoidbooleanauthorityExists(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.voidcreateAuthority(String name, String authorityDisplayName, Set<String> authorityZones, Map<QName, Serializable> properties) Create an authority with properties.voiddeleteAuthority(String name) Delete an authority.findAuthorities(AuthorityType type, String parentAuthority, boolean immediate, String displayNamePattern, String zoneName) Find authorities by display name pattern.getAllAuthoritiesInZone(String zoneName, AuthorityType type) Gets the names of all authorities in a zone, optionally filtered by type.org.alfresco.query.PagingResults<String>getAuthorities(AuthorityType type, String zoneName, 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(AuthorityType type, String zoneName, String displayNameFilter, String sortBy, boolean sortAscending, org.alfresco.query.PagingRequest pagingRequest) Get AuthorityInfo by type and/or zone (both cannot be null).getAuthorityDisplayName(String authorityName) Get the display name for an authoritygetAuthorityDisplayNameAndDescription(String authorityName) Get the display name and description for an authoritygetAuthorityName(NodeRef authorityRef) Gets the name for the given authority nodeGet a node ref for the authority if one existsgetAuthorityZones(String name) Gets the name of the zone containing the specified authority.getContainedAuthorities(AuthorityType type, String parentName, boolean immediate) Get contained authorities.getContainingAuthorities(AuthorityType type, String name, boolean immediate) Get the authorities that contain the one given.getContainingAuthoritiesInZone(AuthorityType type, String authority, String zoneName, AuthorityService.AuthorityFilter filter, int size) Get a set of authorities with varying filter criterialongCount groups i.e.getName(AuthorityType type, String shortName) Create the full identifier for an authority given its short name and type.getOrCreateZone(String zoneName) Gets or creates an authority zone node with the specified namelongCount people i.e.getRootAuthorities(AuthorityType type, String zoneName) Get root authoritiesgetShortName(String name) Extract the short name of an authority from its full identifier.Gets an authority zone node with the specified namevoidinit()booleanisAuthorityContained(String authority, String authorityToFind, Set<String> positiveHits, Set<String> negativeHits) voidonCreateNode(ChildAssociationRef childAssocRef) voidonRefreshableCacheEvent(org.alfresco.util.cache.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.voidvoidsetAuthorityBridgeDAO(AuthorityBridgeDAO authorityBridgeDAO) voidsetAuthorityBridgeTableCache(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache) voidsetAuthorityDisplayName(String authorityName, String authorityDisplayName) Set the display name for an authorityvoidsetAuthorityDisplayNameAndDescription(String authorityName, String authorityDisplayName, String description) Set the display name and description for an authorityvoidsetAuthorityLookupCache(SimpleCache<Pair<String, String>, NodeRef> authorityLookupCache) voidsetCannedQueryDAO(CannedQueryDAO cannedQueryDAO) voidsetCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.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.
-
Constructor Details
-
AuthorityDAOImpl
public AuthorityDAOImpl()
-
-
Method Details
-
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
-
setDictionaryService
-
setNamespacePrefixResolver
-
setNodeService
-
setSearchService
-
setAuthorityLookupCache
-
setUserAuthorityCache
-
setZoneAuthorityCache
public void setZoneAuthorityCache(SimpleCache<Pair<String, String>, List<ChildAssociationRef>> zoneAuthorityCache) -
setChildAuthorityCache
-
setAuthorityBridgeTableCache
public void setAuthorityBridgeTableCache(AuthorityBridgeTableAsynchronouslyRefreshedCache authorityBridgeTableCache) -
setUseBridgeTable
public void setUseBridgeTable(boolean useBridgeTable) - Parameters:
useBridgeTable- the useBridgeTable to set
-
setPersonService
-
setTenantService
-
setSingletonCache
-
setQnameDAO
-
setCannedQueryDAO
-
setAclDAO
-
setPolicyComponent
-
setCannedQueryRegistry
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<?>> cannedQueryRegistry) -
setAuthorityBridgeDAO
- 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
Description copied from interface:AuthorityDAOTest if an authority already exists.- Specified by:
authorityExistsin interfaceAuthorityDAO
-
addAuthority
Description copied from interface:AuthorityDAOAdd a child authority to the given parent authorities- Specified by:
addAuthorityin interfaceAuthorityDAO
-
createAuthority
Description copied from interface:AuthorityDAOCreate an authority.- Specified by:
createAuthorityin interfaceAuthorityDAO
-
createAuthority
public void createAuthority(String name, String authorityDisplayName, Set<String> authorityZones, Map<QName, Serializable> properties) Description copied from interface:AuthorityDAOCreate an authority with properties.- Specified by:
createAuthorityin interfaceAuthorityDAO
-
deleteAuthority
Description copied from interface:AuthorityDAODelete an authority.- Specified by:
deleteAuthorityin interfaceAuthorityDAO
-
getAuthoritiesInfo
public org.alfresco.query.PagingResults<AuthorityInfo> getAuthoritiesInfo(AuthorityType type, String zoneName, String displayNameFilter, 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<String> getAuthorities(AuthorityType type, String zoneName, 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
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
Description copied from interface:AuthorityDAORemove an authority.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
removeAuthority
Description copied from interface:AuthorityDAORemove an authority without authorityBridgeTableCache refresh.- Specified by:
removeAuthorityin interfaceAuthorityDAO
-
getContainingAuthorities
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
Description copied from interface:AuthorityDAOExtract the short name of an authority from its full identifier.- Specified by:
getShortNamein interfaceAuthorityDAO
-
getName
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
Description copied from interface:AuthorityDAOGet a node ref for the authority if one exists- Specified by:
getAuthorityNodeRefOrNullin interfaceAuthorityDAO
-
getAuthorityName
Description copied from interface:AuthorityDAOGets the name for the given authority node- Specified by:
getAuthorityNamein interfaceAuthorityDAO- Parameters:
authorityRef- authority node
-
getAuthorityDisplayName
Description copied from interface:AuthorityDAOGet the display name for an authority- Specified by:
getAuthorityDisplayNamein interfaceAuthorityDAO- Returns:
- the display name
-
setAuthorityDisplayName
Description copied from interface:AuthorityDAOSet the display name for an authority- Specified by:
setAuthorityDisplayNamein interfaceAuthorityDAO
-
getAuthorityDisplayNameAndDescription
Description copied from interface:AuthorityDAOGet the display name and description for an authority- Specified by:
getAuthorityDisplayNameAndDescriptionin interfaceAuthorityDAO- Returns:
- the display name and description
-
setAuthorityDisplayNameAndDescription
public void setAuthorityDisplayNameAndDescription(String authorityName, String authorityDisplayName, String description) Description copied from interface:AuthorityDAOSet the display name and description for an authority- Specified by:
setAuthorityDisplayNameAndDescriptionin interfaceAuthorityDAO
-
getOrCreateZone
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
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
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
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
Description copied from interface:AuthorityDAOAdd an authority to zones- Specified by:
addAuthorityToZonesin interfaceAuthorityDAO
-
removeAuthorityFromZones
Description copied from interface:AuthorityDAORemove an authority from zones.- Specified by:
removeAuthorityFromZonesin interfaceAuthorityDAO
-
beforeDeleteNode
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
-
init
public void init() -
onRefreshableCacheEvent
public void onRefreshableCacheEvent(org.alfresco.util.cache.RefreshableCacheEvent refreshableCacheEvent) - Specified by:
onRefreshableCacheEventin interfaceorg.alfresco.util.cache.RefreshableCacheListener
-
getCacheId
- Specified by:
getCacheIdin interfaceorg.alfresco.util.cache.RefreshableCacheListener
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-