Search in sources :

Example 1 with QuickShareEmailRequest

use of org.alfresco.repo.quickshare.QuickShareServiceImpl.QuickShareEmailRequest in project alfresco-remote-api by Alfresco.

the class QuickShareLinksImpl method emailSharedLink.

@Override
public void emailSharedLink(String sharedId, QuickShareLinkEmailRequest emailRequest, Parameters parameters) {
    checkEnabled();
    checkValidShareId(sharedId);
    validateEmailRequest(emailRequest);
    try {
        NodeRef nodeRef = quickShareService.getTenantNodeRefFromSharedId(sharedId).getSecond();
        String sharedNodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
        QuickShareEmailRequest request = new QuickShareEmailRequest();
        request.setSharedNodeName(sharedNodeName);
        request.setClient(emailRequest.getClient());
        request.setSharedId(sharedId);
        request.setSenderMessage(emailRequest.getMessage());
        request.setLocale(I18NUtil.parseLocale(emailRequest.getLocale()));
        request.setToEmails(emailRequest.getRecipientEmails());
        quickShareService.sendEmailNotification(request);
    } catch (InvalidSharedIdException ex) {
        throw new EntityNotFoundException(sharedId);
    } catch (InvalidNodeRefException inre) {
        logger.warn("Unable to find: " + sharedId + " [" + inre.getNodeRef() + "]");
        throw new EntityNotFoundException(sharedId);
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) InvalidSharedIdException(org.alfresco.service.cmr.quickshare.InvalidSharedIdException) QuickShareEmailRequest(org.alfresco.repo.quickshare.QuickShareServiceImpl.QuickShareEmailRequest) InvalidNodeRefException(org.alfresco.service.cmr.repository.InvalidNodeRefException) EntityNotFoundException(org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)

Aggregations

QuickShareEmailRequest (org.alfresco.repo.quickshare.QuickShareServiceImpl.QuickShareEmailRequest)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 InvalidSharedIdException (org.alfresco.service.cmr.quickshare.InvalidSharedIdException)1 InvalidNodeRefException (org.alfresco.service.cmr.repository.InvalidNodeRefException)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1