net.fortuna.ical4j.util.CompatibilityHints Java Examples
The following examples show how to use
net.fortuna.ical4j.util.CompatibilityHints.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectForgeApp.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * Should be called on start-up (e. g. by WicketApplication) if all start-up stuff is done and all the services and login should be * started. <br> * Flag upAndRunning will be set to true. */ public void finalizeInitialization() { cronSetup.initialize(); log.info("system cronJobs are initialized."); pluginsRegistry.registerCronJobs(cronSetup); log.info("plugin cronJobs are initialized."); log.info(AppVersion.APP_ID + " " + AppVersion.NUMBER + " (" + AppVersion.RELEASE_TIMESTAMP + ") initialized."); try { StorageClient.getInstance(); // Initialize storage } catch (final Exception ex) { log.error(ex.getMessage(), ex); } // initialize ical4j to be more "relaxed" CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true); this.upAndRunning = true; log.info("ProjectForge is now available (up and running)."); }
Example #2
Source File: ICal4JConfigurator.java From james-project with Apache License 2.0 | 5 votes |
public static void configure() { CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_OUTLOOK_COMPATIBILITY, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY, true); CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY, true); System.setProperty("net.fortuna.ical4j.timezone.cache.impl", MapTimeZoneCache.class.getName()); }
Example #3
Source File: IcsFileImporter.java From ganttproject with GNU General Public License v3.0 | 4 votes |
/** * Reads calendar events from file * @return a list of events if file was parsed successfully or null otherwise */ private static List<CalendarEvent> readEvents(File f) { try { CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); CalendarBuilder builder = new CalendarBuilder(); List<CalendarEvent> gpEvents = Lists.newArrayList(); Calendar c = builder.build(new UnfoldingReader(new FileReader(f))); for (Component comp : (List<Component>)c.getComponents()) { if (comp instanceof VEvent) { VEvent event = (VEvent) comp; if (event.getStartDate() == null) { GPLogger.log("No start date found, ignoring. Event="+event); continue; } Date eventStartDate = event.getStartDate().getDate(); if (event.getEndDate() == null) { GPLogger.log("No end date found, using start date instead. Event="+event); } Date eventEndDate = event.getEndDate() == null ? eventStartDate : event.getEndDate().getDate(); TimeDuration oneDay = GPTimeUnitStack.createLength(GPTimeUnitStack.DAY, 1); if (eventEndDate != null) { java.util.Date startDate = GPTimeUnitStack.DAY.adjustLeft(eventStartDate); java.util.Date endDate = GPTimeUnitStack.DAY.adjustLeft(eventEndDate); RRule recurrenceRule = (RRule) event.getProperty(Property.RRULE); boolean recursYearly = false; if (recurrenceRule != null) { recursYearly = Recur.YEARLY.equals(recurrenceRule.getRecur().getFrequency()) && 1 == recurrenceRule.getRecur().getInterval(); } while (startDate.compareTo(endDate) <= 0) { Summary summary = event.getSummary(); gpEvents.add(CalendarEvent.newEvent( startDate, recursYearly, CalendarEvent.Type.HOLIDAY, summary == null ? "" : summary.getValue(), null)); startDate = GPCalendarCalc.PLAIN.shiftDate(startDate, oneDay); } } } } return gpEvents; } catch (IOException | ParserException e) { GPLogger.log(e); return null; } }