while (notifications.hasNext()) { CmsContentNotification contentNotification = (CmsContentNotification)notifications.next(); CmsUser responsible = contentNotification.getResponsible();
while (notifications.hasNext()) { CmsContentNotification contentNotification = notifications.next(); CmsUser responsible = contentNotification.getResponsible();
/** * Sends all notifications to the responsible users.<p> * * @return a string listing all responsibles that a notification was sent to * * @throws CmsException if something goes wrong */ public String notifyResponsibles() throws CmsException { Iterator<CmsContentNotification> notifications = filterConfirmedResources(getContentNotifications()).iterator(); if (notifications.hasNext()) { StringBuffer result = new StringBuffer( Messages.get().getBundle().key(Messages.LOG_NOTIFICATIONS_SENT_TO_0)); result.append(' '); while (notifications.hasNext()) { CmsContentNotification contentNotification = notifications.next(); result.append(contentNotification.getResponsible().getName()); if (notifications.hasNext()) { result.append(", "); } try { contentNotification.send(); } catch (EmailException e) { LOG.error(e.getLocalizedMessage(), e); } } return result.toString(); } else { return Messages.get().getBundle().key(Messages.LOG_NO_NOTIFICATIONS_SENT_0); } }
/** * Sends all notifications to the responsible users.<p> * * @return a string listing all responsibles that a notification was sent to * * @throws CmsException if something goes wrong */ public String notifyResponsibles() throws CmsException { Iterator notifications = filterConfirmedResources(getContentNotifications()).iterator(); if (notifications.hasNext()) { StringBuffer result = new StringBuffer(Messages.get().getBundle().key(Messages.LOG_NOTIFICATIONS_SENT_TO_0)); result.append(' '); while (notifications.hasNext()) { CmsContentNotification contentNotification = (CmsContentNotification)notifications.next(); result.append(contentNotification.getResponsible().getName()); if (notifications.hasNext()) { result.append(", "); } try { contentNotification.send(); } catch (EmailException e) { LOG.error(e.getLocalizedMessage(), e); } } return result.toString(); } else { return Messages.get().getBundle().key(Messages.LOG_NO_NOTIFICATIONS_SENT_0); } }