Class QuickShareServiceImpl

java.lang.Object
org.alfresco.repo.quickshare.QuickShareServiceImpl
All Implemented Interfaces:
CopyServicePolicies.OnCopyNodePolicy, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnRestoreNodePolicy, ClassPolicy, Policy, QuickShareService

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
  • Constructor Details

    • QuickShareServiceImpl

      public QuickShareServiceImpl()
  • Method Details

    • 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: QuickShareService
      Share content identified by nodeRef.
      Specified by:
      shareContent in interface QuickShareService
      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: QuickShareService
      Share content identified by nodeRef and optionally set an expiry date for the shared link.
      Specified by:
      shareContent in interface QuickShareService
      Parameters:
      nodeRef - The NodeRef of the content to share
      expiryDate - The expiry date of the shared link
      Returns:
      QuickDTO with details of the share
      Throws:
      QuickShareDisabledException
      InvalidNodeRefException
    • getMetaData

      public Map<String,Object> getMetaData(NodeRef nodeRef)
      Description copied from interface: QuickShareService
      Get QuickShare related metadata for the given node.
      Specified by:
      getMetaData in interface QuickShareService
      Parameters:
      nodeRef - NodeRef
      Returns:
      Map
    • getTenantNodeRefFromSharedId

      public Pair<String,NodeRef> getTenantNodeRefFromSharedId(String sharedId)
      Description copied from interface: QuickShareService
      Get the tenant domain and node reference for the the given share id.
      Specified by:
      getTenantNodeRefFromSharedId in interface QuickShareService
      Parameters:
      sharedId - String
      Returns:
      Pair
    • getMetaData

      public Map<String,Object> getMetaData(String sharedId)
      Description copied from interface: QuickShareService
      Get QuickShare related metadata for the given shareId.
      Specified by:
      getMetaData in interface QuickShareService
      Parameters:
      sharedId - String
      Returns:
      Map
    • beforeDeleteNode

      public void beforeDeleteNode(NodeRef beforeDeleteNodeRef)
      Description copied from interface: NodeServicePolicies.BeforeDeleteNodePolicy
      Called before a node is deleted.
      Specified by:
      beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
      Parameters:
      beforeDeleteNodeRef - the node reference
    • onRestoreNode

      public void onRestoreNode(ChildAssociationRef childAssocRef)
      Description copied from interface: NodeServicePolicies.OnRestoreNodePolicy
      Called after an archived node is restored.
      Specified by:
      onRestoreNode in interface NodeServicePolicies.OnRestoreNodePolicy
      Parameters:
      childAssocRef - the newly created child association reference
    • unshareContent

      public void unshareContent(String sharedId)
      Description copied from interface: QuickShareService
      Unshare the content identified by sharedId
      Specified by:
      unshareContent in interface QuickShareService
      Parameters:
      sharedId - The shared id of the content to unshare.
    • getCopyCallback

      public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails)
      Description copied from interface: CopyServicePolicies.OnCopyNodePolicy
      Called for all types and aspects before copying a node.
      Specified by:
      getCopyCallback in interface CopyServicePolicies.OnCopyNodePolicy
      Parameters:
      classRef - the type or aspect qualified name
      copyDetails - 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:
    • canRead

      public boolean canRead(String sharedId)
      Description copied from interface: QuickShareService
      Determine if the current user has permission to read the shared content.
      Specified by:
      canRead in interface QuickShareService
    • sendEmailNotification

      public void sendEmailNotification(QuickShareServiceImpl.QuickShareEmailRequest emailRequest)
      Description copied from interface: QuickShareService
      Notifies users by email that a content has been shared with them, and the details of it.
      Specified by:
      sendEmailNotification in interface QuickShareService
      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: QuickShareService
      Determine if the current user has permission to delete the shared link.
      Specified by:
      canDeleteSharedLink in interface QuickShareService
    • isQuickShareEnabled

      public boolean isQuickShareEnabled()
      Description copied from interface: QuickShareService
      Whether the quick share is enabled or not.
      Specified by:
      isQuickShareEnabled in interface QuickShareService
      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: QuickShareService
      Removes (hard deletes) the previously persisted QuickShareLinkExpiryAction and its related schedule ScheduledPersistedAction from the repository.
      Specified by:
      deleteQuickShareLinkExpiryAction in interface QuickShareService
      Parameters:
      linkExpiryAction - The QuickShareLinkExpiryAction to be deleted.
    • deleteQuickShareLinkExpiryAction

      protected void deleteQuickShareLinkExpiryAction(NodeRef linkExpiryActionNodeRef)
      Removes (hard deletes) the previously persisted QuickShareLinkExpiryAction and its related schedule ScheduledPersistedAction from the repository.