protected Set<Timer> buildTimers(String kaleoClassName, long kaleoClassPK) throws PortalException, SystemException { List<KaleoTimer> kaleoTimers = kaleoTimerLocalService.getKaleoTimers(kaleoClassName, kaleoClassPK); Set<Timer> timers = new HashSet<Timer>(kaleoTimers.size()); for (KaleoTimer kaleoTimer : kaleoTimers) { Timer timer = new Timer(kaleoTimer.getName(), kaleoTimer.getDescription(), kaleoTimer.isBlocking()); timers.add(timer); DelayDuration delayDuration = new DelayDuration(kaleoTimer.getDuration(), DurationScale.parse(kaleoTimer.getScale())); timer.setDelayDuration(delayDuration); String recurrenceScale = kaleoTimer.getRecurrenceScale(); if (Validator.isNotNull(recurrenceScale)) { DelayDuration recurrenceDelayDuration = new DelayDuration( kaleoTimer.getRecurrenceDuration(), DurationScale.parse(recurrenceScale)); timer.setRecurrence(recurrenceDelayDuration); } Set<Action> timerActions = buildActions(KaleoTimer.class.getName(), kaleoTimer.getKaleoTimerId()); timer.setActions(timerActions); Set<Assignment> reassignments = buildAssigments(KaleoTimer.class.getName(), kaleoTimer.getKaleoTimerId()); timer.setReassignments(reassignments); Set<Notification> timerNotifications = buildNotifications(KaleoTimer.class.getName(), kaleoTimer.getKaleoTimerId()); timer.setNotifications(timerNotifications); } return timers; }
public int compareTo(KaleoTimer kaleoTimer) { int value = 0; if (getKaleoTimerId() < kaleoTimer.getKaleoTimerId()) { value = -1; } else if (getKaleoTimerId() > kaleoTimer.getKaleoTimerId()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; }