Package org.jbpm.cal

Examples of org.jbpm.cal.DayPart


    }
    return day;
  }
 
  private DayPart parseDayPart(Element dayPartElement, Day day, int index, DateFormat hourFormat, Parse parse) {
    DayPart dayPart = new DayPart();
    dayPart.setDay(day);
    dayPart.setIndex(index);

    Calendar calendar = day.getBusinessCalendar().createCalendar();

    if (dayPartElement.hasAttribute("from")) {
      String fromText = dayPartElement.getAttribute("from");
      try {
        Date from = hourFormat.parse(fromText);
        calendar.setTime(from);
        dayPart.setFromHour(calendar.get(Calendar.HOUR_OF_DAY));
        dayPart.setFromMinute(calendar.get(Calendar.MINUTE));
      } catch (Exception e) {
        parse.addProblem("couldn't parse from attribute "+fromText);
      }
    } else {
      parse.addProblem("attribute from is required in part: "+XmlUtil.toString(dayPartElement));
    }

    if (dayPartElement.hasAttribute("to")) {
      String toText = dayPartElement.getAttribute("to");
      try {
        Date to = hourFormat.parse(toText);
        calendar.setTime(to);
        dayPart.setToHour(calendar.get(Calendar.HOUR_OF_DAY));
        dayPart.setToMinute(calendar.get(Calendar.MINUTE));
      } catch (Exception e) {
        parse.addProblem("couldn't parse from attribute "+toText);
      }
    } else {
      parse.addProblem("attribute from is required in part: "+XmlUtil.toString(dayPartElement));
View Full Code Here

TOP

Related Classes of org.jbpm.cal.DayPart

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.