Examples of AlertingException


Examples of uk.ac.bbsrc.tgac.miso.core.exception.AlertingException

    try {
      EmailUtils.send(to, from, subject, text, new Properties());
    } catch (MessagingException e) {
      log.error("Cannot send email to alert recipients:" + e.getMessage());
      throw new AlertingException("Cannot send email to alert recipients", e);
    }
  }
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.exception.AlertingException

        throw new RuntimeException("Cannot persist raised Alert. Specified Alert store is null");
      }
    }
    catch (IOException e) {
      log.error("Cannot save alert to DAO: "+e.getMessage());
      throw new AlertingException("Cannot save alert to DAO", e);
    }
  }
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.exception.AlertingException

  @Override
  public void raiseAlert(Alert a) throws AlertingException {
    if (!mailProps.containsKey("mail.smtp.host")) {
      log.error("No SMTP host specified in the mail.properties configuration file. Cannot send email.");
      throw new AlertingException("No SMTP host specified in the mail.properties configuration file. Cannot send email.");
    }
    else {
      String from = mailProps.getProperty("mail.from");
      if (from == null || "".equals(from)) {
        from = "miso@your.miso.server";
      }

      String to = a.getAlertUser().getEmail();
      String subject = "MISO ALERT: " + a.getAlertTitle();
      String text = "Hello " +
                    a.getAlertUser().getFullName() +
                    ",\n\nMISO would like to tell you about something:\n\n" +
                    a.getAlertTitle() + " ("+a.getAlertDate()+")" +
                    "\n\n" +
                    a.getAlertText();
      try {
        EmailUtils.send(to, from, subject, text, mailProps);
      } catch (MessagingException e) {
        log.error("Cannot send email to alert recipients:" + e.getMessage());
        throw new AlertingException("Cannot send email to alert recipients", e);
      }
    }
  }
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.