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 Set<Notification> buildNotifications(String kaleoClassName, long kaleoClassPK) throws PortalException, SystemException { List<KaleoNotification> kaleoNotifications = kaleoNotificationLocalService.getKaleoNotifications(kaleoClassName, kaleoClassPK); Set<Notification> notifications = new HashSet<Notification>(kaleoNotifications.size()); for (KaleoNotification kaleoNotification : kaleoNotifications) { Notification notification = new Notification( kaleoNotification.getName(), kaleoNotification.getDescription(), kaleoNotification.getExecutionType(), kaleoNotification.getTemplate(), kaleoNotification.getTemplateLanguage()); notifications.add(notification); String notificationTypes = kaleoNotification.getNotificationTypes(); String[] notificationTypeValues = StringUtil.split(notificationTypes, StringPool.COMMA); for (String notificationTypeValue : notificationTypeValues) { notification.addNotificationType(notificationTypeValue); } addNotificationRecipients(kaleoNotification, notification); } return notifications; }
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof KaleoNotification)) { return false; } KaleoNotification kaleoNotification = (KaleoNotification) obj; long primaryKey = kaleoNotification.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } KaleoNotification kaleoNotification = null; try { kaleoNotification = (KaleoNotification) obj; } catch (ClassCastException cce) { return false; } long primaryKey = kaleoNotification.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }
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); } }