Class RegexHomeFolderProvider
java.lang.Object
org.alfresco.repo.security.person.AbstractHomeFolderProvider2
org.alfresco.repo.security.person.UsernameHomeFolderProvider
org.alfresco.repo.security.person.RegexHomeFolderProvider
- All Implemented Interfaces:
HomeFolderProvider2,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
Implementation that returns a tree structure for a home folder based on a property (typically userName)
from the supplied person. The parent folder names are derived from regular expression groups matched
against the property value. The final folder name is the full property value.
For example, given the value "adavis" and the regular expression "^(..)" the
resulting home folder path would be "/ad/adavis". However with the regular expression
"^(.)(.?)" the home folder path would be "/a/d/adavis". If any group matches a zero
length string, it is just ignored.
Note: In order to choose an efficient distribution scheme, be aware that, when m users are distributed into n leaf folders, when m >> n log n the statistical maximum load is m/n + O( sqrt((m log n)/n)), w.h.p
- Author:
- Romain Guinot, Alan Davis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHomeFolderPath(NodeRef person) Returns a preferred path (a list of folder names) for the home folder relative to the root path.voidsetGroupOrder(String groupOrderString) voidsetPattern(String patternString) voidsetPropertyName(String propertyName) Methods inherited from class org.alfresco.repo.security.person.UsernameHomeFolderProvider
getHomeFolder, getTemplateNodeRef, setTemplatePathMethods inherited from class org.alfresco.repo.security.person.AbstractHomeFolderProvider2
afterPropertiesSet, getHomeFolderManager, getName, getOnCreatePermissionsManager, getOnReferencePermissionsManager, getOwner, getRootPath, getStoreUrl, setBeanName, setHomeFolderManager, setOnCreatePermissionsManager, setOnReferencePermissionsManager, setOwner, setRootPath, setStoreUrl
-
Constructor Details
-
RegexHomeFolderProvider
public RegexHomeFolderProvider()
-
-
Method Details
-
setPropertyName
- Parameters:
propertyName- String the cm:person property used as the key, such as userName or organizationId.
-
setPattern
- Parameters:
patternString- the regex pattern against the cm:person property value. Regex groups define the parent folder structure.
-
setGroupOrder
- Parameters:
groupOrderString- String the order (as a comma separated list) in which the regex pattern groups should be assembled into folders (such as2,1). The default ordering is as they appear.
-
getHomeFolderPath
Description copied from interface:HomeFolderProvider2Returns a preferred path (a list of folder names) for the home folder relative to the root path. If all users share the root, the returned value should be an empty List ornull. When all users have their own folder under the root there should be just one element in the List. Multiple elements should be returned when a nested folder structure is preferred.- Specified by:
getHomeFolderPathin interfaceHomeFolderProvider2- Overrides:
getHomeFolderPathin classUsernameHomeFolderProvider- Parameters:
person- NodeRef from which a property (normally the userName) is used as a hash key to create a nested directory structure.- Returns:
- the path to be used.
-