/** * Perform validation on the calendar, its properties and its components in its current state. * @throws ValidationException where the calendar is not in a valid state */ public final void validate() throws ValidationException { validate(true); }
/** * Perform validation on the calendar, its properties and its components in its current state. * @throws ValidationException where the calendar is not in a valid state */ public final void validate() throws ValidationException { validate(true); }
/** * Perform validation on the calendar, its properties and its components in its current state. * @throws ValidationException where the calendar is not in a valid state */ public final void validate() throws ValidationException { validate(true); }
/** * Perform validation on the calendar, its properties and its components in its current state. * @throws ValidationException where the calendar is not in a valid state */ public final void validate() throws ValidationException { validate(true); }
/** * Perform validation on the calendar, its properties and its components in its current state. * @throws ValidationException where the calendar is not in a valid state */ public final void validate() throws ValidationException { validate(true); }
@Override public Calendar delegate(Calendar request) { Calendar delegated = delegateTransformer.transform(request); delegated.validate(); return delegated; }
@Override public Calendar delegate(Calendar request) { Calendar delegated = delegateTransformer.transform(request); delegated.validate(); return delegated; }
@Override public Calendar delegate(Calendar request) { Calendar delegated = delegateTransformer.transform(request); delegated.validate(); return delegated; }
@Override public Calendar delegate(Calendar request) { Calendar delegated = delegateTransformer.transform(request); delegated.validate(); return delegated; }
/** * <pre> * 3.2.8. DECLINECOUNTER * * The "DECLINECOUNTER" method in a "VEVENT" calendar component is used * by the "Organizer" of an event to reject a counter proposal submitted * by an "Attendee". The "Organizer" must send the "DECLINECOUNTER" * message to the "Attendee" that sent the "COUNTER" method to the * "Organizer". * </pre> */ @Override public Calendar declineCounter(Calendar counter) { Calendar declineCounter = transform(Method.DECLINE_COUNTER, counter); declineCounter.validate(); return declineCounter; } }
/** * <pre> * 3.4.8. DECLINECOUNTER * * The "DECLINECOUNTER" method in a "VTODO" calendar component is used * by an "Organizer" of the "VTODO" calendar component to reject a * counter proposal offered by one of the "Attendees". The "Organizer" * sends the message to the "Attendee" that sent the "COUNTER" method to * the "Organizer". * </pre> */ @Override public Calendar declineCounter(Calendar counter) { Calendar declineCounter = transform(Method.DECLINE_COUNTER, counter); declineCounter.validate(); return declineCounter; } }
/** * <pre> * 3.5.1. PUBLISH * * The "PUBLISH" method in a "VJOURNAL" calendar component has no * associated response. It is simply a posting of an iCalendar object * that may be added to a calendar. It MUST have an "Organizer". It * MUST NOT have "Attendees". The expected usage is for encapsulating * an arbitrary journal entry as an iCalendar object. The "Organizer" * MAY subsequently update (with another "PUBLISH" method) or cancel * (with a "CANCEL" method) a previously published journal entry. * </pre> */ @Override public Calendar publish(VJournal... component) { Calendar published = wrap(Method.PUBLISH, component); published.validate(); return published; }
/** * <pre> * 3.2.6. REFRESH * * The "REFRESH" method in a "VEVENT" calendar component is used by * "Attendees" of an existing event to request an updated description * from the event "Organizer". The "REFRESH" method must specify the * "UID" property of the event to update. A recurrence instance of an * event may be requested by specifying the "RECURRENCE-ID" property * corresponding to the associated event. The "Organizer" responds with * the latest description and version of the event. * </pre> */ @Override public Calendar refresh(VEvent component) { Calendar refresh = wrap(Method.REFRESH, component); refresh.validate(); return refresh; }
/** * @throws IOException * @throws ParserException * @throws ValidationException */ public void testBuildValid() throws IOException, ParserException, ValidationException { Calendar calendar = builder.build(fin); calendar.validate(); }
@Test public void testValid() throws ValidationException { calendar.validate(); }
/** * @param filename * @return */ private net.fortuna.ical4j.model.Calendar loadCalendar(String resourceString) throws IOException, ParserException, ValidationException { net.fortuna.ical4j.model.Calendar calendar = Calendars.load( getClass().getResource(resourceString)); calendar.validate(); log.info("Resource: " + resourceString); if (log.isDebugEnabled()) { log.debug("Calendar:\n=========\n" + calendar.toString()); } return calendar; }
/** * @throws IOException * @throws ParserException */ public void testBuildInvalid() throws IOException { try { Calendar calendar = builder.build(fin); calendar.validate(); fail("Should throw ParserException or ValidationException"); } catch (ValidationException | ParserException e) { log.trace("Caught exception: [" + filename + "," + e.getMessage() + "]"); } }
/** * Outputs an iCalender string to the specified writer. * @param calendar calendar to write to writer * @param out a writer * @throws IOException thrown when unable to write to writer * @throws ValidationException where calendar validation fails */ public final void output(final Calendar calendar, final Writer out) throws IOException, ValidationException { if (isValidating()) { calendar.validate(); } try (FoldingWriter writer = new FoldingWriter(out, foldLength)) { writer.write(calendar.toString()); } } }
/** * Outputs an iCalender string to the specified writer. * @param calendar calendar to write to writer * @param out a writer * @throws IOException thrown when unable to write to writer * @throws ValidationException where calendar validation fails */ public final void output(final Calendar calendar, final Writer out) throws IOException, ValidationException { if (isValidating()) { calendar.validate(); } try (FoldingWriter writer = new FoldingWriter(out, foldLength)) { writer.write(calendar.toString()); } } }
@Test public void shouldCorrectCalendarBody() throws IOException, ParserException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { String[] calendarNames = { "yahoo1.txt", "yahoo2.txt", "outlook1.txt", "outlook2.txt", "apple.txt" }; for (String calendarName : calendarNames) { Calendar calendar = buildCalendar(calendarName); calendar = transformer.transform(calendar); try { calendar.validate(); } catch (ValidationException e) { e.printStackTrace(); fail("Validation failed for " + calendarName); } } }