### Manage Calendar Collections via CLI Source: https://context7.com/ical4j/ical4j-user-guide/llms.txt Provides examples of using the 'ict' command-line tool to create, update, and filter calendar events and to-do items. ```bash # Create a new collection ict mkcol my-calendar # Create a new event ict new event my-calendar -summary "Team Meeting" -dtstart "2024-07-01T10:00:00" -dtend "2024-07-01T11:00:00" # Create a to-do item ict new todo my-todo-list -summary "Finish Report" -due "2024-07-05" # List events with filter ict ls my-calendar -filter "status=confirmed" # Import/export calendar files ict import -file="/path/to/calendar.ics" my-calendar ict export -file="/path/to/exported.ics" my-calendar ``` -------------------------------- ### Create a four-hour meeting event using Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/examples/model.md Provides a Java example for creating a meeting event with a four-hour duration using the iCal4j library. It includes setting up time zones, start and end times, event details, attendees, and generating a unique identifier. Dependencies include `java.util.TimeZone`, `java.util.GregorianCalendar`, and iCal4j model classes. ```java // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("America/Mexico_City"); VTimeZone tz = timezone.getVTimeZone(); // Start Date is on: April 1, 2008, 9:00 am java.util.Calendar startDate = new GregorianCalendar(); startDate.setTimeZone(timezone); startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); startDate.set(java.util.Calendar.DAY_OF_MONTH, 1); startDate.set(java.util.Calendar.YEAR, 2008); startDate.set(java.util.Calendar.HOUR_OF_DAY, 9); startDate.set(java.util.Calendar.MINUTE, 0); startDate.set(java.util.Calendar.SECOND, 0); // End Date is on: April 1, 2008, 13:00 java.util.Calendar endDate = new GregorianCalendar(); endDate.setTimeZone(timezone); endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); endDate.set(java.util.Calendar.DAY_OF_MONTH, 1); endDate.set(java.util.Calendar.YEAR, 2008); endDate.set(java.util.Calendar.HOUR_OF_DAY, 13); endDate.set(java.util.Calendar.MINUTE, 0); endDate.set(java.util.Calendar.SECOND, 0); // Create the event String eventName = "Progress Meeting"; DateTime start = new DateTime(startDate.getTime()); DateTime end = new DateTime(endDate.getTime()); VEvent meeting = new VEvent(start, end, eventName); // add timezone info.. meeting.add(tz.getTimeZoneId()); // generate unique identifier.. UidGenerator ug = new UidGenerator("uidGen"); Uid uid = ug.generateUid(); meeting.add(uid); // add attendees.. Attendee dev1 = new Attendee(URI.create("mailto:dev1@mycompany.com")); dev1.add(Role.REQ_PARTICIPANT); dev1.add(new Cn("Developer 1")); meeting.add(dev1); Attendee dev2 = new Attendee(URI.create("mailto:dev2@mycompany.com")); dev2.add(Role.OPT_PARTICIPANT); dev2.add(new Cn("Developer 2")); meeting.add(dev2); // Create a calendar net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar(); icsCalendar.add(new ProdId("-//Events Calendar//iCal4j 1.0//EN")); icsCalendar.add(ImmutableCalScale.GREGORIAN); // Add the event and print icsCalendar.add(meeting); System.out.println(icsCalendar); ``` -------------------------------- ### Create Simple vCard with Properties (Java) Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/vcard/examples.md Demonstrates the creation of a simple vCard object in Java. It involves initializing a list of properties, adding standard properties like Source, Name, and Kind, and also includes an example of adding a custom property. The final vCard is constructed from this list of properties. ```java List props = new ArrayList(); props.add(new Source(URI.create("ldap://ldap.example.com/cn=Babs%20Jensen,%20o=Babsco,%20c=US"))); props.add(new Name("Babs Jensen's Contact Information")); props.add(Kind.INDIVIDUAL); // add a custom property.. props.add(new Property("test") { @Override public String getValue() { return null; } @Override public void validate() throws ValidationException { } }); VCard vcard = new VCard(props); ``` -------------------------------- ### Render Basic To-Do Items in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Demonstrates how to initialize a ToDoModel and render it into plain text, Markdown, or HTML formats using the TemplateEngine. ```java ToDoModel model = new ToDoModel(todo); // no format model.toString(); // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("todo/markdown.jte", model, output); output.toString(); // html format output = new StringOutput(); engine.render("todo/html.jte", model, output); output.toString(); ``` -------------------------------- ### Render Availability Models using TemplateEngine Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Demonstrates rendering an AvailabilityModel into plain text, Markdown, or HTML. This process utilizes the TemplateEngine to map availability data fields like start time, end time, and status into structured formats. ```java AvailabilityModel model = new AvailabilityModel(availability); // no format model.toString(); // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("availability/markdown.jte", model, output); output.toString(); // html format output = new StringOutput(); engine.render("availability/html.jte", model, output); output.toString(); ``` -------------------------------- ### Update Collection Metadata with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Shows how to update metadata for existing collections using the 'ict set' command. Examples include setting the name, color, description, and timezone of a collection. ```shell > ict set my-calendar name "My remote calendar" Updated collection 'my-calendar' with name 'My remote calendar'. > ict set my-calendar color "#FF0000" Updated collection 'my-calendar' with color '#FF0000'. > ict set my-todo-list description "My personal to-do list" Updated collection 'my-todo-list' with description 'My personal to-do list'. > ict set my-calendar timezone "America/New_York" Updated collection 'my-calendar' with timezone 'America/New_York'. ``` -------------------------------- ### Render Recurring To-Do Items in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Shows how to render To-Do items that include recurrence rules by providing a period start and end to the ToDoModel. ```java ToDoModel model = new ToDoModel(recurringTodo, periodStart, periodEnd); // no format model.toString(); // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("todo/markdown-occurrences.jte", model, output); output.toString(); ``` -------------------------------- ### Sort Collection Objects Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Explains how to order listed objects within a collection based on specific metadata properties like start date. ```shell > ict ls my-calendar -sort "dtstart:asc" ``` -------------------------------- ### Create Meeting Invite with iCal4j (Java) Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/groupware/meeting.md This Java code snippet illustrates how to construct a meeting invitation using the iCal4j library. It takes VCard objects for participants and sets meeting properties like organizer, chair, start time, and duration. The output is a VEVENT object conforming to iCalendar standards. ```java VCard organizer = ...; VCard chair = ...; VEvent meeting = new Meeting().organizer(organizer) .chair(new Contact(chair)) .start(LocalDate.of(2023, 11, 13).atStartOfDay()) .duration(Duration.ofMinutes(30)).apply(); ``` -------------------------------- ### Render Basic Journal Entries in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Demonstrates how to render a simple journal entry with date, summary, and description using the JournalModel and JTE templates. ```java JournalModel model = new JournalModel(journal); // no format model.toString(); // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("journal/markdown.jte", model, output); output.toString(); // html format output = new StringOutput(); engine.render("journal/html.jte", model, output); output.toString(); ``` -------------------------------- ### Create vCard Contacts Source: https://context7.com/ical4j/ical4j-user-guide/llms.txt Shows how to instantiate a VCard object and populate it with properties such as names, emails, and contact information. ```java import net.fortuna.ical4j.vcard.VCard; import net.fortuna.ical4j.vcard.Property; import net.fortuna.ical4j.vcard.property.*; import java.util.ArrayList; import java.util.List; import java.net.URI; List props = new ArrayList<>(); props.add(new Source(URI.create("ldap://ldap.example.com/cn=John%20Doe,%20o=Example,%20c=US"))); props.add(new Name("John Doe's Contact Information")); props.add(Kind.INDIVIDUAL); props.add(new Fn("John Doe")); props.add(new Email("john.doe@example.com")); props.add(new Tel("+1-555-123-4567")); VCard vcard = new VCard(props); ``` -------------------------------- ### Create a new event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Creates a new event with the provided details. Supports properties like DTSTART, SUMMARY, and CATEGORIES. ```APIDOC ## POST /v1/events ### Description Creates a new event with the provided details. Supports properties like DTSTART, SUMMARY, and CATEGORIES. ### Method POST ### Endpoint https://api.example.com/v1/events ### Parameters #### Request Body - **dtstart** (string) - Required - The start date/time of the event. - **summary** (string) - Required - The summary or title of the event. - **categories** (string) - Optional - Categories associated with the event. ### Request Example ```json { "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays" } ``` ### Response #### Success Response (200) - **uid** (string) - The unique identifier for the event. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The summary or title of the event. - **categories** (string) - Categories associated with the event. #### Response Example ```json { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays" } ``` ``` -------------------------------- ### Manage Timezones with TimeZoneRegistry Source: https://context7.com/ical4j/ical4j-user-guide/llms.txt Demonstrates how to retrieve timezone definitions, associate them with calendar events, and handle custom registry configurations for compatibility. ```java import net.fortuna.ical4j.model.*; import net.fortuna.ical4j.model.component.VTimeZone; import net.fortuna.ical4j.model.component.VEvent; // Get default timezone registry TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("Europe/Berlin"); VTimeZone tz = timezone.getVTimeZone(); // Create event with proper timezone DateTime start = new DateTime(startDate, timezone); DateTime end = new DateTime(endDate, timezone); VEvent meeting = new VEvent(start, end, "Meeting with Timezone"); // Add VTimeZone to calendar Calendar calendar = new Calendar(); calendar.add(tz); calendar.add(meeting); // Use Outlook-compatible timezone definitions TimeZoneRegistry outlookRegistry = new TimeZoneRegistryImpl("zoneinfo-outlook/"); TimeZone outlookTz = outlookRegistry.getTimeZone("America/New_York"); // Get timezone from parsed calendar CalendarBuilder builder = new CalendarBuilder(); Calendar parsedCal = builder.build(new FileInputStream("mycalendar.ics")); TimeZoneRegistry parsedRegistry = builder.getRegistry(); TimeZone parsedTz = parsedRegistry.getTimeZone("Australia/Melbourne"); ``` -------------------------------- ### Parsing and rendering iCalendar data with Groovlets Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/groovy.md An example of a Groovlet that fetches a calendar from a URL, parses it using CalendarBuilder, and renders event summaries into an HTML table. ```groovy import net.fortuna.ical4j.data.CalendarBuilder import net.fortuna.ical4j.model.Component html.html { body { def builder = new CalendarBuilder() def calendar = builder.build(new URL(request.getParameter("u")).openStream()) table { for (event in calendar.getComponents(Component.VEVENT)) { tr { td event.getSummary().getValue(); td event.getStartDate().getDate() } } } } } ``` -------------------------------- ### Render Contact Models using TemplateEngine Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Demonstrates rendering a ContactModel into plain text, Markdown, or HTML. It uses a TemplateEngineFactory to generate formatted output based on specific template files. ```java ContactModel model = new ContactModel(contact); // no format model.toString(); // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("contact/markdown.jte", model, output); output.toString(); // html format output = new StringOutput(); engine.render("contact/html.jte", model, output); output.toString(); ``` -------------------------------- ### Accessing Event and To-Do Properties in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/components.md Demonstrates how to retrieve specific properties from iCalendar VEVENT and VTODO components using property accessors in Java. This includes getting start times for events and categories for to-dos. ```java DtStart start = event.getDateTimeStart(); List categories = todo.getCategories(); ``` -------------------------------- ### Create Calendar and To-Do Objects with ict Strategies Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Illustrates the use of predefined strategies ('event', 'todo') with the 'ict new' command to create calendar events and to-do items. It includes setting summary, start/end times, and due dates. ```shell > ict new event my-calendar -summary "Team Meeting" -dtstart "2024-07-01T10:00:00" -dtend "2024-07-01T11:00:00" Created event with UID '0987654321' in collection 'my-calendar'. > ict new todo my-todo-list -summary "Finish Report" -due "2024-07-05" Created to-do item with UID '1122334455' in collection 'my-todo-list'. ``` -------------------------------- ### Modifying Event and To-Do Properties in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/components.md Illustrates how to safely modify properties of iCalendar VEVENT and VTODO components using property modifiers in Java. Examples show setting the start date/time for an event and adding categories to a to-do. ```java event.with(DTSTART, new DtStart("20240101T0900000")); todo.with(CATEGORIES, new Categories("travel")); ``` -------------------------------- ### Apply Filters and Configure Default Settings Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Shows how to filter collection objects by metadata, set default filters for recurring commands, and create named filter shortcuts. ```shell > ict ls my-calendar -filter "status=confirmed" > ict rm my-todo-list -filter "due<2024-07-01" > ict configure set default-filter "status=confirmed" > ict configure set filter "upcoming-events=status=confirmed;start>now" ``` -------------------------------- ### Create Collections with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Demonstrates how to create different types of collections (calendars, addressbooks, tasks, journals, notes) using the 'ict mkcol' command. It shows how to specify the collection type or use the default. ```shell > ict mkcol -type=tasks my-todo-list Collection 'my-todo-list' of type 'tasks' created. > ict mkcol my-calendar Collection 'my-calendar' of type 'calendars' created. ``` -------------------------------- ### Configure Compatibility Hints via System Properties Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/compatibility.md Illustrates how to pass compatibility hints as JVM arguments during application startup. This is useful for overriding default configurations without modifying source code or property files. ```bash java -Dical4j.unfolding.relaxed=true ``` -------------------------------- ### Render Event with Alarms in Plain Text Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Provides an example of rendering an iCalendar event that includes alarms or reminders into plain text format using the ical4j library. ```java EventModel model = new EventModel(eventWithAlarms); // no format model.toString(); // Output: // Event: Doctor Appointment // When: 2024-07-20T09:00 to 2024-07-20T10:00 // Description: Annual check-up with Dr. Smith. // Alarms: // - 30 minutes before // - 1 day before // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); ``` -------------------------------- ### Working with Recurrence Rules (RRULE) Source: https://context7.com/ical4j/ical4j-user-guide/llms.txt Provides examples of building complex recurrence patterns using the Recur.Builder class. These rules can be added to VEvent components to define repeating schedules. ```java import net.fortuna.ical4j.model.Recur; import net.fortuna.ical4j.model.property.RRule; import net.fortuna.ical4j.model.component.VEvent; Recur recur = new Recur.Builder() .frequency(Recur.Frequency.MONTHLY) .interval(3) .dayList(new WeekDayList(WeekDay.SU)) .build(); recur.setSetPosList(new NumberList("-1")); RRule rrule = new RRule(recur); event.add(rrule); Recur yearlyRecur = new Recur.Builder() .frequency(Recur.Frequency.YEARLY) .monthList(new NumberList("4")) .dayList(new WeekDayList(WeekDay.SU)) .build(); yearlyRecur.setSetPosList(new NumberList("3")); Recur bimonthly = new Recur.Builder() .frequency(Recur.Frequency.MONTHLY) .interval(2) .monthDayList(new NumberList("29")) .build(); ``` -------------------------------- ### Import and Export iCalendar files via CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Demonstrates how to import calendar files into a collection and export entire collections or specific objects using their UID. ```shell > ict import -file="/path/to/calendar.ics" my-calendar > ict export -file="/path/to/exported_calendar.ics" my-calendar > ict export -file="/path/to/exported_event.ics" my-calendar:0987654321 ``` -------------------------------- ### Render Recurring Event in Plain Text and Markdown Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/template/examples.md Shows how to render recurring iCalendar events, including recurrence rules, into plain text and markdown formats. This example utilizes the ical4j library and a template engine. ```java EventModel model = new EventModel(event, periodStart, periodEnd); // no format model.toString(); // Output: // Event: Weekly Standup // When: Recurs every week on Monday at 09:00 from 2024-07-01 to 2024-12-31 // Description: Weekly team standup meeting. // markdown format TemplateEngine engine = new TemplateEngineFactory().newInstance(); StringOutput output = new StringOutput(); engine.render("event/markdown-occurrences.jte", model, output); output.toString(); // Output: // # Event: Weekly Standup // **When:** Monday 21 May, Monday 28 May, Monday 4 June, ... // **Description:** Weekly team standup meeting. ``` -------------------------------- ### Configure remote repositories and workspace synchronization Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Commands to set remote repository URLs for calendars and addressbooks, clone existing repositories into new workspaces, and perform synchronization between local and remote storage. ```shell > ict configure set remote.calendars "https://github.com/nodelogicau/calendars.git" > ict configure set remote.addressbooks "https://github.com/nodelogicau/cards.git" > ict clone https://github.com/nodelogicau/calendars.git work-project-b > ict sync ``` -------------------------------- ### Manage Workspaces Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Provides commands to switch between different data workspaces and inspect the current active workspace configuration. ```shell > ict chw work-project-a > ict pws ``` -------------------------------- ### Manage Calendar Events via HTTP API Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Demonstrates standard RESTful operations including creating, updating, retrieving, and deleting calendar events using the JOT serialization format. These examples show the request payloads and expected JSON responses for various event lifecycle actions. ```json POST https://api.example.com/v1/events { "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays" } ``` ```json POST https://api.example.com/v1/events/1234-abcd { "rrule": "FREQ=YEARLY" } ``` ```json POST https://api.example.com/v1/events/1234-abcd/20250101 { "description": "New Years Day (2025)" } ``` ```json POST https://api.example.com/v1/events/1234-abcd { "exdate": "20260101" } ``` ```json GET https://api.example.com/v1/events/1234-abcd ``` ```json PATCH https://api.example.com/v1/events/1234-abcd { "summary": "New Years Day (Public Holiday)" } ``` ```json DELETE https://api.example.com/v1/events/1234-abcd ``` -------------------------------- ### Set Object Properties with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Demonstrates using the 'ict set' command to update properties of calendar and to-do objects, such as status and conference links. It also covers setting custom metadata properties. ```shell > ict set status my-todo-list:1122334455 "in-progress" Set status of 'my-todo-list:1122334455' to 'in-progress'. > ict set conference my-calendar:0987654321 "https://meet.example.com/meeting123" Set conference link to 'my-calendar:0987654321'. > ict add x-property my-calendar:0987654321 "X-CUSTOM-PROP:Custom Value" Added custom property 'X-CUSTOM-PROP' to 'my-calendar:0987654321'. > ict set x-property my-calendar:0987654321 "X-CUSTOM-PROP:Updated Value" Set custom property 'X-CUSTOM-PROP' on 'my-calendar:0987654321' to 'Updated Value'. ``` -------------------------------- ### Add Subcomponents to Objects with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Demonstrates how to add subcomponents like participants and notifications to existing calendar objects using the 'ict new' command. It shows targeting specific objects by collection and UID. ```shell > ict new participant my-calendar:0987654321 @joeb@example.com -required Added participant 'joeb' as required to 'my-calendar:0987654321'. > ict new notify my-calendar:0987654321 "email:30m" Added notification for 'my-calendar:0987654321' to email 30 minutes before start. ``` -------------------------------- ### Example iCalendar Object Properties (JSON) Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/calendar.md An example JSON structure representing an iCalendar object with various properties, including those that can appear once and those that can appear multiple times. This serves as a reference for the data format used. ```json { "uid": "1234-abcd", "last-modified": "2024-01-17T10:59:00Z", "url": "https://example.com/public_holidays", "refresh-interval": "P1W", "source": "https://example.com/public_holidays.ics", "color": "orange", "name": "International Public Holidays", "description": "Globally recognised public holidays", "categories": ["holidays", "global"], "image": "https://example.com/images/holiday.png" } ``` -------------------------------- ### Example xCal XML Output Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/index.md This is an example of the XML output generated when serializing an iCalendar file to xCal format. It represents the calendar data, including VCALENDAR properties and components like VEVENT and VTIMEZONE, in a structured XML format. ```xml GREGORIAN PUBLISH -//Apple Computer, Inc//iCal 1.0//EN text Australian Holidays text D4167B74-C414-11D6-BA97-003065F198AC text Asia/Hong_Kong 2.0 Asia/Hong_Kong 2006-01-17T16:36:57Z 1932-12-13T20:45:52 +08:00 Z HKT 1946-04-20T03:30:00 +09:00 +08:00 HKST D416469E-C414-11D6-BA97-003065F198AC 2002-09-06T09:44:59Z Australia Day FREQ=YEARLY;INTERVAL=1;BYMONTH=1 date 2002-01-26 date 2002-01-27 ``` -------------------------------- ### Configure UID Generation Strategy with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Shows how to change the UID generation strategy from the default UUID to 'sequential' using the 'ict configure set' command. This affects how unique identifiers are created for new objects. ```shell > ict configure set uid-strategy "sequential" Set UID generation strategy to 'sequential'. > ict new event my-calendar -summary "Project Kickoff" -dtstart "2024-07-02T09:00:00" -dtend "2024-07-02T10:00:00" Created event with UID '0987654322' in collection 'my-calendar'. ``` -------------------------------- ### Configure user settings and preferences Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Commands to update global tool settings such as user identity for revision tracking. These settings persist across sessions and influence how objects are managed. ```shell > ict configure set username "John Doe" > ict configure set email "jdoe@example.com" ``` -------------------------------- ### Delete an existing event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Deletes an existing event from the system. ```APIDOC ## DELETE /v1/events/{eventId} ### Description Deletes an existing event from the system. ### Method DELETE ### Endpoint https://api.example.com/v1/events/{eventId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the event to delete. ### Response #### Success Response (200) - Returns the deleted event object or a confirmation message. - The structure is similar to the response of retrieving an event. #### Response Example ```json [ { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day (Public Holiday)", "categories": "holidays", "rrule": "FREQ=YEARLY", "exdate": "20260101" }, { "uid": "1234-abcd", "recurrence-id": "20250101", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "description": "New Years Day (2025)" } ] ``` ``` -------------------------------- ### Enable Compatibility Hints Programmatically Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/compatibility.md Demonstrates how to enable specific compatibility features at runtime using the CompatibilityHints utility class. This method requires the key constant and a boolean value to toggle the hint. ```java CompatibilityHints.setHintEnabled(KEY_RELAXED_UNFOLDING, true); ``` -------------------------------- ### Create an all-day event using the fluent API in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/examples/model.md Demonstrates creating an all-day iCalendar event using the fluent API of the iCal4j library in Java. This method allows for a more streamlined construction of the VEvent object and its properties. ```java net.fortuna.ical4j.model.Calendar cal = new net.fortuna.ical4j.model.Calendar() .withComponent( new VEvent(new Date(calendar.getTime()), "Christmas Day") .withProperty(ug.generateUid()).getFluentTarget()).getFluentTarget(); ``` -------------------------------- ### Customize an occurrence of a recurring event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Customizes a specific occurrence of a recurring event by providing a DESCRIPTION. ```APIDOC ## POST /v1/events/{eventId}/{occurrenceId} ### Description Customizes a specific occurrence of a recurring event by providing a DESCRIPTION. ### Method POST ### Endpoint https://api.example.com/v1/events/{eventId}/{occurrenceId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the recurring event. - **occurrenceId** (string) - Required - The identifier for the specific occurrence (e.g., YYYYMMDD). #### Request Body - **description** (string) - Optional - A custom description for this specific occurrence. ### Request Example ```json { "description": "New Years Day (2025)" } ``` ### Response #### Success Response (200) - **uid** (string) - The unique identifier for the event. - **recurrence-id** (string) - The identifier for the customized occurrence. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The summary or title of the event. - **categories** (string) - Categories associated with the event. - **description** (string) - The custom description for this occurrence. #### Response Example ```json { "uid": "1234-abcd", "recurrence-id": "20250101", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "description": "New Years Day (2025)" } ``` ``` -------------------------------- ### Update an existing event (idempotently) Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Updates an existing event using a PATCH request. Changes are idempotent. ```APIDOC ## PATCH /v1/events/{eventId} ### Description Updates an existing event using a PATCH request. Changes are idempotent. ### Method PATCH ### Endpoint https://api.example.com/v1/events/{eventId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the event to update. #### Request Body - **summary** (string) - Optional - The updated summary or title of the event. - Other updatable VEVENT properties can be included here. ### Request Example ```json { "summary": "New Years Day (Public Holiday)" } ``` ### Response #### Success Response (200) - **uid** (string) - The unique identifier for the event. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The updated summary or title of the event. - **categories** (string) - Categories associated with the event. - **rrule** (string) - The recurrence rule applied to the event. - **exdate** (string) - The date/time of a cancelled occurrence. #### Response Example ```json { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day (Public Holiday)", "categories": "holidays", "rrule": "FREQ=YEARLY", "exdate": "20260101" } ``` ``` -------------------------------- ### Create a new iCalendar object using the fluent API in Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/examples/model.md Illustrates how to create an iCalendar object more succinctly using the fluent API provided by the iCal4j library in Java. This approach chains method calls for a more readable and concise code structure. ```java Calendar calendar = new Calendar().withProdId("-//Ben Fortuna//iCal4j 1.0//EN") .withDefaults().getFluentTarget(); // Add events, etc.. calendar = calendar.withComponent(...).getFluentTarget(); ``` -------------------------------- ### Add Metadata to Calendar Objects with ict CLI Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/command/index.md Explains how to add various metadata like attachments, comments, and categories to calendar objects using the 'ict add' command. It shows how to specify the object and the metadata to be added. ```shell > ict add attach my-calendar:0987654321 "/path/to/agenda.pdf" Added attachment to 'my-calendar:0987654321'. > ict add comment my-calendar:0987654321 "Discuss project updates" Added comment to 'my-calendar:0987654321'. > ict add categories my-calendar:0987654321 "Work" "Important" Added categories to 'my-calendar:0987654321'. ``` -------------------------------- ### Retrieve all occurrences of a recurring event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Retrieves all occurrences, including customized and cancelled ones, of a recurring event. ```APIDOC ## GET /v1/events/{eventId} ### Description Retrieves all occurrences, including customized and cancelled ones, of a recurring event. ### Method GET ### Endpoint https://api.example.com/v1/events/{eventId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the recurring event. ### Response #### Success Response (200) - An array of event occurrence objects, each potentially including: - **uid** (string) - The unique identifier for the event. - **recurrence-id** (string) - The identifier for a customized occurrence. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The summary or title of the event. - **categories** (string) - Categories associated with the event. - **rrule** (string) - The recurrence rule applied to the event. - **exdate** (string) - The date/time of a cancelled occurrence. - **description** (string) - The custom description for a specific occurrence. #### Response Example ```json [ { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "rrule": "FREQ=YEARLY", "exdate": "20260101" }, { "uid": "1234-abcd", "recurrence-id": "20250101", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "description": "New Years Day (2025)" } ] ``` ``` -------------------------------- ### Cancel an occurrence of a recurring event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Cancels a specific occurrence of a recurring event by adding it to the EXDATE list. ```APIDOC ## POST /v1/events/{eventId} ### Description Cancels a specific occurrence of a recurring event by adding it to the EXDATE list. ### Method POST ### Endpoint https://api.example.com/v1/events/{eventId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the recurring event. #### Request Body - **exdate** (string) - Required - The date/time of the occurrence to cancel (e.g., "20260101"). ### Request Example ```json { "exdate": "20260101" } ``` ### Response #### Success Response (200) - **uid** (string) - The unique identifier for the event. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The summary or title of the event. - **categories** (string) - Categories associated with the event. - **rrule** (string) - The recurrence rule applied to the event. - **exdate** (string) - The date/time of the cancelled occurrence. #### Response Example ```json { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "rrule": "FREQ=YEARLY", "exdate": "20260101" } ``` ``` -------------------------------- ### Add a recurrence rule to an event Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/serializer/jotn/event.md Adds a recurrence rule (RRULE) to an existing event, allowing it to repeat. ```APIDOC ## POST /v1/events/{eventId} ### Description Adds a recurrence rule (RRULE) to an existing event, allowing it to repeat. ### Method POST ### Endpoint https://api.example.com/v1/events/{eventId} ### Parameters #### Path Parameters - **eventId** (string) - Required - The unique identifier of the event to update. #### Request Body - **rrule** (string) - Required - The recurrence rule string (e.g., "FREQ=YEARLY"). ### Request Example ```json { "rrule": "FREQ=YEARLY" } ``` ### Response #### Success Response (200) - **uid** (string) - The unique identifier for the event. - **dtstamp** (string) - The timestamp when the event was created or last modified. - **created** (string) - The creation timestamp of the event. - **last-modified** (string) - The last modification timestamp of the event. - **dtstart** (string) - The start date/time of the event. - **summary** (string) - The summary or title of the event. - **categories** (string) - Categories associated with the event. - **rrule** (string) - The recurrence rule applied to the event. #### Response Example ```json { "uid": "1234-abcd", "dtstamp": "2024-01-17T10:59:00Z", "created": "2024-01-17T10:59:00Z", "last-modified": "2024-01-17T10:59:00Z", "dtstart": "2024-01-01", "summary": "New Years Day", "categories": "holidays", "rrule": "FREQ=YEARLY" } ``` ``` -------------------------------- ### Configure Compatibility Hints via Properties File Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/compatibility.md Shows how to define compatibility settings in an ical4j.properties file located in the classpath. This allows for persistent configuration across application restarts. ```properties ical4j.unfolding.relaxed=true ical4j.unfolding.relaxed={true|false} ical4j.parsing.relaxed={true|false} ical4j.validation.relaxed={true|false} ical4j.compatibility.outlook={true|false} ical4j.compatibility.notes={true|false} ``` -------------------------------- ### Create an all-day event using Java Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/examples/model.md Shows how to create an all-day event in iCalendar format using Java and the iCal4j library. It involves setting a specific date and initializing a VEvent object, then generating a unique identifier for it. Dependencies include `java.util.Calendar` and iCal4j model classes. ```java java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.set(java.util.Calendar.MONTH, java.util.Calendar.DECEMBER); calendar.set(java.util.Calendar.DAY_OF_MONTH, 25); // initialise as an all-day event.. VEvent christmas = new VEvent(new Date(calendar.getTime()), "Christmas Day"); // Generate a UID for the event.. UidGenerator ug = new UidGenerator("1"); christmas.add(ug.generateUid()); net.fortuna.ical4j.model.Calendar cal = new net.fortuna.ical4j.model.Calendar(); cal.add(christmas); ``` -------------------------------- ### Constructing vCard objects with ContentBuilder Source: https://github.com/ical4j/ical4j-user-guide/blob/master/docs/groovy.md Demonstrates how to use the ContentBuilder to define vCard properties, handle parameters, and encode binary data like photos. The builder simplifies the hierarchical structure of vCard objects compared to standard Java implementations. ```groovy def builder = new ContentBuilder() def card = builder.vcard() { version '4.0' fn 'test' n 'example' { value 'text' } photo(new File('http://example.com/photo.png').bytes.encodeBase64() as String) } card.validate() ```