Class InvitationServiceImpl

java.lang.Object
org.alfresco.repo.invitation.InvitationServiceImpl
All Implemented Interfaces:
NodeServicePolicies.BeforeDeleteNodePolicy, ClassPolicy, Policy, InvitationService

public class InvitationServiceImpl extends Object implements InvitationService, NodeServicePolicies.BeforeDeleteNodePolicy
Implementation of invitation service.
Author:
mrogers, Nick Smith
See Also:
  • Field Details

    • MAX_NUM_INVITEE_USER_NAME_GEN_TRIES

      public static final int MAX_NUM_INVITEE_USER_NAME_GEN_TRIES
      See Also:
  • Constructor Details

    • InvitationServiceImpl

      public InvitationServiceImpl()
  • Method Details

    • setClientAppConfig

      public void setClientAppConfig(ClientAppConfig clientAppConfig)
    • setPolicyComponent

      public void setPolicyComponent(PolicyComponent policyComponent)
      Set the policy component
      Parameters:
      policyComponent - policy component
    • setNominatedInvitationWorkflowId

      public void setNominatedInvitationWorkflowId(String nominatedInvitationWorkflowId)
      Sets the nominated invite activiti workflow definition for internal users
      Parameters:
      nominatedInvitationWorkflowId -
    • setNominatedInvitationExternalWorkflowId

      public void setNominatedInvitationExternalWorkflowId(String nominatedInvitationExternalWorkflowId)
      Sets the nominated invite activiti workflow definition for external users
      Parameters:
      nominatedInvitationExternalWorkflowId -
    • setModeratedInvitationWorkflowId

      public void setModeratedInvitationWorkflowId(String moderatedInvitationWorkflowId)
      Sets the moderated invite activiti workflow definition
      Parameters:
      moderatedInvitationWorkflowId -
    • init

      public void init()
      Checks that all necessary properties and services have been provided.
    • getInvitationServiceWorkflowNames

      public List<String> getInvitationServiceWorkflowNames()
      Get the names of the workflows which are managed by the invitation service
      Specified by:
      getInvitationServiceWorkflowNames in interface InvitationService
      Returns:
      the workflows which are managed by the invitation service
    • inviteNominated

      public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String serverPath, String acceptUrl, String rejectUrl)
      Start the invitation process for a NominatedInvitation
      Specified by:
      inviteNominated in interface InvitationService
      Parameters:
      inviteeUserName - Alfresco user name of the invitee
      resourceType - resourceType
      resourceName - String
      inviteeRole - String
      serverPath - String
      acceptUrl - String
      rejectUrl - String
      Returns:
      the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
      Throws:
      InvitationException
      InvitationExceptionUserError
      InvitationExceptionForbidden
    • inviteNominated

      public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String acceptUrl, String rejectUrl)
      Start the invitation process for a NominatedInvitation
      Specified by:
      inviteNominated in interface InvitationService
      Parameters:
      inviteeUserName - Alfresco user name of the invitee
      resourceType - resourceType
      resourceName - String
      inviteeRole - String
      acceptUrl - String
      rejectUrl - String
      Returns:
      the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
      Throws:
      InvitationException
      InvitationExceptionUserError
      InvitationExceptionForbidden
    • inviteNominated

      public NominatedInvitation inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String acceptUrl, String rejectUrl)
      Start the invitation process for a NominatedInvitation
      Specified by:
      inviteNominated in interface InvitationService
      Parameters:
      inviteeFirstName - String
      inviteeLastName - String
      inviteeEmail - String
      resourceType - Invitation.ResourceType
      resourceName - String
      inviteeRole - String
      acceptUrl - String
      rejectUrl - String
      Returns:
      the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
      Throws:
      InvitationException
      InvitationExceptionUserError
      InvitationExceptionForbidden
    • inviteNominated

      public NominatedInvitation inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String serverPath, String acceptUrl, String rejectUrl)
      Start the invitation process for a NominatedInvitation
      Specified by:
      inviteNominated in interface InvitationService
      Parameters:
      inviteeFirstName - String
      inviteeLastName - String
      inviteeEmail - String
      resourceType - Invitation.ResourceTyp
      resourceName - String
      inviteeRole - String
      serverPath - String
      acceptUrl - String
      rejectUrl - String
      Returns:
      the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
      Throws:
      InvitationException
      InvitationExceptionUserError
      InvitationExceptionForbidden
    • inviteModerated

      public ModeratedInvitation inviteModerated(String inviteeComments, String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole)
      Start the invitation process for a ModeratedInvitation
      Specified by:
      inviteModerated in interface InvitationService
      Parameters:
      inviteeComments - why does the invitee want access to the resource ?
      inviteeUserName - who is to be invited
      resourceType - Invitation .ResourceType what resource type ?
      resourceName - which resource
      inviteeRole - which role ?
    • accept

      public Invitation accept(String invitationId, String ticket)
      Invitee accepts this invitation Nominated Invitaton process only
      Specified by:
      accept in interface InvitationService
      Parameters:
      invitationId - the invitation id
      ticket - the ticket produced when creating the invitation.
      Returns:
      the invitation
    • approve

      public Invitation approve(String invitationId, String reason)
      Moderator approves this invitation
      Specified by:
      approve in interface InvitationService
      Parameters:
      invitationId - the request id
      reason - comments about the acceptance
    • reject

      public Invitation reject(String invitationId, String reason)
      User or moderator rejects this request
      Specified by:
      reject in interface InvitationService
      Parameters:
      invitationId - String
      reason - , optional reason for rejection
    • cancel

      public Invitation cancel(String invitationId)
      cancel this request
      Specified by:
      cancel in interface InvitationService
    • getInvitation

      public Invitation getInvitation(String invitationId)
      Get an invitation from its invitation id
      Invitations are returned which may be in progress or completed.
      Specified by:
      getInvitation in interface InvitationService
      Parameters:
      invitationId - ;
      Returns:
      the invitation.
      Throws:
      InvitationExceptionNotFound - the invitation does not exist.
      InvitationExceptionUserError
    • listPendingInvitationsForInvitee

      public List<Invitation> listPendingInvitationsForInvitee(String invitee)
      list Invitations for a specific person/invitee
      Specified by:
      listPendingInvitationsForInvitee in interface InvitationService
      Parameters:
      invitee - alfresco user id of person being invited
    • listPendingInvitationsForInvitee

      public List<Invitation> listPendingInvitationsForInvitee(String invitee, Invitation.ResourceType resourceType)
      Specified by:
      listPendingInvitationsForInvitee in interface InvitationService
    • listPendingInvitationsForResource

      public List<Invitation> listPendingInvitationsForResource(Invitation.ResourceType resourceType, String resourceName)
      list Invitations for a specific resource
      Specified by:
      listPendingInvitationsForResource in interface InvitationService
      Parameters:
      resourceType - Invitation.ResourceType
      resourceName - String
    • searchInvitation

      public List<Invitation> searchInvitation(InvitationSearchCriteria criteria)
      Deprecated.
      This is the general search invitation method returning Invitation This method has a hardcoded limit of 200 invitations to return. It has been deprecated and it is recommended to use the overloaded version for which you can specify an appropriate limit depending on the needs
      Specified by:
      searchInvitation in interface InvitationService
      Parameters:
      criteria - InvitationSearchCriteria search criteria
      Returns:
      the list of invitations
    • searchInvitation

      public List<Invitation> searchInvitation(InvitationSearchCriteria criteria, int limit)
      This is the general search invitation method returning Invitation This is the recommended method to use for searching invitations; Consider that the performance of the method will be greatly influenced by the limit specified
      Specified by:
      searchInvitation in interface InvitationService
      Parameters:
      criteria - search criteria
      limit - maximum number of IDs to return. If less than 1, there is no limit.
      Returns:
      the list of invitations
    • setWorkflowService

      public void setWorkflowService(WorkflowService workflowService)
      Set the workflow service
      Parameters:
      workflowService - WorkflowService
    • setWorkflowAdminService

      public void setWorkflowAdminService(WorkflowAdminService workflowAdminService)
      Parameters:
      workflowAdminService - the workflowAdminService to set
    • getWorkflowService

      public WorkflowService getWorkflowService()
      Returns:
      the workflow service
    • setActionService

      public void setActionService(ActionService actionService)
      Parameters:
      actionService - the actionService to set
    • setPersonService

      public void setPersonService(PersonService personService)
    • getPersonService

      public PersonService getPersonService()
    • setSiteService

      public void setSiteService(SiteService siteService)
    • getSiteService

      public SiteService getSiteService()
    • setAuthenticationService

      public void setAuthenticationService(MutableAuthenticationService authenticationService)
    • getAuthenticationService

      public MutableAuthenticationService getAuthenticationService()
    • setUserNameGenerator

      public void setUserNameGenerator(UserNameGenerator usernameGenerator)
    • getUserNameGenerator

      public UserNameGenerator getUserNameGenerator()
    • setPasswordGenerator

      public void setPasswordGenerator(PasswordGenerator passwordGenerator)
    • getPasswordGenerator

      public PasswordGenerator getPasswordGenerator()
    • setDictionaryService

      public void setDictionaryService(DictionaryService dictionaryService)
    • setNamespaceService

      public void setNamespaceService(NamespaceService namespaceService)
    • getNamespaceService

      public NamespaceService getNamespaceService()
    • setPermissionService

      public void setPermissionService(PermissionService permissionService)
    • getPermissionService

      public PermissionService getPermissionService()
    • setNodeService

      public void setNodeService(NodeService nodeService)
    • getNodeService

      public NodeService getNodeService()
    • updateModeratedInvitation

      public ModeratedInvitation updateModeratedInvitation(String inviteeId, String siteShortName, String inviteeComments)
      Description copied from interface: InvitationService
      Update the invitee comments for an existing moderated invitation
      Specified by:
      updateModeratedInvitation in interface InvitationService
      Returns:
      the invitation
    • beforeDeleteNode

      public void beforeDeleteNode(NodeRef nodeRef)
      NodeServicePolicies.BeforeDeleteNodePolicy Called immediatly prior to deletion of a web site.
      Specified by:
      beforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicy
      Parameters:
      nodeRef - the node reference
    • generateWorkflowDescription

      protected String generateWorkflowDescription(SiteInfo siteInfo, String messageId)
      Generates a description for the workflow
      Parameters:
      siteInfo - The site to generate a description for
      messageId - The resource bundle key to use for the description
      Returns:
      The workflow description
    • setSendEmails

      public void setSendEmails(boolean sendEmails)
      Parameters:
      sendEmails - the sendEmails to set
    • isSendEmails

      public boolean isSendEmails()
      Specified by:
      isSendEmails in interface InvitationService
      Returns:
      true if emails are sent on invite.
    • setSysAdminParams

      public void setSysAdminParams(SysAdminParams sysAdminParams)
    • setTemplateService

      public void setTemplateService(TemplateService templateService)
    • setMessageService

      public void setMessageService(MessageService messageService)
      Parameters:
      messageService - the messageService to set
    • setRepositoryHelper

      public void setRepositoryHelper(Repository repositoryHelper)
      Parameters:
      repositoryHelper - the repositoryHelper to set
    • setServiceRegistry

      public void setServiceRegistry(ServiceRegistry serviceRegistry)
      Parameters:
      serviceRegistry - the serviceRegistry to set
    • acceptNominatedInvitation

      public void acceptNominatedInvitation(String siteName, String invitee, String role, String inviter)
      Description copied from interface: InvitationService
      Moderator approves this invitation
      Specified by:
      acceptNominatedInvitation in interface InvitationService
    • approveModeratedInvitation

      public void approveModeratedInvitation(String siteName, String invitee, String role, String reviewer)
      Description copied from interface: InvitationService
      Moderator approves this invitation
      Specified by:
      approveModeratedInvitation in interface InvitationService
    • addSiteMembership

      public void addSiteMembership(String invitee, String siteName, String role, String runAsUser, boolean overrideExisting)
      Add Invitee to Site with the site role that the inviter "started" the invite process with
      Parameters:
      invitee -
      siteName -
      role -
      runAsUser -
      siteService -
      overrideExisting -
    • rejectModeratedInvitation

      public void rejectModeratedInvitation(String siteName, String invitee, String role, String reviewer, String resourceType, String reviewComments)
      Description copied from interface: InvitationService
      Moderator rejects this invitation
      Specified by:
      rejectModeratedInvitation in interface InvitationService
    • deleteAuthenticationIfUnused

      public void deleteAuthenticationIfUnused(String invitee, String currentInviteId)
      Description copied from interface: InvitationService
      Clean up invitee user account and person node when no longer in use. They are deemed to no longer be in use when the invitee user account is still disabled and there are no outstanding pending invites for that invitee.
      Specified by:
      deleteAuthenticationIfUnused in interface InvitationService
    • sendNominatedInvitation

      public void sendNominatedInvitation(String inviteId, Map<String,Object> executionVariables)
      Description copied from interface: InvitationService
      Implemented for backwards compatibility
      Specified by:
      sendNominatedInvitation in interface InvitationService
    • sendNominatedInvitation

      public void sendNominatedInvitation(String inviteId, String emailTemplateXpath, String emailSubjectKey, Map<String,Object> executionVariables)
      Description copied from interface: InvitationService
      Sends the invite email using the given template, subject localization key, and variables.
      Specified by:
      sendNominatedInvitation in interface InvitationService
      emailTemplateXpath - the XPath to the email template in the repository
      emailSubjectKey - the subject of the email
      executionVariables - the variables used to populate the email
    • sendModeratedInvitation

      public void sendModeratedInvitation(String inviteId, String emailTemplateXpath, String emailSubjectKey, Map<String,Object> executionVariables)
      Description copied from interface: InvitationService
      Sends the site join request notification email using the given template, subject localization key, and variables.
      Specified by:
      sendModeratedInvitation in interface InvitationService
    • cancelInvitation

      public void cancelInvitation(String siteName, String invitee, String inviteId, String currentInviteId)
      Description copied from interface: InvitationService
      Inviter cancels this invitation
      Specified by:
      cancelInvitation in interface InvitationService
    • inviteModerated

      public ModeratedInvitation inviteModerated(String inviteeComments, String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String clientName)
      Start the invitation process for a ModeratedInvitation
      Specified by:
      inviteModerated in interface InvitationService
      Parameters:
      inviteeComments - why does the invitee want access to the resource ?
      inviteeUserName - who is to be invited
      resourceType - Invitation .ResourceType what resource type ?
      resourceName - which resource
      inviteeRole - which role ?
      clientName - which client