Package org.jbpm.cal

Examples of org.jbpm.cal.BusinessCalendar


    Environment.getCurrent().get(JobSession.class).save(timer);

    // we prepare the JobExecutor notification
    long delay = 0;
    if (timer.getRepeat() != null) {
      BusinessCalendar businessCalendar = new BusinessCalendar();
      Duration duration = new Duration(timer.getRepeat());
      delay = businessCalendar.add(new Date(0), duration).getTime();
    }

    toBeScheduledTimers.put(timer.getDbid(),
        new NotificationInfo(timer.getEligibleDate(), delay));
  }
View Full Code Here


    log.info("Re-initialize TimerService");
    // the timers were persisted. We have to schedule notifications
    Collection<Timer> timers =
      Environment.getCurrent().get(JobSession.class)
      .findAllTimers();
    BusinessCalendar businessCalendar = new BusinessCalendar();
    for (Timer timer : timers) {
      Duration duration = new Duration(timer.getRepeat());
      long delay = businessCalendar.add(new Date(0), duration).getTime();
      NotificationInfo notificationInfo =
        new NotificationInfo(timer.getEligibleDate(), delay);

      toBeScheduledTimers.put(timer.getDbid(), notificationInfo);
    }
View Full Code Here

    ExecutionTask task = new ExecutionTask(timer);

    long repeatDelay = 0;
    if (timer.getRepeat() != null) {
      BusinessCalendar businessCalendar = new BusinessCalendar();
      Duration duration = new Duration(timer.getRepeat());
      repeatDelay = businessCalendar.add(new Date(0), duration).getTime();
    }
    try {
      Date eligibleDate = timer.getEligibleDate();
      if (repeatDelay > 0) {
        task.setRepeat();
View Full Code Here

  public static BusinessCalendar parseBusinessCalendarFromXmlString(String xmlString) {
    return (BusinessCalendar) getInstance().parseXmlString(xmlString);
  }

  public Object parseDocumentElement(Element element, Parse parse) {
    BusinessCalendar businessCalendar = new BusinessCalendar();
   
    TimeZone timeZone = null;
    if (element.hasAttribute("timezone")) {
      timeZone = TimeZone.getTimeZone(element.getAttribute("timezone"));
    } else {
      timeZone = TimeZone.getDefault();
    }
    businessCalendar.setTimeZone(timeZone);
   
    String hourFormatText = "HH:mm";
    if (element.hasAttribute("hour-format")) {
      hourFormatText = element.getAttribute("hour-format");
    }
    DateFormat hourFormat = new SimpleDateFormat(hourFormatText);

    Day[] days = new Day[8];
    Element daysElement = XmlUtil.element(element, "days");
    if (daysElement!=null) {
      days[Calendar.SUNDAY] = parseDay(daysElement, "sunday", hourFormat, businessCalendar, parse);
      days[Calendar.MONDAY] = parseDay(daysElement, "monday", hourFormat, businessCalendar, parse);
      days[Calendar.TUESDAY] = parseDay(daysElement, "tuesday", hourFormat, businessCalendar, parse);
      days[Calendar.WEDNESDAY] = parseDay(daysElement, "wednesday", hourFormat, businessCalendar, parse);
      days[Calendar.THURSDAY] = parseDay(daysElement, "thursday", hourFormat, businessCalendar, parse);
      days[Calendar.FRIDAY] = parseDay(daysElement, "friday", hourFormat, businessCalendar, parse);
      days[Calendar.SATURDAY] = parseDay(daysElement, "saturday", hourFormat, businessCalendar, parse);
    }
    businessCalendar.setDays(days);

    String dayFormatText = "dd/MM/yyyy";
    if (element.hasAttribute("day-format")) {
      dayFormatText = element.getAttribute("day-format");
    }
    DateFormat dayFormat = new SimpleDateFormat(dayFormatText);

    Holiday[] holidays = null;
    List<Element> holidayElements = XmlUtil.elements(element, "holiday");
    if (holidayElements!=null) {
      holidays = new Holiday[holidayElements.size()];
      for (int i=0; i<holidayElements.size(); i++) {
        holidays[i] = parseHoliday(holidayElements.get(i), dayFormat, businessCalendar, parse);
      }
    }
    businessCalendar.setHolidays(holidays);
   
    return businessCalendar;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.cal.BusinessCalendar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.