Search in sources :

Example 11 with OutboundMessageResponse

use of org.hisp.dhis.outboundmessage.OutboundMessageResponse in project dhis2-core by dhis2.

the class SmsMessageSender method sendMessage.

private OutboundMessageResponse sendMessage(String subject, String text, Set<String> recipients, SmsGatewayConfig gatewayConfig) {
    for (SmsGateway smsGateway : smsGateways) {
        if (smsGateway.accept(gatewayConfig)) {
            log.info("Sending SMS to " + recipients);
            OutboundMessageResponse status = smsGateway.send(subject, text, recipients, gatewayConfig);
            return handleResponse(status);
        }
    }
    return new OutboundMessageResponse(NO_CONFIG, GatewayResponse.NO_GATEWAY_CONFIGURATION, false);
}
Also used : OutboundMessageResponse(org.hisp.dhis.outboundmessage.OutboundMessageResponse)

Aggregations

OutboundMessageResponse (org.hisp.dhis.outboundmessage.OutboundMessageResponse)11 GatewayResponse (org.hisp.dhis.sms.outbound.GatewayResponse)4 IOException (java.io.IOException)2 EmailException (org.apache.commons.mail.EmailException)2 HtmlEmail (org.apache.commons.mail.HtmlEmail)2 EmailConfiguration (org.hisp.dhis.email.EmailConfiguration)2 OutboundMessageResponseSummary (org.hisp.dhis.outboundmessage.OutboundMessageResponseSummary)2 User (org.hisp.dhis.user.User)2 Date (java.util.Date)1 HashSet (java.util.HashSet)1 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)1 OutboundSms (org.hisp.dhis.sms.outbound.OutboundSms)1 UserGroup (org.hisp.dhis.user.UserGroup)1 Async (org.springframework.scheduling.annotation.Async)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)1