sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 53085 - http://anonsvn.icesoft.org/repo / icenotify / trunk / icenotify / cloud / src / main / java / org / icesoft / notify / cloud / core / email / EmailConnection.java
Unified Diff View - EmailConnection.java
/icenotify/trunk/icenotify/cloud/src/main/java/org/icesoft/notify/cloud/core/email/EmailConnection.java @ revision 53084
/icenotify/trunk/icenotify/cloud/src/main/java/org/icesoft/notify/cloud/core/email/EmailConnection.java @ revision 53085
@@ -135,8 +135,7 @@     public void send(final EmailNotification notification)     throws IOException { -        List<CloudNotificationEndpoint> _cloudNotificationEndpointList = -            notification.getCloudNotificationEndpointList(); +        CloudNotificationEndpoint _cloudNotificationEndpoint = notification.getNotificationEndpoint();         ParameterizedRunnable<Map<String, Object>> _failed;         Runnable _failedPermanently;         Runnable _succeeded; @@ -173,31 +172,16 @@                 setContent(                     notification.getContent(), notification.getContentType()                 ); -            if (_cloudNotificationEndpointList.size() == 1) { -                Set<InternetAddress> _toSet = new HashSet<InternetAddress>(); -                for (final CloudNotificationEndpoint _cloudNotificationEndpoint : _cloudNotificationEndpointList) { -                    _toSet.add( -                        // throws AddressException -                        new InternetAddress(_cloudNotificationEndpoint.getNotifyBackURI().substring("mailto:".length())) -                    ); -                } -                _mimeMessage. -                    // throws IllegalStateException, IllegalWriteException, MessagingException -                    setRecipients( -                        Message.RecipientType.TO, _toSet.toArray(new InternetAddress[_toSet.size()]) -                    ); -            } else { -                Set<InternetAddress> _bccSet = new HashSet<InternetAddress>(); -                for (final CloudNotificationEndpoint _cloudNotificationEndpoint : _cloudNotificationEndpointList) { -                    _bccSet.add( -                        // throws IllegalStateException, IllegalWriteException, MessagingException -                        new InternetAddress(_cloudNotificationEndpoint.getNotifyBackURI().substring("mailto:".length())) -                    ); -                } -                _mimeMessage.setRecipients( -                    Message.RecipientType.BCC, _bccSet.toArray(new InternetAddress[_bccSet.size()]) +            Set<InternetAddress> _toSet = new HashSet<InternetAddress>(); +            _toSet.add( +                // throws AddressException +                new InternetAddress(_cloudNotificationEndpoint.getNotifyBackURI().substring("mailto:".length())) +            ); +            _mimeMessage. +                // throws IllegalStateException, IllegalWriteException, MessagingException +                setRecipients( +                    Message.RecipientType.TO, _toSet.toArray(new InternetAddress[_toSet.size()])                 ); -            }             Transport _transport =                 getSession().                     // throws NoSuchProviderException @@ -209,49 +193,41 @@                 // throws SendFailedException, MessagingException                 sendMessage(_mimeMessage, _mimeMessage.getAllRecipients());             Date _handOffTime = new Date(System.currentTimeMillis()); -            for (int _index = 0; _index < _cloudNotificationEndpointList.size(); _index++) { -                if (LOGGER.isLoggable(Level.FINE)) { -                    String _batchID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("batchID"); -                    String _pushID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("pushID"); -                    if (isNotNull(_batchID) && isNotNull(_pushID)) { -                        LOGGER.log( -                            Level.FINE, -                            "<short> | " + -                                Json.createObjectBuilder(). -                                    add("batchId", _batchID). -                                    add("pushId", _pushID). -                                    add("handOffTime", System.currentTimeMillis()). -                                    build(). -                                    toString() -                        ); -                    } -                } -                Map<String, Object> _propertyMap = new HashMap<String, Object>(); -                _propertyMap.put( -                    "account", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("account") -                ); -                _propertyMap.put( -                    "realm", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("realm") -                ); -                _propertyMap.put( -                    "notificationLogID", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("notificationLogID") -                ); -                _propertyMap.put( -                    "handOffTime", -                    _handOffTime -                ); -                getNotificationProvider().fireHandOffEvent(new NotificationEvent(_propertyMap, this)); -                Runnable _attempted = -                    (Runnable)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("attempted"); -                if (isNotNull(_attempted)) { -                    _attempted.run(); +            if (LOGGER.isLoggable(Level.FINE)) { +                String _batchID = (String)_cloudNotificationEndpoint.getPropertyMap().get("batchID"); +                String _pushID = (String)_cloudNotificationEndpoint.getPropertyMap().get("pushID"); +                if (isNotNull(_batchID) && isNotNull(_pushID)) { +                    LOGGER.log( +                        Level.FINE, +                        "<short> | " + +                            Json.createObjectBuilder(). +                                add("batchId", _batchID). +                                add("pushId", _pushID). +                                add("handOffTime", System.currentTimeMillis()). +                                build(). +                                toString() +                    );                 }             } +            Map<String, Object> _propertyMap; +            _propertyMap = new HashMap<String, Object>(); +            _propertyMap.put( +                "account", _cloudNotificationEndpoint.getPropertyMap().get("account") +            ); +            _propertyMap.put( +                "realm", _cloudNotificationEndpoint.getPropertyMap().get("realm") +            ); +            _propertyMap.put( +                "notificationLogID", _cloudNotificationEndpoint.getPropertyMap().get("notificationLogID") +            ); +            _propertyMap.put( +                "handOffTime", _handOffTime +            ); +            getNotificationProvider().fireHandOffEvent(new NotificationEvent(_propertyMap, this)); +            Runnable _attempted = (Runnable)_cloudNotificationEndpoint.getPropertyMap().get("attempted"); +            if (isNotNull(_attempted)) { +                _attempted.run(); +            }             if (LOGGER.isLoggable(Level.FINE)) {                 LOGGER.log(                     Level.FINE, @@ -260,112 +236,93 @@                 );             }             Date _successTime = new Date(System.currentTimeMillis()); -            for (int _index = 0; _index < _cloudNotificationEndpointList.size(); _index++) { -                if (LOGGER.isLoggable(Level.FINE)) { -                    String _batchID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("batchID"); -                    String _pushID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("pushID"); -                    if (isNotNull(_batchID) && isNotNull(_pushID)) { -                        LOGGER.log( -                            Level.FINE, -                            "<short> | " + -                                Json.createObjectBuilder(). -                                    add("batchId", _batchID). -                                    add("pushId", _pushID). -                                    add("successTime", System.currentTimeMillis()). -                                    build(). -                                    toString() -                        ); -                    } -                } -                Map<String, Object> _propertyMap = new HashMap<String, Object>(); -                _propertyMap.put( -                    "account", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("account") -                ); -                _propertyMap.put( -                    "realm", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("realm") -                ); -                _propertyMap.put( -                    "notificationLogID", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("notificationLogID") -                ); -                _propertyMap.put( -                    "unitsConsumed", -                    1 -                ); -                _propertyMap.put( -                    "successTime", -                    _successTime -                ); -                _propertyMap.put( -                    "removeFailure", -                    true -                ); -                getNotificationProvider().fireSuccessEvent(new NotificationEvent(_propertyMap, this)); -                _succeeded = -                    (Runnable)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("succeeded"); -                if (isNotNull(_succeeded)) { -                    _succeeded.run(); +            if (LOGGER.isLoggable(Level.FINE)) { +                String _batchID = (String)_cloudNotificationEndpoint.getPropertyMap().get("batchID"); +                String _pushID = (String)_cloudNotificationEndpoint.getPropertyMap().get("pushID"); +                if (isNotNull(_batchID) && isNotNull(_pushID)) { +                    LOGGER.log( +                        Level.FINE, +                        "<short> | " + +                            Json.createObjectBuilder(). +                                add("batchId", _batchID). +                                add("pushId", _pushID). +                                add("successTime", System.currentTimeMillis()). +                                build(). +                                toString() +                    );                 }             } +            _propertyMap = new HashMap<String, Object>(); +            _propertyMap.put( +                "account", _cloudNotificationEndpoint.getPropertyMap().get("account") +            ); +            _propertyMap.put( +                "realm", _cloudNotificationEndpoint.getPropertyMap().get("realm") +            ); +            _propertyMap.put( +                "notificationLogID", _cloudNotificationEndpoint.getPropertyMap().get("notificationLogID") +            ); +            _propertyMap.put( +                "unitsConsumed", 1 +            ); +            _propertyMap.put( +                "successTime", _successTime +            ); +            _propertyMap.put( +                "removeFailure", true +            ); +            getNotificationProvider().fireSuccessEvent(new NotificationEvent(_propertyMap, this)); +            _succeeded = (Runnable)_cloudNotificationEndpoint.getPropertyMap().get("succeeded"); +            if (isNotNull(_succeeded)) { +                _succeeded.run(); +            }         } catch (final MessagingException exception) {             Date _failureTime = new Date(System.currentTimeMillis());             String _failureReason = exception.getMessage(); -            for (int _index = 0; _index < _cloudNotificationEndpointList.size(); _index++) { -                if (LOGGER.isLoggable(Level.FINE)) { -                    String _batchID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("batchID"); -                    String _pushID = -                        (String)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("pushID"); -                    if (isNotNull(_batchID) && isNotNull(_pushID)) { -                        LOGGER.log( -                            Level.FINE, -                            "<short> | " + -                                Json.createObjectBuilder(). -                                    add("batchId", _batchID). -                                    add("pushId", _pushID). -                                    add("failureTime", System.currentTimeMillis()). -                                    add("failureReason", exception.getMessage()). -                                    build(). -                                    toString() -                        ); -                    } -                } -                Map<String, Object> _propertyMap = new HashMap<String, Object>(); -                _propertyMap.put( -                    "account", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("account") -                ); -                _propertyMap.put( -                    "realm", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("realm") -                ); -                _propertyMap.put( -                    "notificationLogID", -                    _cloudNotificationEndpointList.get(_index).getPropertyMap().get("notificationLogID") -                ); -                _propertyMap.put( -                    "unitsConsumed", 1 -                ); -                _propertyMap.put( -                    "failureTime", _failureTime -                ); -                _propertyMap.put( -                    "failureReason", _failureReason -                ); -                _propertyMap.put( -                    "removeSuccess", true -                ); -                getNotificationProvider().fireFailureEvent(new NotificationEvent(_propertyMap, this)); -                _failedPermanently = -                    (Runnable)_cloudNotificationEndpointList.get(_index).getPropertyMap().get("failedPermanently"); -                if (isNotNull(_failedPermanently)) { -                    _failedPermanently.run(); +            if (LOGGER.isLoggable(Level.FINE)) { +                String _batchID = (String)_cloudNotificationEndpoint.getPropertyMap().get("batchID"); +                String _pushID = (String)_cloudNotificationEndpoint.getPropertyMap().get("pushID"); +                if (isNotNull(_batchID) && isNotNull(_pushID)) { +                    LOGGER.log( +                        Level.FINE, +                        "<short> | " + +                            Json.createObjectBuilder(). +                                add("batchId", _batchID). +                                add("pushId", _pushID). +                                add("failureTime", System.currentTimeMillis()). +                                add("failureReason", exception.getMessage()). +                                build(). +                                toString() +                    );                 }             } +            Map<String, Object> _propertyMap = new HashMap<String, Object>(); +            _propertyMap.put( +                "account", _cloudNotificationEndpoint.getPropertyMap().get("account") +            ); +            _propertyMap.put( +                "realm", _cloudNotificationEndpoint.getPropertyMap().get("realm") +            ); +            _propertyMap.put( +                "notificationLogID", _cloudNotificationEndpoint.getPropertyMap().get("notificationLogID") +            ); +            _propertyMap.put( +                "unitsConsumed", 1 +            ); +            _propertyMap.put( +                "failureTime", _failureTime +            ); +            _propertyMap.put( +                "failureReason", _failureReason +            ); +            _propertyMap.put( +                "removeSuccess", true +            ); +            getNotificationProvider().fireFailureEvent(new NotificationEvent(_propertyMap, this)); +            _failedPermanently = (Runnable)_cloudNotificationEndpoint.getPropertyMap().get("failedPermanently"); +            if (isNotNull(_failedPermanently)) { +                _failedPermanently.run(); +            }             if (LOGGER.isLoggable(Level.WARNING)) {                 LOGGER.log(                     Level.WARNING,


feed icon

sventon 2.5.1