Search in sources :

Example 1 with NotificationProducer

use of org.nhindirect.gateway.smtp.NotificationProducer in project nhin-d by DirectProject.

the class RESTSmtpAgentConfig method buildMDNSettings.

protected void buildMDNSettings() {
    Setting autoResponseSettings;
    Setting prodNameSetting;
    Setting textSetting;
    try {
        autoResponseSettings = settingsService.getSetting("MDNAutoResponse");
        prodNameSetting = settingsService.getSetting("MDNProdName");
        textSetting = settingsService.getSetting("MDNProdName");
    } catch (Exception e) {
        throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting MDN settings: " + e.getMessage(), e);
    }
    boolean autoResponse = (autoResponseSettings == null) ? true : Boolean.parseBoolean(autoResponseSettings.getValue());
    String prodName = (prodNameSetting == null) ? "" : prodNameSetting.getValue();
    String text = (textSetting == null) ? "" : textSetting.getValue();
    notificationProducer = new NotificationProducer(new NotificationSettings(autoResponse, prodName, text));
}
Also used : SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) NotificationProducer(org.nhindirect.gateway.smtp.NotificationProducer) Setting(org.nhindirect.config.model.Setting) NotificationSettings(org.nhindirect.gateway.smtp.NotificationSettings) AddressException(javax.mail.internet.AddressException) SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) PolicyParseException(org.nhindirect.policy.PolicyParseException)

Example 2 with NotificationProducer

use of org.nhindirect.gateway.smtp.NotificationProducer in project nhin-d by DirectProject.

the class XMLSmtpAgentConfig method buildMDNSettings.

/*
	 * Builds the MDN settings
	 */
private void buildMDNSettings(Node MDNNode) {
    if (MDNNode.getNodeType() == Node.ELEMENT_NODE) {
        Element settingsNode = (Element) MDNNode;
        String autoResponseString = settingsNode.getAttribute("autoResponse");
        boolean autoResponse = (autoResponseString == null || autoResponseString.isEmpty()) ? true : Boolean.parseBoolean(autoResponseString);
        String prodName = settingsNode.getAttribute("productName");
        String text = null;
        Node childNode = MDNNode.getFirstChild();
        do {
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                if (childNode.getNodeName().equalsIgnoreCase("text"))
                    text = childNode.getFirstChild().getNodeValue();
            }
            childNode = childNode.getNextSibling();
        } while (childNode != null);
        notificationProducer = new NotificationProducer(new NotificationSettings(autoResponse, prodName, text));
    }
}
Also used : NotificationProducer(org.nhindirect.gateway.smtp.NotificationProducer) Element(org.w3c.dom.Element) Node(org.w3c.dom.Node) NotificationSettings(org.nhindirect.gateway.smtp.NotificationSettings)

Example 3 with NotificationProducer

use of org.nhindirect.gateway.smtp.NotificationProducer in project nhin-d by DirectProject.

the class WSSmtpAgentConfig method buildMDNSettings.

protected void buildMDNSettings() {
    Setting autoResponseSettings;
    Setting prodNameSetting;
    Setting textSetting;
    try {
        autoResponseSettings = cfService.getSettingByName("MDNAutoResponse");
        prodNameSetting = cfService.getSettingByName("MDNProdName");
        textSetting = cfService.getSettingByName("MDNText");
    } catch (Exception e) {
        throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting MDN settings: " + e.getMessage(), e);
    }
    boolean autoResponse = (autoResponseSettings == null) ? true : Boolean.parseBoolean(autoResponseSettings.getValue());
    String prodName = (prodNameSetting == null) ? "" : prodNameSetting.getValue();
    String text = (textSetting == null) ? "" : textSetting.getValue();
    notificationProducer = new NotificationProducer(new NotificationSettings(autoResponse, prodName, text));
}
Also used : SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) NotificationProducer(org.nhindirect.gateway.smtp.NotificationProducer) Setting(org.nhind.config.Setting) NotificationSettings(org.nhindirect.gateway.smtp.NotificationSettings) AddressException(javax.mail.internet.AddressException) SmtpAgentException(org.nhindirect.gateway.smtp.SmtpAgentException) PolicyParseException(org.nhindirect.policy.PolicyParseException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException)

Aggregations

NotificationProducer (org.nhindirect.gateway.smtp.NotificationProducer)3 NotificationSettings (org.nhindirect.gateway.smtp.NotificationSettings)3 AddressException (javax.mail.internet.AddressException)2 SmtpAgentException (org.nhindirect.gateway.smtp.SmtpAgentException)2 PolicyParseException (org.nhindirect.policy.PolicyParseException)2 IOException (java.io.IOException)1 CertificateException (java.security.cert.CertificateException)1 Setting (org.nhind.config.Setting)1 Setting (org.nhindirect.config.model.Setting)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1