Package org.alfresco.repo.quickshare
Class QuickShareServiceImpl
- java.lang.Object
-
- org.alfresco.repo.quickshare.QuickShareServiceImpl
-
- All Implemented Interfaces:
CopyServicePolicies.OnCopyNodePolicy,NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.OnRestoreNodePolicy,ClassPolicy,Policy,QuickShareService
public class QuickShareServiceImpl extends java.lang.Object implements QuickShareService, NodeServicePolicies.BeforeDeleteNodePolicy, CopyServicePolicies.OnCopyNodePolicy, NodeServicePolicies.OnRestoreNodePolicy
QuickShare Service implementation. In addition to the quick share service, this class also provides a BeforeDeleteNodePolicy and OnCopyNodePolicy for content with the QuickShare aspect.- Author:
- Alex Miller, janv, Jamal Kaabi-Mofrad
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQuickShareServiceImpl.QuickShareEmailRequestRepresents an email request to send a quick share link.-
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
-
-
Field Summary
-
Fields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnRestoreNodePolicy
QNAME
-
-
Constructor Summary
Constructors Constructor Description QuickShareServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef beforeDeleteNodeRef)Called before a node is deleted.booleancanDeleteSharedLink(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String sharedByUserId)Determine if the current user has permission to delete the shared link.booleancanRead(java.lang.String sharedId)Determine if the current user has permission to read the shared content.voiddeleteQuickShareLinkExpiryAction(QuickShareLinkExpiryAction linkExpiryAction)Removes (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.protected voiddeleteQuickShareLinkExpiryAction(org.alfresco.service.cmr.repository.NodeRef linkExpiryActionNodeRef)Removes (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.CopyBehaviourCallbackgetCopyCallback(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)Called for all types and aspects before copying a node.java.util.Map<java.lang.String,java.lang.Object>getMetaData(java.lang.String sharedId)Get QuickShare related metadata for the given shareId.java.util.Map<java.lang.String,java.lang.Object>getMetaData(org.alfresco.service.cmr.repository.NodeRef nodeRef)Get QuickShare related metadata for the given node.protected java.lang.StringgetSharedLinkEmailTemplatePath(ClientAppConfig.ClientApp clientApp)org.alfresco.util.Pair<java.lang.String,org.alfresco.service.cmr.repository.NodeRef>getTenantNodeRefFromSharedId(java.lang.String sharedId)Get the tenant domain and node reference for the the given share id.voidinit()The initialise method.booleanisQuickShareEnabled()Whether the quick share is enabled or not.voidonRestoreNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)Called after an archived node is restored.protected voidsaveSharedLinkExpiryAction(java.lang.String sharedId, java.util.Date expiryDate)Creates and persists the quick share link expiry action and its related schedule.voidsendEmailNotification(QuickShareServiceImpl.QuickShareEmailRequest emailRequest)Notifies users by email that a content has been shared with them, and the details of it.voidsetActionService(ActionService actionService)Set the actionServicevoidsetAttributeService(AttributeService attributeService)Set the attribute servicevoidsetAuthorityService(AuthorityService authorityService)Spring configurationvoidsetBehaviourFilter(BehaviourFilter behaviourFilter)Spring configurationvoidsetClientAppConfig(ClientAppConfig clientAppConfig)Set the quickShare clientAppConfigvoidsetDefaultEmailSender(java.lang.String defaultEmailSender)Set the default email sendervoidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)Set the dictionary servicevoidsetEmailHelper(EmailHelper emailHelper)Spring configurationvoidsetEnabled(boolean enabled)Enable or disable this service.voidsetEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher)Set the eventPublishervoidsetExpiryDatePeriod(java.lang.String expiryDatePeriod)Spring configurationvoidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)Set the node servicevoidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)Set the Permission servicevoidsetPersonService(PersonService personService)Set the person servicevoidsetPolicyComponent(PolicyComponent policyComponent)Set the policy componentvoidsetQuickShareLinkExpiryActionPersister(QuickShareLinkExpiryActionPersister quickShareLinkExpiryActionPersister)Spring configurationvoidsetScheduledPersistedActionService(ScheduledPersistedActionService scheduledPersistedActionService)Spring configurationvoidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)Spring configurationvoidsetSiteService(SiteService siteService)Spring configurationvoidsetSysAdminParams(SysAdminParams sysAdminParams)Spring configurationvoidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)Set the tenant servicevoidsetThumbnailService(ThumbnailService thumbnailService)Set the thumbnail serviceQuickShareDTOshareContent(org.alfresco.service.cmr.repository.NodeRef nodeRef)Share content identified by nodeRef.QuickShareDTOshareContent(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Date expiryDate)Share content identified by nodeRef and optionally set an expiry date for the shared link.voidunshareContent(java.lang.String sharedId)Unshare the content identified by sharedId
-
-
-
Method Detail
-
setAttributeService
public void setAttributeService(AttributeService attributeService)
Set the attribute service
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Set the dictionary service
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
Set the Permission service
-
setPersonService
public void setPersonService(PersonService personService)
Set the person service
-
setPolicyComponent
public void setPolicyComponent(PolicyComponent policyComponent)
Set the policy component
-
setTenantService
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
Set the tenant service
-
setThumbnailService
public void setThumbnailService(ThumbnailService thumbnailService)
Set the thumbnail service
-
setEventPublisher
public void setEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher)
Set the eventPublisher
-
setActionService
public void setActionService(ActionService actionService)
Set the actionService
-
setBehaviourFilter
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
Spring configuration- Parameters:
behaviourFilter- the behaviourFilter to set
-
setSearchService
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
Spring configuration- Parameters:
searchService- the searchService to set
-
setSiteService
public void setSiteService(SiteService siteService)
Spring configuration- Parameters:
siteService- the siteService to set
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
Spring configuration- Parameters:
authorityService- the authorityService to set
-
setSysAdminParams
public void setSysAdminParams(SysAdminParams sysAdminParams)
Spring configuration- Parameters:
sysAdminParams- the sysAdminParams to set
-
setEmailHelper
public void setEmailHelper(EmailHelper emailHelper)
Spring configuration- Parameters:
emailHelper- the emailHelper to set
-
setEnabled
public void setEnabled(boolean enabled)
Enable or disable this service.
-
setDefaultEmailSender
public void setDefaultEmailSender(java.lang.String defaultEmailSender)
Set the default email sender
-
setClientAppConfig
public void setClientAppConfig(ClientAppConfig clientAppConfig)
Set the quickShare clientAppConfig
-
setScheduledPersistedActionService
public void setScheduledPersistedActionService(ScheduledPersistedActionService scheduledPersistedActionService)
Spring configuration- Parameters:
scheduledPersistedActionService- the scheduledPersistedActionService to set
-
setQuickShareLinkExpiryActionPersister
public void setQuickShareLinkExpiryActionPersister(QuickShareLinkExpiryActionPersister quickShareLinkExpiryActionPersister)
Spring configuration- Parameters:
quickShareLinkExpiryActionPersister- the quickShareLinkExpiryActionPersister to set
-
setExpiryDatePeriod
public void setExpiryDatePeriod(java.lang.String expiryDatePeriod)
Spring configuration- Parameters:
expiryDatePeriod- the expiryDatePeriod to set
-
init
public void init()
The initialise method. Register our policies.
-
shareContent
public QuickShareDTO shareContent(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:QuickShareServiceShare content identified by nodeRef.- Specified by:
shareContentin interfaceQuickShareService- Parameters:
nodeRef- The NodeRef of the content to share- Returns:
- QuickDTO with details of the share
-
shareContent
public QuickShareDTO shareContent(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Date expiryDate) throws QuickShareDisabledException, org.alfresco.service.cmr.repository.InvalidNodeRefException
Description copied from interface:QuickShareServiceShare content identified by nodeRef and optionally set an expiry date for the shared link.- Specified by:
shareContentin interfaceQuickShareService- Parameters:
nodeRef- The NodeRef of the content to shareexpiryDate- The expiry date of the shared link- Returns:
- QuickDTO with details of the share
- Throws:
QuickShareDisabledExceptionorg.alfresco.service.cmr.repository.InvalidNodeRefException
-
getMetaData
public java.util.Map<java.lang.String,java.lang.Object> getMetaData(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:QuickShareServiceGet QuickShare related metadata for the given node.- Specified by:
getMetaDatain interfaceQuickShareService- Parameters:
nodeRef- NodeRef- Returns:
- Map
-
getTenantNodeRefFromSharedId
public org.alfresco.util.Pair<java.lang.String,org.alfresco.service.cmr.repository.NodeRef> getTenantNodeRefFromSharedId(java.lang.String sharedId)
Description copied from interface:QuickShareServiceGet the tenant domain and node reference for the the given share id.- Specified by:
getTenantNodeRefFromSharedIdin interfaceQuickShareService- Parameters:
sharedId- String- Returns:
- Pair
-
getMetaData
public java.util.Map<java.lang.String,java.lang.Object> getMetaData(java.lang.String sharedId)
Description copied from interface:QuickShareServiceGet QuickShare related metadata for the given shareId.- Specified by:
getMetaDatain interfaceQuickShareService- Parameters:
sharedId- String- Returns:
- Map
-
beforeDeleteNode
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef beforeDeleteNodeRef)
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
beforeDeleteNodeRef- the node reference
-
onRestoreNode
public void onRestoreNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
Description copied from interface:NodeServicePolicies.OnRestoreNodePolicyCalled after an archived node is restored.- Specified by:
onRestoreNodein interfaceNodeServicePolicies.OnRestoreNodePolicy- Parameters:
childAssocRef- the newly created child association reference
-
unshareContent
public void unshareContent(java.lang.String sharedId)
Description copied from interface:QuickShareServiceUnshare the content identified by sharedId- Specified by:
unshareContentin interfaceQuickShareService- Parameters:
sharedId- The shared id of the content to unshare.
-
getCopyCallback
public CopyBehaviourCallback getCopyCallback(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)
Description copied from interface:CopyServicePolicies.OnCopyNodePolicyCalled for all types and aspects before copying a node.- Specified by:
getCopyCallbackin interfaceCopyServicePolicies.OnCopyNodePolicy- Parameters:
classRef- the type or aspect qualified namecopyDetails- the details of the impending copy- Returns:
- Return the callback that will be used to modify the copy behaviour for this dictionary class. Return null to assume the default.
- See Also:
CopyServicePolicies
-
canRead
public boolean canRead(java.lang.String sharedId)
Description copied from interface:QuickShareServiceDetermine if the current user has permission to read the shared content.- Specified by:
canReadin interfaceQuickShareService
-
sendEmailNotification
public void sendEmailNotification(QuickShareServiceImpl.QuickShareEmailRequest emailRequest)
Description copied from interface:QuickShareServiceNotifies users by email that a content has been shared with them, and the details of it.- Specified by:
sendEmailNotificationin interfaceQuickShareService- Parameters:
emailRequest- The email details including its template details
-
getSharedLinkEmailTemplatePath
protected java.lang.String getSharedLinkEmailTemplatePath(ClientAppConfig.ClientApp clientApp)
-
canDeleteSharedLink
public boolean canDeleteSharedLink(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String sharedByUserId)Description copied from interface:QuickShareServiceDetermine if the current user has permission to delete the shared link.- Specified by:
canDeleteSharedLinkin interfaceQuickShareService
-
isQuickShareEnabled
public boolean isQuickShareEnabled()
Description copied from interface:QuickShareServiceWhether the quick share is enabled or not.- Specified by:
isQuickShareEnabledin interfaceQuickShareService- Returns:
- true if quick share is enabled, false otherwise.
-
saveSharedLinkExpiryAction
protected void saveSharedLinkExpiryAction(java.lang.String sharedId, java.util.Date expiryDate)Creates and persists the quick share link expiry action and its related schedule.
-
deleteQuickShareLinkExpiryAction
public void deleteQuickShareLinkExpiryAction(QuickShareLinkExpiryAction linkExpiryAction)
Description copied from interface:QuickShareServiceRemoves (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.- Specified by:
deleteQuickShareLinkExpiryActionin interfaceQuickShareService- Parameters:
linkExpiryAction- TheQuickShareLinkExpiryActionto be deleted.
-
deleteQuickShareLinkExpiryAction
protected void deleteQuickShareLinkExpiryAction(org.alfresco.service.cmr.repository.NodeRef linkExpiryActionNodeRef)
Removes (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.
-
-