org.alfresco.repo.security.authority
Class AuthorityDAOImpl

java.lang.Object
  extended by org.alfresco.repo.security.authority.AuthorityDAOImpl
All Implemented Interfaces:
NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, ClassPolicy, Policy, AuthorityDAO

public class AuthorityDAOImpl
extends java.lang.Object
implements AuthorityDAO, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy


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
 
Fields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE
 
Constructor Summary
AuthorityDAOImpl()
           
 
Method Summary
 void addAuthority(java.util.Collection parentNames, java.lang.String childName)
          Add a child authority to the given parent authorities
 void addAuthorityToZones(java.lang.String authorityName, java.util.Set zones)
          Add an authority to zones
 boolean authorityExists(java.lang.String name)
          Test if an authority already exists.
 void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Called before a node is deleted.
 void createAuthority(java.lang.String name, java.lang.String authorityDisplayName, java.util.Set authorityZones)
          Create an authority.
 void deleteAuthority(java.lang.String name)
          Delete an authority.
 java.util.Set 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 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 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 authorities by type and/or zone
 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 getAuthorityZones(java.lang.String name)
          Gets the name of the zone containing the specified authority.
 java.util.Set getContainedAuthorities(org.alfresco.service.cmr.security.AuthorityType type, java.lang.String parentName, boolean immediate)
          Get contained authorities.
 java.util.Set 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 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
 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
 java.util.Set 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(org.alfresco.service.cmr.repository.NodeRef authorityNodeRef, java.lang.String authorityToFind)
           
 void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map before, java.util.Map after)
          Called after a node's properties have been changed.
 void removeAuthority(java.lang.String parentName, java.lang.String childName)
          Remove an authority.
 void removeAuthorityFromZones(java.lang.String authorityName, java.util.Set zones)
          Remove an authority from zones.
 void setAclDAO(AclDAO aclDao)
           
 void setAuthorityDisplayName(java.lang.String authorityName, java.lang.String authorityDisplayName)
          Set the display name for an authority
 void setAuthorityLookupCache(org.alfresco.repo.cache.SimpleCache authorityLookupCache)
           
 void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)
           
 void setChildAuthorityCache(org.alfresco.repo.cache.SimpleCache childAuthorityCache)
           
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 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 setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
           
 void setStoreUrl(java.lang.String storeUrl)
           
 void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
           
 void setUserAuthorityCache(org.alfresco.repo.cache.SimpleCache userAuthorityCache)
           
 void setZoneAuthorityCache(org.alfresco.repo.cache.SimpleCache 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 authorityLookupCache)

setUserAuthorityCache

public void setUserAuthorityCache(org.alfresco.repo.cache.SimpleCache userAuthorityCache)

setZoneAuthorityCache

public void setZoneAuthorityCache(org.alfresco.repo.cache.SimpleCache zoneAuthorityCache)

setChildAuthorityCache

public void setChildAuthorityCache(org.alfresco.repo.cache.SimpleCache childAuthorityCache)

setPersonService

public void setPersonService(PersonService personService)

setTenantService

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

setAclDAO

public void setAclDAO(AclDAO aclDao)

setPolicyComponent

public void setPolicyComponent(PolicyComponent policyComponent)

setCannedQueryRegistry

public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)

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
Returns:

addAuthority

public void addAuthority(java.util.Collection 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 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

getAuthorities

public org.alfresco.query.PagingResults 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 authorities by type and/or zone

Specified by:
getAuthorities in interface AuthorityDAO
Returns:

getRootAuthorities

public java.util.Set 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
Returns:

findAuthorities

public java.util.Set 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
Returns:

getContainedAuthorities

public java.util.Set 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
Returns:

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

getContainingAuthorities

public java.util.Set 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
Returns:

getContainingAuthoritiesInZone

public java.util.Set 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
Returns:

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
Returns:

isAuthorityContained

public boolean isAuthorityContained(org.alfresco.service.cmr.repository.NodeRef authorityNodeRef,
                                    java.lang.String authorityToFind)
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
Returns:

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
Returns:
name

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 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 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 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 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)
Description copied from interface: NodeServicePolicies.BeforeDeleteNodePolicy
Called before a node is deleted.

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 before,
                               java.util.Map 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()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.