Examples of EmailTemplate


Examples of com.cedarsolutions.shared.domain.email.EmailTemplate

    /** Test sendEmail() for a plaintext template. */
    @Test public void testSendTemplatePlaintext() {
        Map<String, Object> context = new HashMap<String, Object>();

        EmailTemplate template = new EmailTemplate();
        template.setFormat(EmailFormat.PLAINTEXT);
        template.setSender(new EmailAddress("sender-name", "sender-address"));
        template.setReplyTo(new EmailAddress("reply-name", "reply-address"));
        template.setTemplateGroup("g");
        template.setTemplateName("n");
        template.setTemplateContext(context);

        ArgumentCaptor<EmailMessage> email = ArgumentCaptor.forClass(EmailMessage.class);

        GaeEmailService service = createService();
        Message message = mock(Message.class);
        when(service.getGaeEmailUtils().createMessage(isA(EmailMessage.class))).thenReturn(message);
        when(service.getTemplateService().renderTemplate("g", "n", SUBJECT, context)).thenReturn("subject-rendered");
        when(service.getTemplateService().renderTemplate("g", "n", PLAINTEXT, context)).thenReturn("plaintext-rendered");
        when(service.getTemplateService().renderTemplate("g", "n", HTML, context)).thenReturn("html-rendered");

        service.sendEmail(template);

        verify(service.getGaeEmailUtils()).sendMessage(message);
        verify(service.getGaeEmailUtils()).createMessage(email.capture());
        assertEquals(template.getFormat(), email.getValue().getFormat());
        assertEquals(template.getSender(), email.getValue().getSender());
        assertEquals(template.getReplyTo(), email.getValue().getReplyTo());
        assertEquals(template.getRecipients(), email.getValue().getRecipients());
        assertEquals("subject-rendered", email.getValue().getSubject());
        assertEquals("plaintext-rendered", email.getValue().getPlaintext());
        assertEquals(null, email.getValue().getHtml());
    }
View Full Code Here

Examples of com.cedarsolutions.shared.domain.email.EmailTemplate

    /** Test sendEmail() for a multipart template. */
    @Test public void testSendTemplateMultipart() {
        Map<String, Object> context = new HashMap<String, Object>();

        EmailTemplate template = new EmailTemplate();
        template.setFormat(EmailFormat.MULTIPART);
        template.setSender(new EmailAddress("sender-name", "sender-address"));
        template.setReplyTo(new EmailAddress("reply-name", "reply-address"));
        template.setTemplateGroup("g");
        template.setTemplateName("n");
        template.setTemplateContext(context);

        ArgumentCaptor<EmailMessage> email = ArgumentCaptor.forClass(EmailMessage.class);

        GaeEmailService service = createService();
        Message message = mock(Message.class);
        when(service.getGaeEmailUtils().createMessage(isA(EmailMessage.class))).thenReturn(message);
        when(service.getTemplateService().renderTemplate("g", "n", SUBJECT, context)).thenReturn("subject-rendered");
        when(service.getTemplateService().renderTemplate("g", "n", PLAINTEXT, context)).thenReturn("plaintext-rendered");
        when(service.getTemplateService().renderTemplate("g", "n", HTML, context)).thenReturn("html-rendered");

        service.sendEmail(template);

        verify(service.getGaeEmailUtils()).sendMessage(message);
        verify(service.getGaeEmailUtils()).createMessage(email.capture());
        assertEquals(template.getFormat(), email.getValue().getFormat());
        assertEquals(template.getSender(), email.getValue().getSender());
        assertEquals(template.getReplyTo(), email.getValue().getReplyTo());
        assertEquals(template.getRecipients(), email.getValue().getRecipients());
        assertEquals("subject-rendered", email.getValue().getSubject());
        assertEquals("plaintext-rendered", email.getValue().getPlaintext());
        assertEquals("html-rendered", email.getValue().getHtml());
    }
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

            ReminderOption reminderOptionEmail = meeting
                    .getReminder_option_email();
            if (reminderOptionEmail != null) {
                reminderOptionEmailID = reminderOptionEmail.getId();
            }
            EmailTemplate reminderTemplate = meeting.getReminder_template();
            if (reminderTemplate != null) {
                reminderTemplateID = reminderTemplate.getId();
            }
            User assignedTo = meeting.getAssigned_to();
            if (assignedTo != null) {
                this.setAssignedToID(assignedTo.getId());
                this.setAssignedToText(assignedTo.getName());
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

        if (reminderOptionEmailID != null) {
            reminderOptionEmail = reminderOptionService.getEntityById(
                    ReminderOption.class, reminderOptionEmailID);
        }
        meeting.setReminder_option_email(reminderOptionEmail);
        EmailTemplate reminderTemplate = null;
        if (reminderTemplateID != null) {
            reminderTemplate = emailTemplateService.getEntityById(
                    EmailTemplate.class, reminderTemplateID);
        }
        meeting.setReminder_template(reminderTemplate);
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

        endDate = "";
        if (end_date != null) {
            endDate = dateFormat.format(end_date);
        }

        EmailTemplate emailTemplte = emailTemplateService.getEntityById(
                EmailTemplate.class, emailTemplateID);
        this.setText_only(emailTemplte.isText_only());
        this.setSubject(CommonUtil.fromNullToEmpty(emailTemplte.getSubject()));
        String content = "";
        if (this.isText_only()) {
            content = emailTemplte.getText_body();
        } else {
            content = emailTemplte.getHtml_body();
        }
        // Replaces the variable in the body
        if (content != null) {
            content = content.replaceAll("\\$campaign.start_date", startDate);
            content = content.replaceAll("\\$campaign.end_date", endDate);
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

            createChangeLog(changeLogs, entityName, recordID,
                    "entity.reminder_option_email_name.label",
                    oldReminderOption, newReminderOption, loginUser);

            String oldReminderTemplateName = "";
            EmailTemplate oldReminderTemplate = originalMeeting
                    .getReminder_template();
            if (oldReminderTemplate != null) {
                oldReminderTemplateName = CommonUtil
                        .fromNullToEmpty(oldReminderTemplate.getName());
            }
            String newReminderTemplateName = "";
            EmailTemplate newReminderTemplate = meeting.getReminder_template();
            if (newReminderTemplate != null) {
                newReminderTemplateName = CommonUtil
                        .fromNullToEmpty(newReminderTemplate.getName());
            }
            createChangeLog(changeLogs, entityName, recordID,
                    "entity.reminder_template.label", oldReminderTemplateName,
                    newReminderTemplateName, loginUser);
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

        endDate = "";
        if (end_date != null) {
            endDate = dateFormat.format(end_date);
        }

        EmailTemplate emailTemplte = emailTemplateService.getEntityById(
                EmailTemplate.class, emailTemplateID);
        this.setText_only(emailTemplte.isText_only());
        this.setSubject(CommonUtil.fromNullToEmpty(emailTemplte.getSubject()));
        String content = "";
        if (this.isText_only()) {
            content = emailTemplte.getText_body();
        } else {
            content = emailTemplte.getHtml_body();
        }
        // Replaces the variable in the body
        if (content != null) {
            content = content.replaceAll("\\$meeting.subject",
                    CommonUtil.fromNullToEmpty(meeting.getSubject()));
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

            createChangeLog(changeLogs, entityName, recordID,
                    "entity.reminder_option_email_name.label",
                    oldReminderOption, newReminderOption, loginUser);

            String oldReminderTemplateName = "";
            EmailTemplate oldReminderTemplate = originalCall
                    .getReminder_template();
            if (oldReminderTemplate != null) {
                oldReminderTemplateName = CommonUtil
                        .fromNullToEmpty(oldReminderTemplate.getName());
            }
            String newReminderTemplateName = "";
            EmailTemplate newReminderTemplate = call.getReminder_template();
            if (newReminderTemplate != null) {
                newReminderTemplateName = CommonUtil
                        .fromNullToEmpty(newReminderTemplate.getName());
            }
            createChangeLog(changeLogs, entityName, recordID,
                    "entity.reminder_template.label", oldReminderTemplateName,
                    newReminderTemplateName, loginUser);
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

        startDate = "";
        if (start_date != null) {
            startDate = dateFormat.format(start_date);
        }

        EmailTemplate emailTemplte = emailTemplateService.getEntityById(
                EmailTemplate.class, emailTemplateID);
        this.setText_only(emailTemplte.isText_only());
        this.setSubject(CommonUtil.fromNullToEmpty(emailTemplte.getSubject()));
        String content = "";
        if (this.isText_only()) {
            content = emailTemplte.getText_body();
        } else {
            content = emailTemplte.getHtml_body();
        }
        // Replaces the variable in the body
        if (content != null) {
            content = content.replaceAll("\\$call.subject",
                    CommonUtil.fromNullToEmpty(call.getSubject()));
View Full Code Here

Examples of com.gcrm.domain.EmailTemplate

            ReminderOption reminderOptionEmail = call
                    .getReminder_option_email();
            if (reminderOptionEmail != null) {
                reminderOptionEmailID = reminderOptionEmail.getId();
            }
            EmailTemplate reminderTemplate = call.getReminder_template();
            if (reminderTemplate != null) {
                reminderTemplateID = reminderTemplate.getId();
            }
            User assignedTo = call.getAssigned_to();
            if (assignedTo != null) {
                this.setAssignedToID(assignedTo.getId());
                this.setAssignedToText(assignedTo.getName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.