List of usage examples for org.joda.time DateTime plusHours
public DateTime plusHours(int hours)
From source file:de.uniluebeck.itm.spyglass.gui.wizard.WisebedPacketReaderConfigurationWizard.java
License:Open Source License
private void fillReservations() { final RS rs = RSServiceHelper.getRSService(config.getRsEndpointUrl()); final GetReservations getReservationsRequest = new GetReservations(); final DateTime from = new DateTime(); final DateTime until = from.plusHours(24); getReservationsRequest.setFrom(datatypeFactory.newXMLGregorianCalendar(from.toGregorianCalendar())); getReservationsRequest.setTo(datatypeFactory.newXMLGregorianCalendar(until.toGregorianCalendar())); List<eu.wisebed.api.rs.SecretAuthenticationKey> secretAuthenticationKeys = BeanShellHelper .copySnaaToRs(Lists.<SecretAuthenticationKey>newArrayList(authMap.values())); final List<ConfidentialReservationData> rsData; try {/*from w ww . j ava 2 s .co m*/ rsData = rs.getConfidentialReservations(secretAuthenticationKeys, getReservationsRequest); } catch (RSExceptionException e) { throw new RuntimeException(e); } selectReservationPage.clearReservations(); for (ConfidentialReservationData data : rsData) { selectReservationPage.addReservation(data); } if (selectReservationPage.reservationsTable.getItemCount() > 0) { selectReservationPage.reservationsTable.select(0); } }
From source file:dk.dma.epd.common.prototype.service.IntendedRouteHandlerCommon.java
License:Apache License
/** * Finds the TCPA for two routes and returns the corresponding {@linkplain FilteredIntendedRoute}. * <p>//w w w. j av a 2 s. c o m * This method is only valid if the current start way point of route 1 is before route 2. * * @param route1 * @param route2 * @return */ protected FilteredIntendedRoute findTCPA(Route route1, Route route2) { // Focus on time FilteredIntendedRoute filteredIntendedRoute = new FilteredIntendedRoute(getMmsi(route1), getMmsi(route2)); // We need to check if there's a previous waypoint, ie. we are either // starting navigating or are between two waypoints // int route1StartWp = route1.getActiveWpIndex(); // int route2StartWp = route2.getActiveWpIndex(); int route1StartWp = 0; int route2StartWp = 0; int route1ActiveWp = 0; if (route1 instanceof IntendedRoute) { route1StartWp = ((IntendedRoute) route1).getActiveWpIndex(); route1ActiveWp = ((IntendedRoute) route1).getActiveWpIndex(); } if (route2 instanceof IntendedRoute) { route2StartWp = ((IntendedRoute) route2).getActiveWpIndex(); } if (route1 instanceof ActiveRoute) { route1StartWp = ((ActiveRoute) route1).getActiveWaypointIndex(); route1ActiveWp = ((ActiveRoute) route1).getActiveWaypointIndex(); } if (route2 instanceof ActiveRoute) { route2StartWp = ((ActiveRoute) route2).getActiveWaypointIndex(); } // if (route1StartWp > 0) { // route1StartWp = route1StartWp - 1; // } // // if (route2StartWp > 0) { // route2StartWp = route2StartWp - 1; // } // Should the comparison even be made DateTime route1Start = getEta(route1, route1StartWp); DateTime route1End = getEta(route1, route1.getEtas().size() - 1); DateTime route2Start = getEta(route2, route2StartWp); DateTime route2End = getEta(route2, route2.getEtas().size() - 1); // The route dates does not overlap, return immediately if (route2Start.isAfter(route1End) || route1Start.isAfter(route2End)) { LOG.debug("The route dates does not overlap, return immediately"); LOG.debug("Route 1 Start: " + route1Start + " and end: " + route1End); LOG.debug("Route 2 Start: " + route2Start + " and end: " + route2End); return filteredIntendedRoute; } // Find first point in time that they have in common if (route1Start.isBefore(route2Start)) { // Route1 starts first // Thus route2 start must be first common timeslot // Find location for both at route2start time // route2Start // Location for route2 is given from Position route2StartPos = route2.getWaypoints().get(route2StartWp).getPos(); DateTime route1WpStart = null; DateTime route1WpEnd; boolean foundSegment = false; int i; for (i = route1ActiveWp; i < route1.getWaypoints().size(); i++) { if (i > 0) { route1WpStart = getEta(route1, i - 1); route1WpEnd = getEta(route1, i); if (route1WpStart.isBefore(route2Start) && route1WpEnd.isAfter(route2Start)) { // We have the found the segment we need to start from LOG.debug("Found segment"); foundSegment = true; break; } } } if (foundSegment) { // Now find position at time of route2Start LOG.debug("Route 1 WP Start is at " + route1.getEtas().get(i - 1)); LOG.debug("Route 2 Start is at " + route2.getEtas().get(route2StartWp)); // How long will we have travelled along our route (route 1) long timeTravelledSeconds = (route2Start.getMillis() - route1WpStart.getMillis()) / 1000; double speedInLeg = route1.getWaypoints().get(i - 1).getOutLeg().getSpeed(); LOG.debug("We have travelled for how many minutes " + timeTravelledSeconds / 60 + " at speed " + speedInLeg); double distanceTravelled = Calculator.distanceAfterTimeMph(speedInLeg, timeTravelledSeconds); LOG.debug("We have travelled " + distanceTravelled + " nautical miles in direction: " + route1.getWaypoints().get(i - 1).calcBrg()); Position position = Calculator.findPosition(route1.getWaypoints().get(i - 1).getPos(), route1.getWaypoints().get(i - 1).calcBrg(), Converter.nmToMeters(distanceTravelled)); LOG.debug("Difference start pos" + route1.getWaypoints().get(i - 1).getPos() + " vs " + position); LOG.debug("The distance between points is " + Converter.metersToNm(position.distanceTo(route2StartPos, CoordinateSystem.CARTESIAN))); // intersectPositions.add(position); // // intersectPositions.add(route2StartPos); // In nautical miles // double route1SegmentTraversed = distanceTravelled; // double route2SegmentTraversed = 0; // Okay so we are in position and in route2StartPos // We must start traversing the route now, assume straight // lines, for each traversing check the distance between // points // Adaptive traversing, start with time slots of 10 minutes, if // distance between points is smaller than x // Or if distance is simply decreasing, reduce time traversing. // If the distance becomes below the threshold locate point // where it starts // Ensure that we do not traverse beyond the length of the route // We need to switch segments at some point - wait with that Position route1CurrentPosition = position; Position route2CurrentPosition = route2StartPos; int route1CurrentWaypoint = i - 1; int route2CurrentWaypoint = route2StartWp - 1; if (route2CurrentWaypoint < 0) { route2CurrentWaypoint = 0; } if (route1CurrentWaypoint < 0) { route1CurrentWaypoint = 0; } DateTime traverseTime = route2Start; DateTime route1SegmentEnd = getEta(route1, route1CurrentWaypoint + 1); DateTime route2SegmentEnd = getEta(route2, route2CurrentWaypoint + 1); while (true) { double currentDistance = Converter.metersToNm( route1CurrentPosition.distanceTo(route2CurrentPosition, CoordinateSystem.CARTESIAN)); if (currentDistance <= ENC_DISTANCE_EPSILON || currentDistance <= ALERT_DISTANCE_EPSILON || currentDistance <= FILTER_DISTANCE_EPSILON) { if (traverseTime.isAfter(PntTime.getDate().getTime())) { IntendedRouteFilterType filterType = IntendedRouteFilterType.FILTERONLY; // Top level filter only, no msg or graphics // if (currentDistance <= FILTER_DISTANCE_EPSILON) { // filterType = IntendedRouteFilterType.FILTERONLY; // } // We want an ENC graphics but no warning if (currentDistance <= ENC_DISTANCE_EPSILON) { filterType = IntendedRouteFilterType.ENC; } // We want an alert if (currentDistance <= ALERT_DISTANCE_EPSILON) { filterType = IntendedRouteFilterType.ALERT; } // We want both if (currentDistance <= ALERT_DISTANCE_EPSILON && currentDistance <= ENC_DISTANCE_EPSILON) { filterType = IntendedRouteFilterType.ALERT; } DecimalFormat df = new DecimalFormat("#.##"); IntendedRouteFilterMessage filterMessage = new IntendedRouteFilterMessage(route1, route2, route1CurrentPosition, route2CurrentPosition, "TCPA Warning, proxmity of " + df.format(currentDistance) + " nautical miles ", 0, 0, filterType); filterMessage.setTime1(traverseTime); filterMessage.setTime2(traverseTime); filteredIntendedRoute.getFilterMessages().add(filterMessage); LOG.debug("Adding warning"); } } else { LOG.debug("Found distance of " + currentDistance + " at " + traverseTime); } // Traverse with a minute traverseTime = traverseTime.plusMinutes(1); route1CurrentPosition = traverseLine(route1, route1CurrentWaypoint, route1CurrentPosition, 60); route2CurrentPosition = traverseLine(route2, route2CurrentWaypoint, route2CurrentPosition, 60); if (traverseTime.isAfter(route1SegmentEnd)) { // LOG.debug("We have traversed " + // route1SegmentTraversed + " nautical miles"); LOG.debug("We are at waypoint id " + route1CurrentWaypoint + " and the route has a total of " + route1.getWaypoints().size() + " waypoints"); // We are done with current leg, is there a next one? // No more waypoints - terminate zero indexing and last // waypoint does not have an out leg thus -2 if (route1CurrentWaypoint >= route1.getWaypoints().size() - 2) { LOG.debug("We are breaking - route 1 is done"); break; } else { LOG.debug("SWITCHING LEG FOR ROUTE 1, current bearing is "); // Switch to next leg route1CurrentWaypoint++; LOG.debug("We are now at waypoint " + route1CurrentWaypoint); // Traverse a bit int missingSecs = (int) (traverseTime.toDate().getTime() - route1SegmentEnd.toDate().getTime()) / 1000; route1CurrentPosition = traverseLine(route1, route1CurrentWaypoint, route1.getWaypoints().get(route1CurrentWaypoint).getPos(), missingSecs); route1SegmentEnd = getEta(route1, route1CurrentWaypoint + 1); // Skip to next WP start traverse // traverseTime = new // DateTime(route1.getEtas().get(route1CurrentWaypoint)); } } // if (route2SegmentTraversed > // Converter.milesToNM(route2.getWaypoints().get(route2CurrentWaypoint).calcRng())) // { if (traverseTime.isAfter(route2SegmentEnd)) { // LOG.debug("ROUTE 2: We have traversed " + // route2SegmentTraversed + " nautical miles out of " // + // Converter.milesToNM(route2.getWaypoints().get(route2CurrentWaypoint).calcRng())); LOG.debug("We are at waypoint id " + route2CurrentWaypoint + " and the route has a total of " + route2.getWaypoints().size() + " waypoints"); // No more waypoints - terminate if (route2CurrentWaypoint >= route2.getWaypoints().size() - 2) { LOG.debug("We are breaking - route 2 is done"); break; } else { LOG.debug("SWITCHING LEG FOR ROUTE 1"); // Switch to next leg route2CurrentWaypoint++; int missingSecs = (int) (traverseTime.toDate().getTime() - route2SegmentEnd.toDate().getTime()) / 1000; route2CurrentPosition = traverseLine(route2, route2CurrentWaypoint, route2.getWaypoints().get(route2CurrentWaypoint).getPos(), missingSecs); route2SegmentEnd = getEta(route2, route2CurrentWaypoint + 1); // Skip to next WP start traverse // traverseTime = new // DateTime(route2.getEtas().get(route2CurrentWaypoint)); } } // Are we more than x hours in the future then stop DateTime currentTime = new DateTime(PntTime.getDate().getTime()); if (traverseTime.isAfter(currentTime.plusHours(3))) { LOG.debug("More than 3 hours head of current time, ending checks"); break; } } } else { LOG.debug("No segment was found - not sure how we reached this point..."); } } else { // Route2 starts first // Thus route1 start must be first common timeslot } // findPosition(Position startingLocation, Position endLocation, double // distanceTravelled){ return filteredIntendedRoute; }
From source file:dk.nsi.haiba.lprimporter.rules.ExtendContactEndtimeRule.java
License:Open Source License
@Override public LPRRule doProcessing(Statistics statistics) { for (Administration contact : contacts) { // contact.getUdskrivningsDatetime() is set in the datetimerule, and will not be null DateTime contactEndDateTime = new DateTime(contact.getUdskrivningsDatetime()); DateTime latestProcedureDateTime = null; for (LPRProcedure procedure : contact.getLprProcedures()) { // Get latest procedure endtime, business rule #1 checks the datetime exists. DateTime dt = new DateTime(procedure.getProcedureDatetime()); if (latestProcedureDateTime == null || dt.isAfter(latestProcedureDateTime)) { latestProcedureDateTime = dt; }//from www . j av a2 s. com } //compare latest procedure endtime with contact endtime if (latestProcedureDateTime != null) { // if procedureDateTime is more than 24 hours after Contact enddatetime it is a businessrule error if (latestProcedureDateTime.isAfter(contactEndDateTime.plusHours(24))) { BusinessRuleError error = new BusinessRuleError(contact.getLprReference().getDbId(), contact.getRecordNumber(), resolver.getMessage("rule.extend.contact.endddatetime.gap.to.long"), resolver.getMessage("rule.extend.contact.endddatetime.name")); throw new RuleAbortedException("Rule aborted due to BusinessRuleError", error); } // if procedureDateTime is after contact enddatetime, set it to procedureDateTime if (latestProcedureDateTime.isAfter(contactEndDateTime)) { // Increment the count for rule #7 statistics.rule7Counter += 1; log.debug("procedureDateTime is after contact enddatetime for contact ref + " + contact.getRecordNumber()); contact.setUdskrivningsDatetime(latestProcedureDateTime.toDate()); } } } // setup the next rule in the chain contactsWithSameStartDateRule.setContacts(contacts); return contactsWithSameStartDateRule; }
From source file:dk.nsi.haiba.lprimporter.rules.LPRDateTimeRule.java
License:Open Source License
@Override public LPRRule doProcessing(Statistics statistics) { List<Administration> adjustedContacts = new ArrayList<Administration>(); // sort list after inDate, if more contacts have same in datetime - then they are sorted after out datetime. Collections.sort(contacts, new AdministrationInDateComparator()); for (Administration contact : contacts) { // Increment counter for rule #4 statistics.rule4Counter += 1;//from w w w . j a v a 2 s . c o m // AdmissionStartHour for the contact is default set to 0 if not applied in the database, adjust it with the default value from the propertiesfile DateTime admissionStart = new DateTime(contact.getIndlaeggelsesDatetime()); if (admissionStart.getHourOfDay() == 0 && defaultContactInHour != 0) { admissionStart = admissionStart.withHourOfDay(defaultContactInHour); contact.setIndlaeggelsesDatetime(admissionStart.toDate()); } // AdmissionEndtime must be adjusted, if it was set to 0 Date udskrivningsDatetime = contact.getUdskrivningsDatetime(); if (udskrivningsDatetime != null) { DateTime admissionEnd = new DateTime(udskrivningsDatetime.getTime()); if (admissionEnd.getHourOfDay() == 0) { // does a procedure exist on the same date, set the procedure hour as admission end hour int hourOfDay = 0; for (LPRProcedure procedure : contact.getLprProcedures()) { DateTime procedureTime = new DateTime(procedure.getProcedureDatetime()); if (admissionEnd.getYear() == procedureTime.getYear() && admissionEnd.getMonthOfYear() == procedureTime.getMonthOfYear() && admissionEnd.getDayOfMonth() == procedureTime.getDayOfMonth()) { // examine all procedures from the same day, and get the latest hour of day. if (procedureTime.getHourOfDay() > hourOfDay) { hourOfDay = procedureTime.getHourOfDay(); } } } admissionEnd = admissionEnd.withHourOfDay(hourOfDay); } // Then if admissionEnd still is 0, check the in date time is the same day if (admissionEnd.getHourOfDay() == 0) { if (admissionEnd.getYear() == admissionStart.getYear() && admissionEnd.getMonthOfYear() == admissionStart.getMonthOfYear() && admissionEnd.getDayOfMonth() == admissionStart.getDayOfMonth()) { // if same date, set end-datetime to in-datetime + defaultvalue admissionEnd = admissionEnd.withHourOfDay(admissionStart.getHourOfDay()) .plusHours(defaultContactOuthoursAddedInhours); } } // Then if admissionEnd still is 0, and the enddate is after indate set it to a configured defaultvalue if (admissionEnd.getHourOfDay() == 0) { admissionEnd = admissionEnd.withHourOfDay(defaultAdmissionEndHours); } contact.setUdskrivningsDatetime(admissionEnd.toDate()); List<LPRProcedure> processedProcedures = new ArrayList<LPRProcedure>(); for (LPRProcedure procedure : contact.getLprProcedures()) { // if procedure time is set to 0 - set it to 12 the same day Date procedureDatetime = procedure.getProcedureDatetime(); if (procedureDatetime != null) { DateTime procedureDate = new DateTime(procedureDatetime.getTime()); // if procedureDate is more than 24 hours after admissionEndDate it is an error if (procedureDate.isAfter(admissionEnd.plusHours(24))) { BusinessRuleError be = new BusinessRuleError(contact.getLprReference().getDbId(), contact.getRecordNumber(), resolver.getMessage( "rule.datetime.proceduredate.is.more.than.24hous.after.enddate"), resolver.getMessage("rule.datetime.name")); businessRuleErrorLog.log(be); // error, procedure is deleted from the contact. continue; } if (procedureDate.getHourOfDay() == 0) { procedureDate = procedureDate.withHourOfDay(defaultProcedureHours); procedure.setProcedureDatetime(procedureDate.toDate()); } processedProcedures.add(procedure); } else { BusinessRuleError error = new BusinessRuleError(contact.getLprReference().getDbId(), contact.getRecordNumber(), resolver.getMessage("rule.datetime.proceduredate.isempty"), resolver.getMessage("rule.datetime.name")); throw new RuleAbortedException("Rule aborted due to BusinessRuleError", error); } } contact.setLprProcedures(processedProcedures); } else { // patient is currently at the hospital contact.setCurrentPatient(true); log.debug("Admission End datetime is null for LPR ref: " + contact.getRecordNumber() + " patient is probably not discharged from hospital yet"); // if in-date is not more than 30 days older than now - set out-date to today at 24:00 DateTime now = new DateTime(); DateTime in = new DateTime(contact.getIndlaeggelsesDatetime()); if (in.isAfter(now.minusDays(currentPatientDefaultInterval))) { DateTime out = in.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0) .plusHours(currentPatientHoursIfLessThanInterval); contact.setUdskrivningsDatetime(out.toDate()); } else { // else set out-date to in-date + 30 days DateTime out = in.plusDays(currentPatientDaysIfGreaterThanInterval); contact.setUdskrivningsDatetime(out.toDate()); } } // Rule #6 in time is after out time DateTime in = new DateTime(contact.getIndlaeggelsesDatetime()); DateTime out = new DateTime(contact.getUdskrivningsDatetime()); if (in.isAfter(out)) { // Increment counter for rule #6 statistics.rule6Counter += 1; // log the error and ignore the contact. BusinessRuleError be = new BusinessRuleError(contact.getLprReference().getDbId(), contact.getRecordNumber(), resolver.getMessage("rule.datetime.indate.isafter.outdate"), resolver.getMessage("rule.datetime.name")); businessRuleErrorLog.log(be); // Increment count for contacts with errors statistics.contactErrorCounter += 1; lprDao.updateImportTime(contact.getLprReference(), Outcome.FAILURE); continue; } adjustedContacts.add(contact); } // set this for unittesting purpose contacts = adjustedContacts; if (contacts.size() == 0) { log.debug("all contacts were prone to error, abort the flow"); return null; } // setup the next rule in the chain removeIdenticalContactsRule.setContacts(contacts); return removeIdenticalContactsRule; }
From source file:dk.teachus.frontend.components.calendar.CalendarPanel.java
License:Apache License
private int calculateNumberOfCalendarHours() { DateTime calStart = getCalendarStartTime().toDateTimeToday(); DateTime calEnd = getCalendarEndTime().toDateTimeToday(); if (getCalendarEndTime().getHourOfDay() == 0 && getCalendarEndTime().getMinuteOfHour() == 0) { calEnd = calEnd.plusDays(1);/*from www.j a v a 2s . c om*/ } if (calEnd.getMinuteOfHour() > 0) { calEnd = calEnd.plusHours(1).withMinuteOfHour(0); } return new org.joda.time.Period(calStart, calEnd, PeriodType.hours()).getHours(); }
From source file:edu.nyu.vida.data_polygamy.utils.FrameworkUtils.java
License:BSD License
public static int addTimeSteps(int tempRes, int increment, DateTime start) { DateTime d;/*ww w . ja v a2 s. c o m*/ switch (tempRes) { case FrameworkUtils.HOUR: d = start.plusHours(increment); break; case FrameworkUtils.DAY: d = start.plusDays(increment); break; case FrameworkUtils.WEEK: d = start.plusWeeks(increment); break; case FrameworkUtils.MONTH: d = start.plusMonths(increment); break; case FrameworkUtils.YEAR: d = start.plusYears(increment); break; default: d = start.plusHours(increment); break; } return (int) (d.getMillis() / 1000); }
From source file:edu.nyu.vida.data_polygamy.utils.FrameworkUtils.java
License:BSD License
public static DateTime addTime(int tempRes, int increment, DateTime start) { DateTime d = null;//from w ww.ja v a 2 s . c o m switch (tempRes) { case FrameworkUtils.HOUR: d = start.plusHours(increment); break; case FrameworkUtils.DAY: d = start.plusDays(increment); break; case FrameworkUtils.WEEK: d = start.plusWeeks(increment); break; case FrameworkUtils.MONTH: d = start.plusMonths(increment); break; case FrameworkUtils.YEAR: d = start.plusYears(increment); break; default: d = start.plusHours(increment); break; } return d; }
From source file:edu.wisc.wisccal.caldav2Exchange.impl.caldav.datagenerator.ICal4jTestDataGenerator.java
public Calendar generateRandomEventCalendar(int compSize, DateTime baseStartTime) throws ValidationException { Calendar calendar = new Calendar(); for (int i = 0; i < compSize; i++) { calendar.getComponents().add(generateRandomEvent(baseStartTime)); if (Math.random() > 0.75) { calendar.getComponents().add(generateRandomAllDayEvent(baseStartTime)); }/* ww w . j av a 2 s . c o m*/ baseStartTime = baseStartTime.plusHours(getRandomInt(12)); } return calendar; }
From source file:edu.wisc.wisccal.caldav2Exchange.impl.caldav.datagenerator.ICal4jTestDataGenerator.java
protected VEvent generateRandomEvent(DateTime baseStartTime) throws ValidationException { DateTime startDateTime = new DateTime(baseStartTime.plusHours(getRandomInt(23))); net.fortuna.ical4j.model.DateTime ical4jStartDateTime = new net.fortuna.ical4j.model.DateTime( startDateTime.getMillis());//from w w w . j a v a2s. com DtStart dtStart = new DtStart(); dtStart.setDate(ical4jStartDateTime); dtStart.setTimeZone(getRandomTimeZone()); DateTime endDateTime = startDateTime.plusHours(getRandomInt(5)); net.fortuna.ical4j.model.DateTime ical4jEndDateTime = new net.fortuna.ical4j.model.DateTime( endDateTime.getMillis()); DtEnd dtEnd = new DtEnd(); dtEnd.setDate(ical4jEndDateTime); dtEnd.setTimeZone(getRandomTimeZone()); VEvent event = new VEvent(); event.getProperties().add(dtStart); event.getProperties().add(dtEnd); event.getProperties().add(new Summary("Start: " + dtStart.getValue())); event.getProperties().addAll(getCommonProps()); event.getProperties().add(new Description(event.toString())); event.validate(); return event; }
From source file:edu.wisc.wisccal.caldav2Exchange.impl.caldav.datagenerator.ICal4jTestDataGenerator.java
protected VToDo generateRandomTodo(DateTime baseStartTime) throws ValidationException { TimeZone randomTimeZone = getRandomTimeZone(); DateTime startDateTime = new DateTime(baseStartTime.plusHours(getRandomInt(23))); net.fortuna.ical4j.model.DateTime ical4jStartDateTime = new net.fortuna.ical4j.model.DateTime( startDateTime.getMillis());//www .j a v a 2 s .c om DtStart dtStart = new DtStart(); dtStart.setDate(ical4jStartDateTime); dtStart.setTimeZone(randomTimeZone); DateTime endDateTime = startDateTime.plusDays(getRandomInt(14)); net.fortuna.ical4j.model.DateTime ical4jEndDateTime = new net.fortuna.ical4j.model.DateTime( endDateTime.getMillis()); //different start/end timezones may cause problems... //<errordescription>DUE: 20000102T080000 is before DTSTART: 20000102T090000</errordescription> Due due = new Due(); due.setDate(ical4jEndDateTime); due.setTimeZone(randomTimeZone); VToDo toDo = new VToDo(); toDo.getProperties().add(dtStart); toDo.getProperties().add(due); toDo.getProperties().add(new Summary("Start: " + dtStart.getValue())); toDo.getProperties().addAll(getCommonProps()); toDo.getProperties().add(new Description(toDo.toString())); toDo.getAlarms().add(generateAlarm()); toDo.validate(); return toDo; }