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 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(NodeRef beforeDeleteNodeRef)Called before a node is deleted.booleancanDeleteSharedLink(NodeRef nodeRef, String sharedByUserId)Determine if the current user has permission to delete the shared link.booleancanRead(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(NodeRef linkExpiryActionNodeRef)Removes (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.CopyBehaviourCallbackgetCopyCallback(QName classRef, CopyDetails copyDetails)Called for all types and aspects before copying a node.Map<String,Object>getMetaData(String sharedId)Get QuickShare related metadata for the given shareId.Map<String,Object>getMetaData(NodeRef nodeRef)Get QuickShare related metadata for the given node.protected StringgetSharedLinkEmailTemplatePath(ClientAppConfig.ClientApp clientApp)Pair<String,NodeRef>getTenantNodeRefFromSharedId(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(ChildAssociationRef childAssocRef)Called after an archived node is restored.protected voidsaveSharedLinkExpiryAction(String sharedId, 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(String defaultEmailSender)Set the default email sendervoidsetDictionaryService(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(String expiryDatePeriod)Spring configurationvoidsetNodeService(NodeService nodeService)Set the node servicevoidsetPermissionService(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(SearchService searchService)Spring configurationvoidsetSiteService(SiteService siteService)Spring configurationvoidsetSysAdminParams(SysAdminParams sysAdminParams)Spring configurationvoidsetTenantService(TenantService tenantService)Set the tenant servicevoidsetThumbnailService(ThumbnailService thumbnailService)Set the thumbnail serviceQuickShareDTOshareContent(NodeRef nodeRef)Share content identified by nodeRef.QuickShareDTOshareContent(NodeRef nodeRef, Date expiryDate)Share content identified by nodeRef and optionally set an expiry date for the shared link.voidunshareContent(String sharedId)Unshare the content identified by sharedId
-
-
-
Method Detail
-
setAttributeService
public void setAttributeService(AttributeService attributeService)
Set the attribute service
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
Set the dictionary service
-
setNodeService
public void setNodeService(NodeService nodeService)
Set the node service
-
setPermissionService
public void setPermissionService(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(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(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(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(String expiryDatePeriod)
Spring configuration- Parameters:
expiryDatePeriod- the expiryDatePeriod to set
-
init
public void init()
The initialise method. Register our policies.
-
shareContent
public QuickShareDTO shareContent(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(NodeRef nodeRef, Date expiryDate) throws QuickShareDisabledException, 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:
QuickShareDisabledExceptionInvalidNodeRefException
-
getMetaData
public Map<String,Object> getMetaData(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 Pair<String,NodeRef> getTenantNodeRefFromSharedId(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 Map<String,Object> getMetaData(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(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(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(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(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(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 String getSharedLinkEmailTemplatePath(ClientAppConfig.ClientApp clientApp)
-
canDeleteSharedLink
public boolean canDeleteSharedLink(NodeRef nodeRef, 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(String sharedId, 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(NodeRef linkExpiryActionNodeRef)
Removes (hard deletes) the previously persistedQuickShareLinkExpiryActionand its related scheduleScheduledPersistedActionfrom the repository.
-
-