Package org.jbpm.pvm.internal.cal

Examples of org.jbpm.pvm.internal.cal.Holiday


    }
    return day;
  }
 
  private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendar businessCalendar, Parse parse) {
    Holiday holiday = new Holiday();
    try {
      if (holidayElement.hasAttribute("period")) {
        String holidayPeriodText = holidayElement.getAttribute("period");
       
        int dashIndex = holidayPeriodText.indexOf('-');
       
        String fromDateText = null;
        String toDateText = null;
        if (dashIndex!=-1) {
          fromDateText = holidayPeriodText.substring(0, dashIndex).trim().toLowerCase();
          toDateText = holidayPeriodText.substring(dashIndex+1).trim().toLowerCase();
         
        } else {
          fromDateText = holidayPeriodText.trim().toLowerCase();
          toDateText = fromDateText;
        }

       
        Date fromDate = dayFormat.parse(fromDateText);
        holiday.setFromDay(fromDate);

        Date toDate = dayFormat.parse(toDateText);
        holiday.setToDay(toDate);
       
      } else {
        parse.addProblem("attribute 'period' in element business-calendar is required", holidayElement);
      }

      // 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), holidayElement);
    }
View Full Code Here


    }
    return day;
  }
 
  private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendarImpl businessCalendarImpl, Parse parse) {
    Holiday holiday = new Holiday();
    try {
      if (holidayElement.hasAttribute("period")) {
        String holidayPeriodText = holidayElement.getAttribute("period");
       
        int dashIndex = holidayPeriodText.indexOf('-');
       
        String fromDateText = null;
        String toDateText = null;
        if (dashIndex!=-1) {
          fromDateText = holidayPeriodText.substring(0, dashIndex).trim().toLowerCase();
          toDateText = holidayPeriodText.substring(dashIndex+1).trim().toLowerCase();
         
        } else {
          fromDateText = holidayPeriodText.trim().toLowerCase();
          toDateText = fromDateText;
        }

       
        Date fromDate = dayFormat.parse(fromDateText);
        holiday.setFromDay(fromDate);

        Date toDate = dayFormat.parse(toDateText);
        holiday.setToDay(toDate);
       
      } else {
        parse.addProblem("attribute 'period' in element business-calendar is required", holidayElement);
      }

      // 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 = businessCalendarImpl.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), holidayElement);
    }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.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.