public void onEvent(int eventType, Integration integration, HttpServletRequest request) {
if (eventType == INTEGRATION_READY_EVENT) {
try {
MessageResources resources = (MessageResources)request.getAttribute(Globals.MESSAGES_KEY);
EmailMessage email = EmailMessageFactory.createMessage();
email.setFrom((String)xplannerProperties.get().get("xplanner.mail.from"));
email.setRecipient(integration.getPersonId());
email.setCcRecipients((String)xplannerProperties.get().get("xplanner.integration.mail.cc"));
email.setSubject(resources.getMessage("integrations.notification.subject"));
String link = request.getScheme() + "://" + request.getServerName() + ":" +
request.getServerPort() + request.getContextPath() +
"/do/view/integrations?projectId=" + integration.getProjectId();
email.setBody(resources.getMessage("integrations.notification.text", link));
email.send();
} catch (Exception ex) {
log.error("couldn't send notification", ex);
}
}
}