Package org.jbpm.cal

Examples of org.jbpm.cal.Holiday


    return dayPart;
  }

  private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendar businessCalendar, Parse parse) {
    Holiday holiday = new Holiday();
    try {
      if (holidayElement.hasAttribute("date")) {
        String holidayText = holidayElement.getAttribute("date");
        Date holidayDate = dayFormat.parse(holidayText.trim());
        holiday.setToDay(holidayDate);
        holiday.setFromDay(holidayDate);
       
      } else if ( (holidayElement.hasAttribute("from"))
                  && (holidayElement.hasAttribute("to"))
                ) {
        String dayText = holidayElement.getAttribute("from");
        Date dayDate = dayFormat.parse(dayText.trim());
        holiday.setFromDay(dayDate);

        dayText = holidayElement.getAttribute("to");
        dayDate = dayFormat.parse(dayText.trim());
        holiday.setToDay(dayDate);
      }

      // now we are going to set the toDay to the end of the day, rather then the beginning.
      // we take the start of the next day as the end of the toDay.
      Calendar calendar = businessCalendar.createCalendar();
      calendar.setTime(holiday.getToDay());
      calendar.add(Calendar.DATE, 1);
      Date toDay = calendar.getTime();
      holiday.setToDay(toDay);
     
    } catch (Exception e) {
      parse.addProblem("couldn't parse holiday: "+XmlUtil.toString(holidayElement));
    }
View Full Code Here

TOP

Related Classes of org.jbpm.cal.Holiday

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.