Subversion Repositories linshare

[/] [branches/] [0.7/] [linshare/] [src/] [main/] [java/] [org/] [linagora/] [linShare/] [core/] [Facade/] [impl/] [ShareFacadeImpl.java] - Diff between revs 41 and 167

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 41 Rev 167
Line 136... Line 136...
                return results;
                return results;
        }
        }
 
 
        public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMail(
        public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMail(
                        UserVo owner, List<DocumentVo> documents, List<UserVo> recipients,
                        UserVo owner, List<DocumentVo> documents, List<UserVo> recipients,
                        String comment, String message, String messageTxt,String subject,
                        String comment, String messageInternal, String messageInternalTxt,
 
                        String messageGuest, String messageGuestTxt, String subject,
                        Calendar expirationDate) throws BusinessException {
                        Calendar expirationDate) throws BusinessException {
 
 
                SuccessesAndFailsItems<ShareDocumentVo> result = createSharing(owner,documents,recipients, comment, expirationDate);
                SuccessesAndFailsItems<ShareDocumentVo> result = createSharing(owner,documents,recipients, comment, expirationDate);
 
 
                //Sending the mails
                //Sending the mails
Line 151... Line 152...
                        }
                        }
 
 
                }
                }
                for(UserVo userVo : successfullRecipient){
                for(UserVo userVo : successfullRecipient){
                        logger.debug("Sending sharing notification to user " + userVo.getLogin());
                        logger.debug("Sending sharing notification to user " + userVo.getLogin());
                        notifierService.sendNotification(owner.getMail(),userVo.getMail(), subject, message,messageTxt);
                        if (userVo.isGuest()) {
 
                                notifierService.sendNotification(owner.getMail(),userVo.getMail(), subject, messageGuest,messageGuestTxt);
 
                        } else {
 
                                notifierService.sendNotification(owner.getMail(),userVo.getMail(), subject, messageInternal,messageInternalTxt);
 
                        }
                }
                }
                return result;
                return result;
        }
        }
 
 
 
 
Line 216... Line 221...
 
 
 
 
    public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMailUsingRecipientsEmail(
    public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMailUsingRecipientsEmail(
                        UserVo owner, List<DocumentVo> documents,
                        UserVo owner, List<DocumentVo> documents,
                        List<String> recipientsEmail, String comment, String subject,
                        List<String> recipientsEmail, String comment, String subject,
                        String linShareUrl, boolean secureSharing,
                        String linShareUrlInternal, String linShareUrlAnonymous, boolean secureSharing,
                        String sharedTemplateContent, String sharedTemplateContentTxt,
                        String sharedTemplateContent, String sharedTemplateContentTxt,
                        String passwordSharedTemplateContent,
                        String passwordSharedTemplateContent,
                        String passwordSharedTemplateContentTxt)
                        String passwordSharedTemplateContentTxt)
                        throws BusinessException {
                        throws BusinessException {
                return createSharingWithMailUsingRecipientsEmailAndExpiryDate(owner, documents, recipientsEmail, comment, subject, linShareUrl, secureSharing, sharedTemplateContent, sharedTemplateContentTxt, passwordSharedTemplateContent, passwordSharedTemplateContentTxt, null);
                return createSharingWithMailUsingRecipientsEmailAndExpiryDate(owner, documents, recipientsEmail, comment, subject, linShareUrlInternal, linShareUrlAnonymous, secureSharing, sharedTemplateContent, sharedTemplateContentTxt, passwordSharedTemplateContent, passwordSharedTemplateContentTxt, null);
        }
        }
 
 
 
 
    public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMailUsingRecipientsEmailAndExpiryDate(
    public SuccessesAndFailsItems<ShareDocumentVo> createSharingWithMailUsingRecipientsEmailAndExpiryDate(
                        UserVo owner, List<DocumentVo> documents,
                        UserVo owner, List<DocumentVo> documents,
                        List<String> recipientsEmail, String comment, String subject,
                        List<String> recipientsEmail, String comment, String subject,
                        String linShareUrl, boolean secureSharing,
                        String linShareUrlInternal, String linShareUrlAnonymous, boolean secureSharing,
                        String sharedTemplateContent, String sharedTemplateContentTxt,
                        String sharedTemplateContent, String sharedTemplateContentTxt,
                        String passwordSharedTemplateContent,
                        String passwordSharedTemplateContent,
                        String passwordSharedTemplateContentTxt, Calendar expiryDateSelected)
                        String passwordSharedTemplateContentTxt, Calendar expiryDateSelected)
                        throws BusinessException {
                        throws BusinessException {
                User u = null;
                User u = null;
Line 247... Line 252...
                //TEMPLATE sharedTemplateContent
                //TEMPLATE sharedTemplateContent
                templateParams.put("${message}", comment);
                templateParams.put("${message}", comment);
                templateParams.put("${firstName}", owner.getFirstName());
                templateParams.put("${firstName}", owner.getFirstName());
                templateParams.put("${lastName}", owner.getLastName());
                templateParams.put("${lastName}", owner.getLastName());
                templateParams.put("${number}", new Integer(documents.size()).toString());
                templateParams.put("${number}", new Integer(documents.size()).toString());
                templateParams.put("${url}", linShareUrl);
                templateParams.put("${url}", linShareUrlInternal); //modified later for anonymous user and guest
                templateParams.put("${urlparam}", "");
                templateParams.put("${urlparam}", "");
 
 
                StringBuffer names = new StringBuffer();
                StringBuffer names = new StringBuffer();
                StringBuffer namesTxt = new StringBuffer();
                StringBuffer namesTxt = new StringBuffer();
 
 
Line 261... Line 266...
                }
                }
 
 
                templateParams.put("${documentNames}", names.toString());
                templateParams.put("${documentNames}", names.toString());
                templateParams.put("${documentNamesTxt}", namesTxt.toString());
                templateParams.put("${documentNamesTxt}", namesTxt.toString());
 
 
                String messageForInternalUserAndGuest = templating.getMessage(sharedTemplateContent, templateParams);
                String messageForInternalUser = templating.getMessage(sharedTemplateContent, templateParams);
                String messageForInternalUserAndGuestTxt = templating.getMessage(sharedTemplateContentTxt, templateParams);
                String messageForInternalUserTxt = templating.getMessage(sharedTemplateContentTxt, templateParams);
 
                templateParams.put("${url}", linShareUrlAnonymous);
 
                String messageForGuestUser = templating.getMessage(sharedTemplateContent, templateParams);
 
                String messageForGuestUserTxt = templating.getMessage(sharedTemplateContentTxt, templateParams);
 
 
                // find known and unknown recipients of the share
                // find known and unknown recipients of the share
                for (String mail : recipientsEmail) {
                for (String mail : recipientsEmail) {
                        u = userService.findUser(mail);
                        u = userService.findUser(mail);
                        if(u!=null){
                        if(u!=null){
Line 299... Line 307...
                        securedUrl = shareService.shareDocumentsWithSecuredUrlToUser(owner, docList, password, unKnownRecipientsEmail, expiryDateSelected);
                        securedUrl = shareService.shareDocumentsWithSecuredUrlToUser(owner, docList, password, unKnownRecipientsEmail, expiryDateSelected);
 
 
 
 
                        //compose the secured url to give in mail
                        //compose the secured url to give in mail
                        StringBuffer httpUrlBase = new StringBuffer();
                        StringBuffer httpUrlBase = new StringBuffer();
                        httpUrlBase.append(linShareUrl);
                        httpUrlBase.append(linShareUrlAnonymous);
                        if(!linShareUrl.endsWith("/")) httpUrlBase.append("/");
                        if(!linShareUrlAnonymous.endsWith("/")) httpUrlBase.append("/");
                        httpUrlBase.append(securedUrl.getUrlPath());
                        httpUrlBase.append(securedUrl.getUrlPath());
                        if(!securedUrl.getUrlPath().endsWith("/")) httpUrlBase.append("/");
                        if(!securedUrl.getUrlPath().endsWith("/")) httpUrlBase.append("/");
                        httpUrlBase.append(securedUrl.getAlea());
                        httpUrlBase.append(securedUrl.getAlea());
 
 
                        //securedUrl must be ended with a "/" if no parameter (see urlparam)
                        //securedUrl must be ended with a "/" if no parameter (see urlparam)
Line 329... Line 337...
                        }
                        }
 
 
                }
                }
 
 
                //keep old method to share with user referenced in db
                //keep old method to share with user referenced in db
                return createSharingWithMail(owner, documents, knownRecipients, comment, messageForInternalUserAndGuest, messageForInternalUserAndGuestTxt, subject, expiryDateSelected);
                return createSharingWithMail(owner, documents, knownRecipients, comment, messageForInternalUser, messageForInternalUserTxt,messageForGuestUser, messageForGuestUserTxt, subject, expiryDateSelected);
        }
        }
 
 
 
 
    public void sendDownloadNotification(ShareDocumentVo sharedDocument, UserVo currentUser, String subject, String downloadTemplateContent,String downloadTemplateContentTxt) {
    public void sendDownloadNotification(ShareDocumentVo sharedDocument, UserVo currentUser, String subject, String downloadTemplateContent,String downloadTemplateContentTxt) {
        //Setting parameters and values for supply the template.
        //Setting parameters and values for supply the template.