protected Timer parseTimerElement(Element timerElement, boolean isTaskTimer) {

    String name = timerElement.elementText("name");
    String description = timerElement.elementText("description");
    boolean blocking = GetterUtil.getBoolean(timerElement.elementText("blocking"), !isTaskTimer);

    Timer timer = new Timer(name, description, blocking);

    Element delayElement = timerElement.element("delay");

    DelayDuration delayDuration = parseDelay(delayElement);

    timer.setDelayDuration(delayDuration);

    if (!blocking) {
      Element recurrenceElement = timerElement.element("recurrence");

      DelayDuration recurrence = parseDelay(recurrenceElement);

      timer.setRecurrence(recurrence);
    }

    Element timerActions = timerElement.element("timer-actions");

    parseTimerActions(timerActions, timer);

    return timer;
  }
  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;
  }