}
} // end while (mocIter.hasNext())
} // end if (attendeeVO.getContactID() != actVO.getOwner())
} // end while (attendeesIter.hasNext())
EmailSettingsLocalHome emailSettingsHome = (EmailSettingsLocalHome)ic.lookup("local/EmailSettings");
EmailSettingsLocal emailSettingsRemote = (EmailSettingsLocal)emailSettingsHome.create();
emailSettingsRemote.setDataSource(dataSource);
// get the template definition from the database. Some of it is dynamically configured by
// the Administrator, and some of it is dynamically replaced here
EmailTemplateForm activityTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_ACTIVITES);
// Subject
String activityType = this.getActivityTypeName(actVO.getActivityType());
String activityTitle = basicActivityVO.getTitle();
String subject = activityType + " Invitation: " + activityTitle;
// Body
StringBuffer body = new StringBuffer("");
String bodyTemplate = activityTemplateForm.getBody();
if (bodyTemplate != null && bodyTemplate.length() > 0) {
body.append("\n\n" + bodyTemplate + "\n\n");
}
body.append("Type: " + activityType + "\n");
body.append("Title: " + activityTitle + "\n");
String details = "";
if (basicActivityVO.getActivityDetails() != null && !basicActivityVO.getActivityDetails().equals("")) {
details = basicActivityVO.getActivityDetails();
}
body.append("Details: " + details + "\n\n");
SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
Timestamp startDateTime = basicActivityVO.getActivityStartDate();
if (startDateTime != null) {
String startDate = dateFormatter.format(startDateTime);
body.append("Start: " + startDate + "\n");
}
Timestamp endDateTime = basicActivityVO.getActivityEndDate();
if (endDateTime != null) {
String endDate = dateFormatter.format(endDateTime);
body.append("End: " + endDate + "\n");
}
body.append("Creator: " + basicActivityVO.getOwnerName() + "\n\n");
MailMessageVO mailMessageVO = new MailMessageVO();
mailMessageVO.setFromAddress(fromAddress);
mailMessageVO.setHeaders("X-CentraView-Activity-Invitation: true");
mailMessageVO.setSubject(subject);
mailMessageVO.setBody(body.toString());
mailMessageVO.setContentType(MailMessageVO.PLAIN_TEXT_TYPE);
mailMessageVO.setReceivedDate(new java.util.Date());
if (toList != null && toList.size() != 0) {
mailMessageVO.setToList(toList);
boolean sendFlag = emailSettingsRemote.simpleMessage(userId, mailMessageVO);
}
}
} catch (Exception e) {
logger.error("[Exception] ActivityHelperEJB.extraActions: ", e);
}