config.setSubject(mailElem.getChildText(MAIL_SUBJECT_CHILD));
Element templatesElem = mailElem.getChild(MAIL_TEMPLATES_CHILD);
List<Element> templates = templatesElem.getChildren(MAIL_TEMPLATE_CHILD);
for (Element templateElem : templates) {
MailTemplate template = new MailTemplate();
String operationString = templateElem.getAttributeValue(MAIL_TEMPLATE_OPERATION_ATTR);
Integer operation = Integer.valueOf(operationString);
template.setOperation(operationString);
List<Element> bodyElements = templateElem.getChildren(MAIL_TEMPLATE_BODY_CHILD);
for (Element bodyElement : bodyElements) {
String type = bodyElement.getAttributeValue(MAIL_TEMPLATE_BODY_TYPE_ATTR);
String body = bodyElement.getText();
template.addTemplateBody(type, body);
}
config.addTemplate(operation, template);
}
}