Opencap Project


Cap4j

Introduction

Cap4j is based on iCal4j library. All you can do with iCal4j library can be done with Cap4j.

"iCal4j may be used for modifying existing iCalendar data or creating new iCalendar data from scratch. Here you will find a few examples indicating the recommended usage of this library" see iCal4j introduction.

Cap4j extends iCal4j library and add the specification of Calendar Access Protocol (CAP) (which is still in draft state)

Parseing a Cap iCalendar file

All parsing model is provided by iCal4j. Cap4j extends Components, Properties, Parameters builders and override them with Cap draft speciifcations.

or

Iterating over a Calendar

As iCal4j API, Cap4j is designed to conform with the standard Java collections API. As such, you will find that for searching and manipulating a calendar object model you can make use of familiar concepts such as Lists, Iterators, etc.

Creating a new calendar

As iCal4j API, creating a new Cap Calendar must contains a list of Properties and Components. You can verify that a calendar is valid via the method Calendar.validate().

Output:

Creating an vagenda

To create a VAgenda you must set an owner.

Output:

Saving a Cap iCalendar file

Cap4j saving mecanism is the same as iCal4j. When saving a Cap iCalendar file, Cap4j will automatically validate your calendar object model to ensure it complies with the iCalendar RFC specification (done in iCal4j) and with Cap draft specification (done in Cap4j). If you would prefer not to validate your calendar data you can disable the validation by calling CalendarOutputter.setValidating(false).