public class PersonServiceImpl extends TransactionListenerAdapter implements PersonService, NodeServicePolicies.BeforeCreateNodePolicy, NodeServicePolicies.OnCreateNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy
Modifier and Type | Class and Description |
---|---|
static class |
PersonServiceImpl.NodeIdComparator |
PersonService.PersonInfo
Policy.Arg
Modifier and Type | Field and Description |
---|---|
static String |
KEY_ALLOW_UID_UPDATE |
static String |
PEOPLE_FOLDER_SHORT_QNAME |
static String |
SYSTEM_FOLDER_SHORT_QNAME |
QNAME
QNAME
QNAME
ARG_0, ARG_1, ARG_2, QNAME
Constructor and Description |
---|
PersonServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
afterCommit()
Process clean up any duplicates that were flagged during the transaction.
|
void |
beforeCreateNode(org.alfresco.service.cmr.repository.NodeRef parentRef,
org.alfresco.service.namespace.QName assocTypeQName,
org.alfresco.service.namespace.QName assocQName,
org.alfresco.service.namespace.QName nodeTypeQName)
Called before a new node is created.
|
void |
beforeCreateNodeValidation(org.alfresco.service.cmr.repository.NodeRef parentRef,
org.alfresco.service.namespace.QName assocTypeQName,
org.alfresco.service.namespace.QName assocQName,
org.alfresco.service.namespace.QName nodeTypeQName) |
void |
beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Called before a node is deleted.
|
void |
beforeDeleteNodeValidation(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
int |
countPeople()
Counts the number of persons registered with the system.
|
boolean |
createMissingPeople()
Does this service create people on demand if they are missing.
|
org.alfresco.service.cmr.repository.NodeRef |
createPerson(Map<org.alfresco.service.namespace.QName,Serializable> properties)
Create a new person with the given properties.
|
org.alfresco.service.cmr.repository.NodeRef |
createPerson(Map<org.alfresco.service.namespace.QName,Serializable> properties,
Set<String> zones)
Create a new person with the given properties, recording them against the given zone name (usually identifying an
external user registry from which the details were obtained).
|
void |
deletePerson(org.alfresco.service.cmr.repository.NodeRef personRef)
Delete the person identified by the given ref.
|
void |
deletePerson(org.alfresco.service.cmr.repository.NodeRef personRef,
boolean deleteAuthentication)
Delete the person identified by the given ref, and optionally delete
the associated authentication, if one.
|
void |
deletePerson(String userName)
Delete the person identified by the given user name.
|
boolean |
equals(Object obj) |
Set<org.alfresco.service.cmr.repository.NodeRef> |
getAllPeople()
Deprecated.
see getPeople
|
Set<org.alfresco.service.namespace.QName> |
getMutableProperties()
Get the list of properties that are mutable.
|
org.alfresco.query.PagingResults<PersonService.PersonInfo> |
getPeople(List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,String>> stringPropFilters,
boolean filterIgnoreCase,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Deprecated.
see getPeople(String pattern, List
|
org.alfresco.query.PagingResults<PersonService.PersonInfo> |
getPeople(String pattern,
List<org.alfresco.service.namespace.QName> filterStringProps,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Get paged list of people optionally filtered and/or sorted
Note: the pattern is applied to filter props (0 to 3) as startsWithIgnoreCase, which are OR'ed together, for example: cm:userName or cm:firstName or cm:lastName
|
org.alfresco.query.PagingResults<PersonService.PersonInfo> |
getPeople(String pattern,
List<org.alfresco.service.namespace.QName> filterStringProps,
Set<org.alfresco.service.namespace.QName> inclusiveAspects,
Set<org.alfresco.service.namespace.QName> exclusiveAspects,
boolean includeAdministraotrs,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Get paged list of people optionally filtered and/or sorted
|
org.alfresco.service.cmr.repository.NodeRef |
getPeopleContainer()
Return the container that stores people.
|
Set<org.alfresco.service.cmr.repository.NodeRef> |
getPeopleFilteredByProperty(org.alfresco.service.namespace.QName propertyKey,
Serializable propertyValue,
int count)
Get people filtered by the given property name/value pair.
|
PersonService.PersonInfo |
getPerson(org.alfresco.service.cmr.repository.NodeRef personRef)
Retrieve the person info for an existing
person NodeRef |
org.alfresco.service.cmr.repository.NodeRef |
getPerson(String userName)
Get a person by userName.
|
org.alfresco.service.cmr.repository.NodeRef |
getPerson(String userName,
boolean autoCreateHomeFolderAndMissingPersonIfAllowed)
Retrieve the person NodeRef for a
username , optionally creating
the home folder if it does not exist and optionally creating the person
if they don't exist AND the PersonService is configured to allow the
creation of missing persons PersonService.setCreateMissingPeople(boolean) . |
org.alfresco.service.cmr.repository.NodeRef |
getPersonOrNull(String userName)
Get a person by userName.
|
String |
getUserIdentifier(String caseSensitiveUserName)
Given the case sensitive user name find the approriate identifier from the person service.
|
boolean |
getUserNamesAreCaseSensitive()
Are user names case sensitive?
|
int |
hashCode() |
void |
init()
Spring bean init method
|
boolean |
isEnabled(String userName)
Is the specified user, enabled
|
boolean |
isMutable()
Can this service create, delete and update person information?
|
void |
notifyPerson(String userName,
String password)
Notifies a user by email that their account has been created, and the details of it.
|
void |
onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
Called when a new node has been created.
|
void |
onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Map<org.alfresco.service.namespace.QName,Serializable> before,
Map<org.alfresco.service.namespace.QName,Serializable> after)
When a uid is changed we need to create an alias for the old uid so permissions are not broken.
|
void |
onUpdatePropertiesUser(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Map<org.alfresco.service.namespace.QName,Serializable> before,
Map<org.alfresco.service.namespace.QName,Serializable> after)
Track the
enabled/disabled flag on cm:user . |
boolean |
personExists(String caseSensitiveUserName)
Check if a person exists.
|
void |
setAclDAO(AclDAO aclDao) |
void |
setAuthenticationService(MutableAuthenticationService authenticationService) |
void |
setAuthorityService(AuthorityService authorityService) |
void |
setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<org.alfresco.service.cmr.repository.NodeRef>> cannedQueryRegistry)
Set the registry of
canned queries |
void |
setCreateMissingPeople(boolean createMissingPeople)
Set if missing people should be created.
|
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setDuplicateMode(String duplicateMode) |
void |
setEventPublisher(org.alfresco.repo.events.EventPublisher eventPublisher) |
void |
setHomeFolderCreationDisabled(boolean homeFolderCreationDisabled)
Indicates if home folder creation should be disabled.
|
void |
setHomeFolderCreationEager(boolean homeFolderCreationEager)
Indicates if home folders should be created when the person
is created or delayed until first accessed.
|
void |
setHomeFolderManager(HomeFolderManager homeFolderManager) |
void |
setIncludeAutoCreated(boolean includeAutoCreated) |
void |
setLastIsBest(boolean lastIsBest) |
void |
setNamespacePrefixResolver(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPermissionServiceSPI(PermissionServiceSPI permissionServiceSPI) |
void |
setPermissionsManager(PermissionsManager permissionsManager) |
void |
setPersonCache(org.alfresco.repo.cache.SimpleCache<String,Set<org.alfresco.service.cmr.repository.NodeRef>> personCache)
Set the username to person cache.
|
void |
setPersonProperties(String userName,
Map<org.alfresco.service.namespace.QName,Serializable> properties)
Set the properties on a person - some of these may be persisted in
different locations - the home folder is created if it doesn't exist
|
void |
setPersonProperties(String userName,
Map<org.alfresco.service.namespace.QName,Serializable> properties,
boolean autoCreateHomeFolder)
Set the properties on a person - some of these may be persisted in different locations.
|
void |
setPolicyComponent(PolicyComponent policyComponent) |
void |
setProcessDuplicates(boolean processDuplicates) |
void |
setRepoAdminService(RepoAdminService repoAdminService) |
void |
setSearchService(org.alfresco.service.cmr.search.SearchService searchService) |
void |
setServiceRegistry(ServiceRegistry serviceRegistry) |
void |
setSingletonCache(org.alfresco.repo.cache.SimpleCache<String,Object> singletonCache) |
void |
setStoreUrl(String storeUrl) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setTransactionService(TransactionService transactionService) |
void |
setUserNameMatcher(UserNameMatcher userNameMatcher) |
static String |
updateUsernameForTenancy(String username,
org.alfresco.repo.tenant.TenantService tenantService)
Helper for when creating new users and people:
Updates the supplied username with any required tenant
details, and ensures that the tenant domains match.
|
afterRollback, beforeCommit, beforeCompletion, flush
public static final String SYSTEM_FOLDER_SHORT_QNAME
public static final String PEOPLE_FOLDER_SHORT_QNAME
public static final String KEY_ALLOW_UID_UPDATE
public void init()
public void setCreateMissingPeople(boolean createMissingPeople)
setCreateMissingPeople
in interface PersonService
createMissingPeople
- set to true to create peoplePersonService.getPerson(String)
public void setNamespacePrefixResolver(org.alfresco.service.namespace.NamespacePrefixResolver namespacePrefixResolver)
public void setAuthorityService(AuthorityService authorityService)
public void setAuthenticationService(MutableAuthenticationService authenticationService)
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
public void setPermissionServiceSPI(PermissionServiceSPI permissionServiceSPI)
public void setTransactionService(TransactionService transactionService)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setSingletonCache(org.alfresco.repo.cache.SimpleCache<String,Object> singletonCache)
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
public void setRepoAdminService(RepoAdminService repoAdminService)
public void setPolicyComponent(PolicyComponent policyComponent)
public void setStoreUrl(String storeUrl)
public void setUserNameMatcher(UserNameMatcher userNameMatcher)
public void setDuplicateMode(String duplicateMode)
public void setIncludeAutoCreated(boolean includeAutoCreated)
public void setLastIsBest(boolean lastIsBest)
public void setProcessDuplicates(boolean processDuplicates)
public void setHomeFolderManager(HomeFolderManager homeFolderManager)
public void setHomeFolderCreationEager(boolean homeFolderCreationEager)
public void setHomeFolderCreationDisabled(boolean homeFolderCreationDisabled)
public void setAclDAO(AclDAO aclDao)
public void setPermissionsManager(PermissionsManager permissionsManager)
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<org.alfresco.service.cmr.repository.NodeRef>> cannedQueryRegistry)
canned queries
public void setPersonCache(org.alfresco.repo.cache.SimpleCache<String,Set<org.alfresco.service.cmr.repository.NodeRef>> personCache)
public org.alfresco.service.cmr.repository.NodeRef getPerson(String userName)
to create missing people or not
.
The home folder will also be created as a side effect if it does not exist.getPerson
in interface PersonService
userName
- -
the userName key to find the personPersonService.setCreateMissingPeople(boolean)
,
PersonService.createMissingPeople()
public PersonService.PersonInfo getPerson(org.alfresco.service.cmr.repository.NodeRef personRef) throws NoSuchPersonException
person NodeRef
getPerson
in interface PersonService
personRef
- NodeRefNoSuchPersonException
- if the person doesn't existpublic org.alfresco.service.cmr.repository.NodeRef getPersonOrNull(String userName)
getPersonOrNull
in interface PersonService
userName
- -
the userName key to find the personPersonService.createMissingPeople()
public org.alfresco.service.cmr.repository.NodeRef getPerson(String userName, boolean autoCreateHomeFolderAndMissingPersonIfAllowed)
username
, optionally creating
the home folder if it does not exist and optionally creating the person
if they don't exist AND the PersonService is configured to allow the
creation of missing persons PersonService.setCreateMissingPeople(boolean)
.
If not allowed to create missing persons and the person does not exist
a NoSuchPersonException
exception will be thrown.getPerson
in interface PersonService
userName
- of the person NodeRef to retrieveautoCreateHomeFolderAndMissingPersonIfAllowed
- If the person exits:
should we create the home folder if it does not exist?
If the person exists AND the creation of missing persons is allowed
should we create both the person and home folder.public boolean personExists(String caseSensitiveUserName)
personExists
in interface PersonService
caseSensitiveUserName
- the user namepublic void afterCommit()
afterCommit
in interface org.alfresco.util.transaction.TransactionListener
afterCommit
in class TransactionListenerAdapter
public boolean createMissingPeople()
createMissingPeople
in interface PersonService
public Set<org.alfresco.service.namespace.QName> getMutableProperties()
getMutableProperties
in interface PersonService
public void setPersonProperties(String userName, Map<org.alfresco.service.namespace.QName,Serializable> properties)
setPersonProperties
in interface PersonService
userName
- -
the user for which the properties should be set.properties
- -
the map of properties to set (as the NodeService)public void setPersonProperties(String userName, Map<org.alfresco.service.namespace.QName,Serializable> properties, boolean autoCreateHomeFolder)
setPersonProperties
in interface PersonService
userName
- - the user for which the properties should be set.properties
- - the map of properties to set (as the NodeService)autoCreateHomeFolder
- should we auto-create the home folder if it doesn't exist.public boolean isMutable()
isMutable
in interface PersonService
public org.alfresco.service.cmr.repository.NodeRef createPerson(Map<org.alfresco.service.namespace.QName,Serializable> properties)
createPerson
in interface PersonService
public org.alfresco.service.cmr.repository.NodeRef createPerson(Map<org.alfresco.service.namespace.QName,Serializable> properties, Set<String> zones)
createPerson
in interface PersonService
properties
- the propertieszones
- a set if zones including the identifier for the external user registry owning the person information, or null
or an empty setpublic void notifyPerson(String userName, String password)
PersonService.createPerson(Map)
or PersonService.createPerson(Map, Set)
where email notifications are required.notifyPerson
in interface PersonService
userName
- of the person to notifypassword
- of the person to notifypublic org.alfresco.service.cmr.repository.NodeRef getPeopleContainer()
getPeopleContainer
in interface PersonService
public void deletePerson(String userName)
deletePerson
in interface PersonService
userName
- Stringpublic void deletePerson(org.alfresco.service.cmr.repository.NodeRef personRef)
deletePerson
in interface PersonService
personRef
- NodeRefpublic void deletePerson(org.alfresco.service.cmr.repository.NodeRef personRef, boolean deleteAuthentication)
deletePerson
in interface PersonService
personRef
- NodeRefdeleteAuthentication
- booleanpublic Set<org.alfresco.service.cmr.repository.NodeRef> getAllPeople()
getAllPeople
in interface PersonService
public org.alfresco.query.PagingResults<PersonService.PersonInfo> getPeople(String pattern, List<org.alfresco.service.namespace.QName> filterStringProps, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
getPeople
in interface PersonService
pattern
- pattern to apply to filter props - "startsWith" and "ignoreCase"filterStringProps
- list of filter properties (these are OR'ed)sortProps
- sort property, eg. cm:username ascendingpagingRequest
- skip, max + optional query execution id
public org.alfresco.query.PagingResults<PersonService.PersonInfo> getPeople(String pattern, List<org.alfresco.service.namespace.QName> filterStringProps, Set<org.alfresco.service.namespace.QName> inclusiveAspects, Set<org.alfresco.service.namespace.QName> exclusiveAspects, boolean includeAdministraotrs, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
getPeople
in interface PersonService
pattern
- StringfilterStringProps
- list of filter properties (with "startsWith" values), eg. cm:username "al" might match "alex", "alice", ...inclusiveAspects
- if set, filter out any people that don't have one of these aspectsexclusiveAspects
- if set, filter out any people that do have one of these aspectsincludeAdministraotrs
- true to include administrators in the results.sortProps
- sort property, eg. cm:username ascendingpagingRequest
- skip, max + optional query execution idpublic org.alfresco.query.PagingResults<PersonService.PersonInfo> getPeople(List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,String>> stringPropFilters, boolean filterIgnoreCase, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
getPeople
in interface PersonService
stringPropFilters
- list of filter properties (with "startsWith" values), eg. cm:username "al" might match "alex", "alice", ...filterIgnoreCase
- true to ignore case when filtering, false to be case-sensitive when filteringsortProps
- sort property, eg. cm:username ascendingpagingRequest
- skip, max + optional query execution id
public Set<org.alfresco.service.cmr.repository.NodeRef> getPeopleFilteredByProperty(org.alfresco.service.namespace.QName propertyKey, Serializable propertyValue, int count)
PersonService.getPeople(List, boolean, List, PagingRequest)
getPeopleFilteredByProperty
in interface PersonService
propertyKey
- property key of property to filter people bypropertyValue
- property value of property to filter people bycount
- the number of results to retrieve, up to a maximum of 1000PersonService.getPeople(List, boolean, List, PagingRequest)
public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
onCreateNode
in interface NodeServicePolicies.OnCreateNodePolicy
childAssocRef
- the created child association referencepublic void beforeCreateNode(org.alfresco.service.cmr.repository.NodeRef parentRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.namespace.QName nodeTypeQName)
NodeServicePolicies.BeforeCreateNodePolicy
beforeCreateNode
in interface NodeServicePolicies.BeforeCreateNodePolicy
parentRef
- the parent node referenceassocTypeQName
- the association type qualified nameassocQName
- the association qualified namenodeTypeQName
- the node type qualified namepublic void beforeCreateNodeValidation(org.alfresco.service.cmr.repository.NodeRef parentRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.namespace.QName nodeTypeQName)
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
NodeServicePolicies.BeforeDeleteNodePolicy
beforeDeleteNode
in interface NodeServicePolicies.BeforeDeleteNodePolicy
nodeRef
- the node referencepublic void beforeDeleteNodeValidation(org.alfresco.service.cmr.repository.NodeRef nodeRef)
public String getUserIdentifier(String caseSensitiveUserName)
getUserIdentifier
in interface PersonService
caseSensitiveUserName
- Stringpublic boolean getUserNamesAreCaseSensitive()
getUserNamesAreCaseSensitive
in interface PersonService
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)
onUpdateProperties
in interface NodeServicePolicies.OnUpdatePropertiesPolicy
nodeRef
- reference to the updated nodebefore
- the node's properties before the changeafter
- the node's properties after the changepublic void onUpdatePropertiesUser(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)
enabled/disabled
flag on cm:user
.public int countPeople()
PersonService
countPeople
in interface PersonService
public static String updateUsernameForTenancy(String username, org.alfresco.repo.tenant.TenantService tenantService) throws TenantDomainMismatchException
TenantDomainMismatchException
public boolean isEnabled(String userName)
PersonService
isEnabled
in interface PersonService
public void setEventPublisher(org.alfresco.repo.events.EventPublisher eventPublisher)
Copyright © 2005–2017 Alfresco Software. All rights reserved.