Patch webcit-created vcards for phone numbers
[jgroupdav.git] / additional_tests / remove_tz_components.bsh
blob24d282a332e100e0c0fdb93733c8b67747fefa35
1 /** Script to remove timezone data from iCalendar files, i.e
2 from Sunbird, and split into individual */
3 import net.fortuna.ical4j.data.*;
4 import net.fortuna.ical4j.model.*;
5 import net.fortuna.ical4j.model.property.*;
6 import net.fortuna.ical4j.model.component.*;
7 addClassPath("/Users/matt/.m2/repository/net/fortuna/ical4j/1.0-beta4/ical4j-1.0-beta4.jar");
9 FileInputStream fis = new FileInputStream("test_data.ics");
10 addClassPath("/Users/matt/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar");
11 addClassPath("/Users/matt/.m2/repository/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
12 CalendarBuilder cb = new CalendarBuilder();
13 net.fortuna.ical4j.model.Calendar cal = cb.build(fis);
14 ComponentList cl = cal.getComponents("VEVENT");
15 Iterator it = cl.iterator();
16 while(it.hasNext()) {
17         CalendarComponent c = (CalendarComponent)it.next();
18         DtStart dts = (DtStart) c.getProperty("DTSTART");
19         if (dts != null) 
20                 dts.setUtc(true);
21         DtEnd dte = (DtEnd) c.getProperty("DTEND");
22         if (dte != null)
23                 dte.setUtc(true);
25 VTimeZone vtz = (VTimeZone)cal.getComponent("VTIMEZONE");
26 cl = cal.getComponents();
27 cl.remove(vtz);
28 print (cal);