- /**
- * Parses the notifier
- *
- * @return Notifier
- */
- private Notifier parseNotifier(Element aNotifier) {
- String from = aNotifier.elementTextTrim(ELEM_FROM);
- String to = aNotifier.elementTextTrim(ELEM_TO);
- String subject = aNotifier.elementTextTrim(ELEM_SUBJECT);
-
- Element smtp = aNotifier.element(ELEM_SMTP);
- MailServer server = parseMailServer(smtp);
-
- Element format = aNotifier.element(ELEM_FORMAT);
- String htmlXslt = format.elementTextTrim(ELEM_HTML);
- String textXslt = format.elementTextTrim(ELEM_TEXT);
-
- return new MailNotifier(from, to, subject, htmlXslt, textXslt, server, _transformer);
- }
-
- /**
- * Parses the mail server from the XML.
- *
- * @param aSmtp
- * Mail server configuration.
- * @return Mail server.
- */
- private MailServer parseMailServer(Element aSmtp) {
- String host = aSmtp.elementTextTrim(ELEM_HOST);
- Element portElem = aSmtp.element(ELEM_PORT);
- int port = DEFAULT_SMTP_PORT;
- if (portElem != null) {
- port = Integer.valueOf(portElem.getTextTrim());
- }
- String username = aSmtp.elementTextTrim(ELEM_USERNAME);
- String password = aSmtp.elementTextTrim(ELEM_PASSWORD);
-
- return new MailServer(host, port, username, password);
- }
-