public int compareTo(KaleoNotification kaleoNotification) { int value = 0; if (getKaleoNotificationId() < kaleoNotification.getKaleoNotificationId()) { value = -1; } else if (getKaleoNotificationId() > kaleoNotification.getKaleoNotificationId()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; }
protected void addNotificationRecipients( KaleoNotification kaleoNotification, Notification notification) throws PortalException, SystemException { List<KaleoNotificationRecipient> kaleoNotificationRecipients = kaleoNotificationRecipientLocalService.getKaleoNotificationRecipients( kaleoNotification.getKaleoNotificationId()); for (KaleoNotificationRecipient kaleoNotificationRecipient : kaleoNotificationRecipients) { String recipientClassName = kaleoNotificationRecipient.getRecipientClassName(); long recipientClassPK = kaleoNotificationRecipient.getRecipientClassPK(); Recipient recipient = null; if (recipientClassName.equals(RecipientType.ADDRESS.name())) { recipient = new AddressRecipient(kaleoNotificationRecipient.getAddress()); } else if (recipientClassName.equals(RecipientType.ASSIGNEES.name())) { recipient = new AssigneesRecipient(); } else if (recipientClassName.equals(Role.class.getName())) { Role role = _roleLocalService.fetchRole(recipientClassPK); recipient = new RoleRecipient(role.getName(), role.getTypeLabel()); } else if (recipientClassName.equals(User.class.getName())) { if (recipientClassPK > 0) { User user = _userLocalService.getUser(recipientClassPK); recipient = new UserRecipient(user.getUserId(), user.getScreenName(), user.getEmailAddress()); } else { recipient = new UserRecipient(); } } notification.addRecipients(recipient); } }