if (header.getFrom() != null && header.getFrom().trim().length() > 0) { User user = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) user).setId(header.getFrom()); msg.setFrom( new InternetAddress(userInfo.getEmailForEntity(user))); } else { if (header.getReplyTo() != null && header.getReplyTo().trim().length() > 0) { User user = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) user).setId(header.getReplyTo()); msg.setReplyTo( new InternetAddress[] { new InternetAddress(userInfo.getEmailForEntity(user))}); String subject = (String) TemplateRuntime.eval(header.getSubject(), vars); String body = (String) TemplateRuntime.eval(header.getBody(), vars);
private Notification buildDefaultNotification( TaskData taskData,Task task ){ EmailNotification emailNotificationImpl = TaskModelProvider.getFactory().newEmialNotification(); Map<Language, EmailNotificationHeader> map = new HashMap<Language, EmailNotificationHeader>(); EmailNotificationHeader emailNotificationHeaderImpl = TaskModelProvider.getFactory().newEmailNotificationHeader(); emailNotificationHeaderImpl.setBody(buildDefafultEmailBody(taskData,task)); emailNotificationHeaderImpl.setFrom(fromUser); emailNotificationHeaderImpl.setReplyTo(fromUser); emailNotificationHeaderImpl.setLanguage("en-UK"); emailNotificationHeaderImpl.setSubject(buildDefafultEmailSubject(taskData, task)); Language language = TaskModelProvider.getFactory().newLanguage(); language.setMapkey("en-UK"); map.put(language, emailNotificationHeaderImpl); emailNotificationImpl.setEmailHeaders(map); List<OrganizationalEntity> recipients = new ArrayList<OrganizationalEntity>(); recipients.add(taskData.getActualOwner()); emailNotificationImpl.setRecipients(recipients); return emailNotificationImpl; }
@Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal( out ); if ( emailHeaders != null ) { out.writeInt( emailHeaders.size() ); for ( EmailNotificationHeader header : emailHeaders.values() ) { header.writeExternal( out ); } } else { out.writeInt( 0 ); } }
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody());
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertTrue((header.getBody().indexOf("http://localhost:8080/taskserver-url") != -1));
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody()); assertEquals("mike", header.getFrom()); assertEquals("mike", header.getReplyTo());
emailHeader.setBody(parameters.get("body")); emailHeader.setFrom(parameters.get("from")); emailHeader.setReplyTo(parameters.get("replyto")); emailHeader.setLanguage(locale); emailHeader.setSubject(parameters.get("subject")); ((InternalI18NText) subject).setText(emailHeader.getSubject());;
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody()); header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody());
@Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal( out ); if ( emailHeaders != null ) { out.writeInt( emailHeaders.size() ); for ( EmailNotificationHeader header : emailHeaders.values() ) { header.writeExternal( out ); } } else { out.writeInt( 0 ); } }
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody()); assertEquals("mike", header.getFrom()); assertEquals("mike", header.getReplyTo());
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody());
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertTrue((header.getBody().indexOf("http://localhost:8080/taskserver-url") != -1));
EmailNotificationHeader header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody()); header = emailNotification.getEmailHeaders().get(lang); assertNotNull(header); assertEquals("Test of notification", header.getSubject()); assertEquals("And here is the body", header.getBody());