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; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } KaleoTimer kaleoTimer = null; try { kaleoTimer = (KaleoTimer) obj; } catch (ClassCastException cce) { return false; } long primaryKey = kaleoTimer.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }
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; }