Source Code Cross Referenced for ICalendarParser.java in  » Groupware » hipergate » org » jical » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » hipergate » org.jical 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * iCalenderParser.java
0003:         *
0004:         * Created on August 1, 2002, 9:01 PM
0005:         *
0006:         * Stores an icalendar as a java object.
0007:         * Can parse an ICalendar file and create the ICalendar Java Object from
0008:         * that ICalendar file.
0009:         *
0010:         * Currently, this is a partial implementation. Its purpose is to parse an iCal file
0011:         * and create a freebusy string loadable out to a file or as a web-response if
0012:         * a URL.
0013:         *
0014:         */
0015:
0016:        package org.jical;
0017:
0018:        /**
0019:         *
0020:         * @author  sfg
0021:         * RFC 2445
0022:         *
0023:         */
0024:
0025:        import java.io.BufferedReader;
0026:        import java.io.File;
0027:        import java.io.FileInputStream;
0028:        import java.io.InputStreamReader;
0029:        import java.text.SimpleDateFormat;
0030:        import java.util.Date;
0031:        import java.util.StringTokenizer;
0032:        import java.util.TimeZone;
0033:        import java.util.logging.Logger;
0034:
0035:        public class ICalendarParser {
0036:
0037:            private String this Line;
0038:            private ICalendar ical;
0039:            private ICalendarVEvent iCalEvent;
0040:            private ICalendarTimeZone icalTimeZone;
0041:            // If parsing timezone cannot be parsing others.
0042:            private boolean icalTimeZoneParser;
0043:            private boolean icalEventParser;
0044:            private String timeZoneType;
0045:            private TimeZone gmt;
0046:
0047:            private int lineCtr;
0048:
0049:            // Java logger for all error/interesting messages.
0050:            private Logger logger = Logger.getLogger(this .getClass().getName());
0051:
0052:            /** Creates a new instance of ICalendar. */
0053:            public ICalendarParser() {
0054:            }
0055:
0056:            /** Read ICalendar from file.
0057:             * @param iCalFilePath File name.
0058:             * @return The ICalendar.
0059:             */
0060:            public ICalendar parse(java.lang.String iCalFilePath) {
0061:                File iCalFile = new File(iCalFilePath);
0062:                if (iCalFile.isFile()) {
0063:                    parse(iCalFile);
0064:                } else {
0065:                    logger.fine("The input file is not a file! File provided:"
0066:                            + iCalFilePath);
0067:                    ical = null;
0068:                }
0069:                return ical;
0070:            }
0071:
0072:            /** Read ICalendar from file.
0073:             * @param iCalFile File.
0074:             * @return The ICalendar.
0075:             */
0076:            public ICalendar parse(File iCalFile) {
0077:                return parse(iCalFile, null);
0078:            }
0079:
0080:            public ICalendar parse(File iCalFile, String enc) {
0081:                // Setup Log4J stuff..
0082:                gmt = TimeZone.getTimeZone("GMT");
0083:                //logcat = Category.getInstance(ICalendarParser.class.getName());
0084:                // Must run, Initialisation stuff.
0085:                //logcat.info("Reading:" + iCalFile.toString());
0086:                // Read ICalendar File in and parse it creating the relevant attributes.
0087:                // File iCalFile = new File(iCalFilePath);
0088:                try {
0089:                    FileInputStream fin = new FileInputStream(iCalFile);
0090:                    BufferedReader myInput = null;
0091:                    if (enc == null)
0092:                        myInput = new BufferedReader(new InputStreamReader(fin));
0093:                    else
0094:                        myInput = new BufferedReader(new InputStreamReader(fin,
0095:                                enc));
0096:                    String buildLine = null;
0097:
0098:                    /* Two loops, first joins lines together, second processes lines..
0099:                     */
0100:                    while ((this Line = myInput.readLine()) != null) {
0101:                        /*
0102:                         * 4.1 Content Lines
0103:                         * That is, a long
0104:                         * line can be split between any two characters by inserting a CRLF
0105:                         * immediately followed by a single linear white space character (i.e.,
0106:                         * SPACE, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9)
0107:                         *
0108:                         */
0109:
0110:                        lineCtr++;
0111:                        if (this Line.startsWith(" ")
0112:                                || this Line.startsWith("\u0032 ")
0113:                                || this Line.startsWith("\u0009")) {
0114:                            buildLine = buildLine + this Line.substring(1);
0115:                        } else if (buildLine != null) {
0116:                            try {
0117:                                processLine(buildLine);
0118:                            } catch (Exception e) {
0119:                                logger
0120:                                        .fine("Error processing line of ICalendar, line:"
0121:                                                + lineCtr
0122:                                                + "iCal Line = "
0123:                                                + buildLine + "Exception" + e);
0124:                            }
0125:
0126:                            buildLine = this Line;
0127:                        } else {
0128:                            buildLine = this Line;
0129:                        }
0130:                    }
0131:                } catch (Exception e) {
0132:                    e.printStackTrace(System.err);
0133:                }
0134:                return ical;
0135:            }
0136:
0137:            public void processLine(java.lang.String iCalLine) {
0138:
0139:                if (iCalLine.startsWith("BEGIN:VCALENDAR")) {
0140:                    // Start a new ICalendar. Null all values.
0141:                    // This should be the first item in the calendar.
0142:                    /*
0143:                     4.4 ICalendar Object
0144:                     The Calendaring and Scheduling Core Object is a collection of
0145:                    calendaring and scheduling information. Typically, this information
0146:                    will consist of a single ICalendar object. However, multiple
0147:                    ICalendar objects can be sequentially grouped together. The first
0148:                    line and last line of the ICalendar object MUST contain a pair of
0149:                    ICalendar object delimiter strings. The syntax for an ICalendar
0150:                    object is as follows:
0151:                        icalobject = 1*("BEGIN" ":" "VCALENDAR" CRLF
0152:                              icalbody
0153:                                "END" ":" "VCALENDAR" CRLF)
0154:                     The following is a simple example of an ICalendar object:
0155:                     BEGIN:VCALENDAR
0156:                     VERSION:2.0
0157:                     PRODID:-//hacksw/handcal//NONSGML v1.0//EN
0158:                     BEGIN:VEVENT
0159:                     DTSTART:19970714T170000Z
0160:                     DTEND:19970715T035959Z
0161:                     SUMMARY:Bastille Day Party
0162:                     END:VEVENT
0163:                     END:VCALENDAR
0164:                     */
0165:                    ical = new ICalendar();
0166:                } else if (iCalLine.startsWith("END:VCALENDAR")) {
0167:
0168:                } else if (iCalLine.startsWith("CALSCALE")) {
0169:                    /*
0170:                    4.7 Calendar Properties
0171:
0172:                       The Calendar Properties are attributes that apply to the ICalendar
0173:                       object, as a whole. These properties do not appear within a calendar
0174:                       component. They SHOULD be specified after the "BEGIN:VCALENDAR"
0175:                       property and prior to any calendar component.
0176:
0177:                    4.7.1 Calendar Scale
0178:
0179:                       Property Name: CALSCALE
0180:
0181:                       Purpose: This property defines the calendar scale used for the
0182:                       calendar information specified in the ICalendar object.
0183:                       Value Type: TEXT
0184:
0185:                       Property Parameters: Non-standard property parameters can be
0186:                       specified on this property.
0187:
0188:                       Conformance: Property can be specified in an ICalendar object. The
0189:                       default value is "GREGORIAN".
0190:
0191:                       Description: This memo is based on the Gregorian calendar scale. The
0192:                       Gregorian calendar scale is assumed if this property is not specified
0193:                       in the ICalendar object. It is expected that other calendar scales
0194:                       will be defined in other specifications or by future versions of this
0195:                       memo.
0196:
0197:                       Format Definition: The property is defined by the following notation:
0198:
0199:                         calscale   = "CALSCALE" calparam ":" calvalue CRLF
0200:
0201:                         calparam   = *(";" xparam)
0202:
0203:                         calvalue   = "GREGORIAN" / iana-token
0204:
0205:                       Example: The following is an example of this property:
0206:
0207:                         CALSCALE:GREGORIAN
0208:
0209:                     */
0210:
0211:                    ical.setCalScale(extractAttribute(iCalLine, "CALSCALE"));
0212:                }
0213:
0214:                else if (iCalLine.startsWith("PRODID")) {
0215:                    /*
0216:                     4.7.3 Product Identifier
0217:
0218:                       Property Name: PRODID
0219:
0220:                       Purpose: This property specifies the identifier for the product that
0221:                       created the ICalendar object.
0222:
0223:                       Value Type: TEXT
0224:
0225:                       Property Parameters: Non-standard property parameters can be
0226:                       specified on this property.
0227:
0228:                       Conformance: The property MUST be specified once in an ICalendar
0229:                       object.
0230:
0231:                       Description: The vendor of the implementation SHOULD assure that this
0232:                       is a globally unique identifier; using some technique such as an FPI
0233:                       value, as defined in [ISO 9070].
0234:
0235:                       This property SHOULD not be used to alter the interpretation of an
0236:                       ICalendar object beyond the semantics specified in this memo. For
0237:                       example, it is not to be used to further the understanding of non-
0238:                       standard properties.
0239:
0240:                       Format Definition: The property is defined by the following notation:
0241:
0242:                         prodid     = "PRODID" pidparam ":" pidvalue CRLF
0243:                         pidparam   = *(";" xparam)
0244:
0245:                         pidvalue   = text
0246:                         ;Any text that describes the product and version
0247:                         ;and that is generally assured of being unique.
0248:
0249:                       Example: The following is an example of this property. It does not
0250:                       imply that English is the default language.
0251:
0252:                         PRODID:-//ABC Corporation//NONSGML My Product//EN
0253:
0254:                     */
0255:                    ical.setProdId(extractAttribute(iCalLine, "PRODID"));
0256:                } else if (iCalLine.startsWith("VERSION")) {
0257:                    /*
0258:                     4.7.4 Version
0259:
0260:                       Property Name: VERSION
0261:
0262:                       Purpose: This property specifies the identifier corresponding to the
0263:                       highest version number or the minimum and maximum range of the
0264:                       ICalendar specification that is required in order to interpret the
0265:                       ICalendar object.
0266:
0267:                       Value Type: TEXT
0268:
0269:                       Property Parameters: Non-standard property parameters can be
0270:                       specified on this property.
0271:
0272:                       Conformance: This property MUST be specified by an ICalendar object,
0273:                       but MUST only be specified once.
0274:
0275:                       Description: A value of "2.0" corresponds to this memo.
0276:
0277:                       Format Definition: The property is defined by the following notation:
0278:
0279:                         version    = "VERSION" verparam ":" vervalue CRLF
0280:
0281:                         verparam   = *(";" xparam)
0282:
0283:                         vervalue   = "2.0"         ;This memo
0284:                                    / maxver
0285:                                    / (minver ";" maxver)
0286:
0287:                         minver     = <A IANA registered ICalendar version identifier>
0288:                         ;Minimum ICalendar version needed to parse the ICalendar object
0289:
0290:                         maxver     = <A IANA registered ICalendar version identifier>
0291:                         ;Maximum ICalendar version needed to parse the ICalendar object
0292:
0293:                       Example: The following is an example of this property:
0294:
0295:                         VERSION:2.0
0296:
0297:                     */
0298:                    ical.setVersion(extractAttribute(iCalLine, "VERSION"));
0299:                } else if (iCalLine.startsWith("ATTACH")) {
0300:                    /*
0301:                    4.8 Component Properties
0302:
0303:                       The following properties can appear within calendar components, as
0304:                       specified by each component property definition.
0305:
0306:                    4.8.1 Descriptive Component Properties
0307:
0308:                       The following properties specify descriptive information about
0309:                       calendar components.
0310:
0311:                    4.8.1.1 Attachment
0312:
0313:                       Property Name: ATTACH
0314:
0315:                       Purpose: The property provides the capability to associate a document
0316:                       object with a calendar component.
0317:
0318:                       Value Type: The default value type for this property is URI. The
0319:                       value type can also be set to BINARY to indicate inline binary
0320:                       encoded content information.
0321:
0322:                       Property Parameters: Non-standard, inline encoding, format type and
0323:                       value data type property parameters can be specified on this
0324:                       property.
0325:
0326:                       Conformance: The property can be specified in a "VEVENT", "VTODO",
0327:                       "VJOURNAL" or "VALARM" calendar components.
0328:
0329:                       Description: The property can be specified within "VEVENT", "VTODO",
0330:                       "VJOURNAL", or "VALARM" calendar components. This property can be
0331:                       specified multiple times within an ICalendar object.
0332:
0333:                       Format Definition: The property is defined by the following notation:
0334:
0335:                         attach     = "ATTACH" attparam ":" uri  CRLF
0336:
0337:                         attach     =/ "ATTACH" attparam ";" "ENCODING" "=" "BASE64"
0338:                                       ";" "VALUE" "=" "BINARY" ":" binary
0339:
0340:                         attparam   = *(
0341:
0342:                                    ; the following is optional,
0343:                                    ; but MUST NOT occur more than once
0344:
0345:                                    (";" fmttypeparam) /
0346:
0347:                                    ; the following is optional,
0348:                                    ; and MAY occur more than once
0349:
0350:                                    (";" xparam)
0351:
0352:                                    )
0353:
0354:                       Example: The following are examples of this property:
0355:
0356:                         ATTACH:CID:jsmith.part3.960817T083000.xyzMail@host1.com
0357:
0358:                         ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/
0359:                          reports/r-960812.ps
0360:
0361:                     */
0362:                    if (icalEventParser) {
0363:                        iCalEvent
0364:                                .setAttach(extractAttribute(iCalLine, "ATTACH"));
0365:                    }
0366:
0367:                } else if (iCalLine.startsWith("CATEGORIES")) {
0368:                    /*
0369:                     4.8.1.2 Categories
0370:
0371:                       Property Name: CATEGORIES
0372:
0373:                       Purpose: This property defines the categories for a calendar
0374:                       component.
0375:
0376:                       Value Type: TEXT
0377:
0378:                       Property Parameters: Non-standard and language property parameters
0379:                       can be specified on this property.
0380:
0381:                       Conformance: The property can be specified within "VEVENT", "VTODO"
0382:                       or "VJOURNAL" calendar components.
0383:
0384:                       Description: This property is used to specify categories or subtypes
0385:                       of the calendar component. The categories are useful in searching for
0386:                       a calendar component of a particular type and category. Within the
0387:                       "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
0388:                       category can be specified as a list of categories separated by the
0389:                       COMMA character (US-ASCII decimal 44).
0390:
0391:                       Format Definition: The property is defined by the following notation:
0392:
0393:                         categories = "CATEGORIES" catparam ":" text *("," text)
0394:                                      CRLF
0395:
0396:                         catparam   = *(
0397:
0398:                                    ; the following is optional,
0399:                                    ; but MUST NOT occur more than once
0400:
0401:                                    (";" languageparam ) /
0402:
0403:                                    ; the following is optional,
0404:                                    ; and MAY occur more than once
0405:
0406:                                    (";" xparam)
0407:
0408:                                    )
0409:
0410:                       Example: The following are examples of this property:
0411:
0412:                         CATEGORIES:APPOINTMENT,EDUCATION
0413:
0414:                         CATEGORIES:MEETING
0415:                     */
0416:                    if (icalEventParser) {
0417:                        iCalEvent.setCategories(extractAttribute(iCalLine,
0418:                                "CATEGORIES"));
0419:                    }
0420:                } else if (iCalLine.startsWith("CLASS")) {
0421:                    /*
0422:                    4.8.1.3 Classification
0423:
0424:                    Property Name: CLASS
0425:
0426:                    Purpose: This property defines the access classification for a
0427:                    calendar component.
0428:
0429:                    Value Type: TEXT
0430:
0431:                    Property Parameters: Non-standard property parameters can be
0432:                    specified on this property.
0433:
0434:                    Conformance: The property can be specified once in a "VEVENT",
0435:                    "VTODO" or "VJOURNAL" calendar components.
0436:
0437:                    Description: An access classification is only one component of the
0438:                    general security system within a calendar application. It provides a
0439:                    method of capturing the scope of the access the calendar owner
0440:                    intends for information within an individual calendar entry. The
0441:                    access classification of an individual ICalendar component is useful
0442:                    when measured along with the other security components of a calendar
0443:                    system (e.g., calendar user authentication, authorization, access
0444:                    rights, access role, etc.). Hence, the semantics of the individual
0445:                    access classifications cannot be completely defined by this memo
0446:                    alone. Additionally, due to the "blind" nature of most exchange
0447:                    processes using this memo, these access classifications cannot serve
0448:                    as an enforcement statement for a system receiving an ICalendar
0449:                    object. Rather, they provide a method for capturing the intention of
0450:                    the calendar owner for the access to the calendar component.
0451:
0452:                    Format Definition: The property is defined by the following notation:
0453:
0454:                     class      = "CLASS" classparam ":" classvalue CRLF
0455:                     classparam = *(";" xparam)
0456:                     classvalue = "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token
0457:                                / x-name
0458:                     ;Default is PUBLIC
0459:
0460:                    Example: The following is an example of this property:
0461:
0462:                     CLASS:PUBLIC
0463:
0464:                     */
0465:                    if (icalEventParser) {
0466:                        iCalEvent.setEventClass(extractAttribute(iCalLine,
0467:                                "CLASS"));
0468:                    }
0469:                } else if (iCalLine.startsWith("COMMENT")) {
0470:                    /*
0471:                     4.8.1.4 Comment
0472:
0473:                       Property Name: COMMENT
0474:
0475:                       Purpose: This property specifies non-processing information intended
0476:                       to provide a comment to the calendar user.
0477:
0478:                       Value Type: TEXT
0479:
0480:                       Property Parameters: Non-standard, alternate text representation and
0481:                       language property parameters can be specified on this property.
0482:
0483:                       Conformance: This property can be specified in "VEVENT", "VTODO",
0484:                       "VJOURNAL", "VTIMEZONE" or "VFREEBUSY" calendar components.
0485:
0486:                       Description: The property can be specified multiple times.
0487:
0488:                       Format Definition: The property is defined by the following notation:
0489:
0490:                         comment    = "COMMENT" commparam ":" text CRLF
0491:
0492:                         commparam  = *(
0493:
0494:                                    ; the following are optional,
0495:                                    ; but MUST NOT occur more than once
0496:
0497:                                    (";" altrepparam) / (";" languageparam) /
0498:
0499:                                    ; the following is optional,
0500:                                    ; and MAY occur more than once
0501:
0502:                                    (";" xparam)
0503:
0504:                                    )
0505:
0506:                       Example: The following is an example of this property:
0507:
0508:                         COMMENT:The meeting really needs to include both ourselves
0509:                           and the customer. We can't hold this  meeting without them.
0510:                           As a matter of fact\, the venue for the meeting ought to be at
0511:                           their site. - - John
0512:
0513:                       The data type for this property is TEXT.
0514:
0515:                     */
0516:                    if (icalEventParser) {
0517:                        iCalEvent.setComment(extractAttribute(iCalLine,
0518:                                "COMMENT"));
0519:                    }
0520:                } else if (iCalLine.startsWith("DESCRIPTION")) {
0521:                    /*
0522:                     4.8.1.5 Description
0523:
0524:                       Property Name: DESCRIPTION
0525:
0526:                       Purpose: This property provides a more complete description of the
0527:                       calendar component, than that provided by the "SUMMARY" property.
0528:
0529:                       Value Type: TEXT
0530:
0531:                       Property Parameters: Non-standard, alternate text representation and
0532:                       language property parameters can be specified on this property.
0533:
0534:                       Conformance: The property can be specified in the "VEVENT", "VTODO",
0535:                       "VJOURNAL" or "VALARM" calendar components. The property can be
0536:                       specified multiple times only within a "VJOURNAL" calendar component.
0537:
0538:                       Description: This property is used in the "VEVENT" and "VTODO" to
0539:                       capture lengthy textual decriptions associated with the activity.
0540:
0541:                       This property is used in the "VJOURNAL" calendar component to capture
0542:                       one more textual journal entries.
0543:
0544:                       This property is used in the "VALARM" calendar component to capture
0545:                       the display text for a DISPLAY category of alarm, to capture the body
0546:                       text for an EMAIL category of alarm and to capture the argument
0547:                       string for a PROCEDURE category of alarm.
0548:
0549:                       Format Definition: The property is defined by the following notation:
0550:
0551:                         description        = "DESCRIPTION" descparam ":" text CRLF
0552:
0553:                         descparam  = *(
0554:
0555:                                    ; the following are optional,
0556:                                    ; but MUST NOT occur more than once
0557:
0558:                                    (";" altrepparam) / (";" languageparam) /
0559:
0560:                                    ; the following is optional,
0561:                                    ; and MAY occur more than once
0562:
0563:                                    (";" xparam)
0564:
0565:                                    )
0566:                       Example: The following is an example of the property with formatted
0567:                       line breaks in the property value:
0568:
0569:                         DESCRIPTION:Meeting to provide technical review for "Phoenix"
0570:                           design.\n Happy Face Conference Room. Phoenix design team
0571:                           MUST attend this meeting.\n RSVP to team leader.
0572:
0573:                       The following is an example of the property with folding of long
0574:                       lines:
0575:
0576:                         DESCRIPTION:Last draft of the new novel is to be completed
0577:                           for the editor's proof today.
0578:                     */
0579:                    if (icalEventParser) {
0580:                        iCalEvent.setDescription(extractAttribute(iCalLine,
0581:                                "DESCRIPTION"));
0582:                    }
0583:                } else if (iCalLine.startsWith("GEO")) {
0584:                    /*
0585:                     4.8.1.6 Geographic Position
0586:
0587:                       Property Name: GEO
0588:
0589:                       Purpose: This property specifies information related to the global
0590:                       position for the activity specified by a calendar component.
0591:
0592:                       Value Type: FLOAT. The value MUST be two SEMICOLON separated FLOAT
0593:                       values.
0594:
0595:                       Property Parameters: Non-standard property parameters can be
0596:                       specified on this property.
0597:
0598:                       Conformance: This property can be specified in  "VEVENT" or "VTODO"
0599:                       calendar components.
0600:
0601:                       Description: The property value specifies latitude and longitude, in
0602:                       that order (i.e., "LAT LON" ordering). The longitude represents the
0603:                       location east or west of the prime meridian as a positive or negative
0604:                       real number, respectively. The longitude and latitude values MAY be
0605:                       specified up to six decimal places, which will allow for accuracy to
0606:                       within one meter of geographical position. Receiving applications
0607:                       MUST accept values of this precision and MAY truncate values of
0608:                       greater precision.
0609:
0610:                       Values for latitude and longitude shall be expressed as decimal
0611:                       fractions of degrees. Whole degrees of latitude shall be represented
0612:                       by a two-digit decimal number ranging from 0 through 90. Whole
0613:                       degrees of longitude shall be represented by a decimal number ranging
0614:                       from 0 through 180. When a decimal fraction of a degree is specified,
0615:                       it shall be separated from the whole number of degrees by a decimal
0616:                       point.
0617:
0618:                       Latitudes north of the equator shall be specified by a plus sign (+),
0619:                       or by the absence of a minus sign (-), preceding the digits
0620:                       designating degrees. Latitudes south of the Equator shall be
0621:                       designated by a minus sign (-) preceding the digits designating
0622:                       degrees. A point on the Equator shall be assigned to the Northern
0623:                       Hemisphere.
0624:
0625:                       Longitudes east of the prime meridian shall be specified by a plus
0626:                       sign (+), or by the absence of a minus sign (-), preceding the digits
0627:                       designating degrees. Longitudes west of the meridian shall be
0628:                       designated by minus sign (-) preceding the digits designating
0629:                       degrees. A point on the prime meridian shall be assigned to the
0630:                       Eastern Hemisphere. A point on the 180th meridian shall be assigned
0631:                       to the Western Hemisphere. One exception to this last convention is
0632:                       permitted. For the special condition of describing a band of latitude
0633:                       around the earth, the East Bounding Coordinate data element shall be
0634:                       assigned the value +180 (180) degrees.
0635:
0636:                       Any spatial address with a latitude of +90 (90) or -90 degrees will
0637:                       specify the position at the North or South Pole, respectively. The
0638:                       component for longitude may have any legal value.
0639:
0640:                       With the exception of the special condition described above, this
0641:                       form is specified in Department of Commerce, 1986, Representation of
0642:                       geographic point locations for information interchange (Federal
0643:                       Information Processing Standard 70-1):  Washington,  Department of
0644:                       Commerce, National Institute of Standards and Technology.
0645:
0646:                       The simple formula for converting degrees-minutes-seconds into
0647:                       decimal degrees is:
0648:
0649:                         decimal = degrees + minutes/60 + seconds/3600.
0650:
0651:                       Format Definition: The property is defined by the following notation:
0652:
0653:                         geo        = "GEO" geoparam ":" geovalue CRLF
0654:
0655:                         geoparam   = *(";" xparam)
0656:
0657:                         geovalue   = float ";" float
0658:                         ;Latitude and Longitude components
0659:
0660:                       Example: The following is an example of this property:
0661:
0662:                         GEO:37.386013;-122.082932
0663:
0664:                     */
0665:                    if (icalEventParser) {
0666:
0667:                        // Get X/Y from..
0668:                        String geo = extractAttribute(iCalLine, "GEO");
0669:                        iCalEvent.setGeo(geo);
0670:                        StringTokenizer st = new StringTokenizer(geo, ":");
0671:                        try {
0672:                            iCalEvent.setGeoX(new Float(st.nextToken())
0673:                                    .floatValue());
0674:                            iCalEvent.setGeoY(new Float(st.nextToken())
0675:                                    .floatValue());
0676:                        } catch (Exception e) {
0677:                            // This means the Geo is probably badly formed, so set geoX/Y to -1
0678:                            iCalEvent.setGeoX(-1);
0679:                            iCalEvent.setGeoY(-1);
0680:                            logger.severe("Exception parsing int from line "
0681:                                    + iCalLine);
0682:                            e.printStackTrace(System.err);
0683:                        }
0684:                    }
0685:                } else if (iCalLine.startsWith("LOCATION")) {
0686:                    /*
0687:                    4.8.1.7 Location
0688:
0689:                       Property Name: LOCATION
0690:
0691:                       Purpose: The property defines the intended venue for the activity
0692:                       defined by a calendar component.
0693:
0694:                       Value Type: TEXT
0695:
0696:                       Property Parameters: Non-standard, alternate text representation and
0697:                       language property parameters can be specified on this property.
0698:
0699:                       Conformance: This property can be specified in "VEVENT" or "VTODO"
0700:                       calendar component.
0701:
0702:                       Description: Specific venues such as conference or meeting rooms may
0703:                       be explicitly specified using this property. An alternate
0704:                       representation may be specified that is a URI that points to
0705:                       directory information with more structured specification of the
0706:                       location. For example, the alternate representation may specify
0707:                       either an LDAP URI pointing to an LDAP server entry or a CID URI
0708:                       pointing to a MIME body part containing a vCard [RFC 2426] for the
0709:                       location.
0710:
0711:                       Format Definition: The property is defined by the following notation:
0712:
0713:                         location   = "LOCATION locparam ":" text CRLF
0714:
0715:                         locparam   = *(
0716:
0717:                                    ; the following are optional,
0718:                                    ; but MUST NOT occur more than once
0719:
0720:                                    (";" altrepparam) / (";" languageparam) /
0721:
0722:                                    ; the following is optional,
0723:                                    ; and MAY occur more than once
0724:
0725:                                    (";" xparam)
0726:
0727:                                    )
0728:
0729:                       Example: The following are some examples of this property:
0730:
0731:                         LOCATION:Conference Room - F123, Bldg. 002
0732:
0733:                         LOCATION;ALTREP="http://xyzcorp.com/conf-rooms/f123.vcf":
0734:                          Conference Room - F123, Bldg. 002
0735:
0736:                     */
0737:                    if (icalEventParser) {
0738:                        iCalEvent.setLocation(extractAttribute(iCalLine,
0739:                                "LOCATION"));
0740:                    }
0741:                } else if (iCalLine.startsWith("PERCENT-COMPLETE")) {
0742:                    /*
0743:                     4.8.1.8 Percent Complete
0744:
0745:                       Property Name: PERCENT-COMPLETE
0746:
0747:                       Purpose: This property is used by an assignee or delegatee of a to-do
0748:                       to convey the percent completion of a to-do to the Organizer.
0749:
0750:                       Value Type: INTEGER
0751:
0752:                       Property Parameters: Non-standard property parameters can be
0753:                       specified on this property.
0754:
0755:                       Conformance: This property can be specified in a "VTODO" calendar
0756:                       component.
0757:
0758:                       Description: The property value is a positive integer between zero
0759:                       and one hundred. A value of "0" indicates the to-do has not yet been
0760:                       started. A value of "100" indicates that the to-do has been
0761:                       completed. Integer values in between indicate the percent partially
0762:                       complete.
0763:
0764:                       When a to-do is assigned to multiple individuals, the property value
0765:                       indicates the percent complete for that portion of the to-do assigned
0766:                       to the assignee or delegatee. For example, if a to-do is assigned to
0767:                       both individuals "A" and "B". A reply from "A" with a percent
0768:                       complete of "70" indicates that "A" has completed 70% of the to-do
0769:                       assigned to them. A reply from "B" with a percent complete of "50"
0770:                       indicates "B" has completed 50% of the to-do assigned to them.
0771:
0772:                       Format Definition: The property is defined by the following notation:
0773:
0774:                         percent = "PERCENT-COMPLETE" pctparam ":" integer CRLF
0775:
0776:                         pctparam   = *(";" xparam)
0777:
0778:                       Example: The following is an example of this property to show 39%
0779:                       completion:
0780:
0781:                         PERCENT-COMPLETE:39
0782:
0783:                     */
0784:                    if (icalEventParser) {
0785:                        iCalEvent.setPercentComplete(extractAttribute(iCalLine,
0786:                                "PERCENT-COMPLETE"));
0787:                    }
0788:                } else if (iCalLine.startsWith("PRIORITY")) {
0789:                    /*
0790:                     4.8.1.9 Priority
0791:
0792:                       Property Name: PRIORITY
0793:
0794:                       Purpose: The property defines the relative priority for a calendar
0795:                       component.
0796:
0797:                       Value Type: INTEGER
0798:
0799:                       Property Parameters: Non-standard property parameters can be
0800:                       specified on this property.
0801:
0802:                       Conformance: The property can be specified in a "VEVENT" or "VTODO"
0803:                       calendar component.
0804:
0805:                       Description: The priority is specified as an integer in the range
0806:                       zero to nine. A value of zero (US-ASCII decimal 48) specifies an
0807:                       undefined priority. A value of one (US-ASCII decimal 49) is the
0808:                       highest priority. A value of two (US-ASCII decimal 50) is the second
0809:                       highest priority. Subsequent numbers specify a decreasing ordinal
0810:                       priority. A value of nine (US-ASCII decimal 58) is the lowest
0811:                       priority.
0812:
0813:                       A CUA with a three-level priority scheme of "HIGH", "MEDIUM" and
0814:                       "LOW" is mapped into this property such that a property value in the
0815:                       range of one (US-ASCII decimal 49) to four (US-ASCII decimal 52)
0816:                       specifies "HIGH" priority. A value of five (US-ASCII decimal 53) is
0817:                       the normal or "MEDIUM" priority. A value in the range of six (US-
0818:                       ASCII decimal 54) to nine (US-ASCII decimal 58) is "LOW" priority.
0819:
0820:                       A CUA with a priority schema of "A1", "A2", "A3", "B1", "B2", ...,
0821:                       "C3" is mapped into this property such that a property value of one
0822:                       (US-ASCII decimal 49) specifies "A1", a property value of two (US-
0823:                       ASCII decimal 50) specifies "A2", a property value of three (US-ASCII
0824:                       decimal 51) specifies "A3", and so forth up to a property value of 9
0825:                       (US-ASCII decimal 58) specifies "C3".
0826:
0827:                       Other integer values are reserved for future use.
0828:
0829:                       Within a "VEVENT" calendar component, this property specifies a
0830:                       priority for the event. This property may be useful when more than
0831:                       one event is scheduled for a given time period.
0832:
0833:                       Within a "VTODO" calendar component, this property specified a
0834:                       priority for the to-do. This property is useful in prioritizing
0835:                       multiple action items for a given time period.
0836:
0837:                       Format Definition: The property is specified by the following
0838:                       notation:
0839:
0840:                         priority   = "PRIORITY" prioparam ":" privalue CRLF
0841:                         ;Default is zero
0842:
0843:                         prioparam  = *(";" xparam)
0844:
0845:                         privalue   = integer       ;Must be in the range [0..9]
0846:                            ; All other values are reserved for future use
0847:
0848:                       The following is an example of a property with the highest priority:
0849:
0850:                         PRIORITY:1
0851:
0852:                       The following is an example of a property with a next highest
0853:                       priority:
0854:
0855:                         PRIORITY:2
0856:
0857:                       Example: The following is an example of a property with no priority.
0858:                       This is equivalent to not specifying the "PRIORITY" property:
0859:
0860:                         PRIORITY:0
0861:
0862:                     */
0863:                    if (icalEventParser) {
0864:                        try {
0865:                            iCalEvent.setPriority(Integer
0866:                                    .parseInt(extractAttribute(iCalLine,
0867:                                            "PRIORITY")));
0868:                        } catch (Exception e) {
0869:                            logger.severe("Exception parsing int from line "
0870:                                    + iCalLine);
0871:                            e.printStackTrace(System.err);
0872:                        }
0873:                    }
0874:                } else if (iCalLine.startsWith("RESOURCES")) {
0875:                    /*
0876:                    4.8.1.10 Resources
0877:
0878:                       Property Name: RESOURCES
0879:
0880:                       Purpose: This property defines the equipment or resources anticipated
0881:                       for an activity specified by a calendar entity..
0882:
0883:                       Value Type: TEXT
0884:
0885:                       Property Parameters: Non-standard, alternate text representation and
0886:                       language property parameters can be specified on this property.
0887:
0888:                       Conformance: This property can be specified in "VEVENT" or "VTODO"
0889:                       calendar component.
0890:
0891:                       Description: The property value is an arbitrary text. More than one
0892:                       resource can be specified as a list of resources separated by the
0893:                       COMMA character (US-ASCII decimal 44).
0894:
0895:                       Format Definition: The property is defined by the following notation:
0896:
0897:                         resources  = "RESOURCES" resrcparam ":" text *("," text) CRLF
0898:
0899:                         resrcparam = *(
0900:
0901:                                    ; the following are optional,
0902:                                    ; but MUST NOT occur more than once
0903:
0904:                                    (";" altrepparam) / (";" languageparam) /
0905:
0906:                                    ; the following is optional,
0907:                                    ; and MAY occur more than once
0908:
0909:                                    (";" xparam)
0910:
0911:                                    )
0912:
0913:                       Example: The following is an example of this property:
0914:
0915:                         RESOURCES:EASEL,PROJECTOR,VCR
0916:
0917:                         RESOURCES;LANGUAGE=fr:1 raton-laveur
0918:
0919:                     */
0920:                    if (icalEventParser) {
0921:                        iCalEvent.setResources(extractAttribute(iCalLine,
0922:                                "RESOURCES"));
0923:                    }
0924:                } else if (iCalLine.startsWith("STATUS")) {
0925:                    /*
0926:                    4.8.1.11 Status
0927:
0928:                       Property Name: STATUS
0929:
0930:                       Purpose: This property defines the overall status or confirmation for
0931:                       the calendar component.
0932:
0933:                       Value Type: TEXT
0934:
0935:                       Property Parameters: Non-standard property parameters can be
0936:                       specified on this property.
0937:
0938:                       Conformance: This property can be specified in "VEVENT", "VTODO" or
0939:                       "VJOURNAL" calendar components.
0940:
0941:                       Description: In a group scheduled calendar component, the property is
0942:                       used by the "Organizer" to provide a confirmation of the event to the
0943:                       "Attendees". For example in a "VEVENT" calendar component, the
0944:                       "Organizer" can indicate that a meeting is tentative, confirmed or
0945:                       cancelled. In a "VTODO" calendar component, the "Organizer" can
0946:                       indicate that an action item needs action, is completed, is in
0947:                       process or being worked on, or has been cancelled. In a "VJOURNAL"
0948:                       calendar component, the "Organizer" can indicate that a journal entry
0949:                       is draft, final or has been cancelled or removed.
0950:
0951:                       Format Definition: The property is defined by the following notation:
0952:
0953:                         status     = "STATUS" statparam] ":" statvalue CRLF
0954:
0955:                         statparam  = *(";" xparam)
0956:
0957:                         statvalue  = "TENTATIVE"           ;Indicates event is
0958:                                                            ;tentative.
0959:                                    / "CONFIRMED"           ;Indicates event is
0960:                                                            ;definite.
0961:                                    / "CANCELLED"           ;Indicates event was
0962:                                                            ;cancelled.
0963:                            ;Status values for a "VEVENT"
0964:
0965:                         statvalue  =/ "NEEDS-ACTION"       ;Indicates to-do needs action.
0966:                                    / "COMPLETED"           ;Indicates to-do completed.
0967:                                    / "IN-PROCESS"          ;Indicates to-do in process of
0968:                                    / "CANCELLED"           ;Indicates to-do was cancelled.
0969:                            ;Status values for "VTODO".
0970:
0971:                         statvalue  =/ "DRAFT"              ;Indicates journal is draft.
0972:                                    / "FINAL"               ;Indicates journal is final.
0973:                                    / "CANCELLED"           ;Indicates journal is removed.
0974:                            ;Status values for "VJOURNAL".
0975:
0976:                       Example: The following is an example of this property for a "VEVENT"
0977:                       calendar component:
0978:
0979:                         STATUS:TENTATIVE
0980:
0981:                       The following is an example of this property for a "VTODO" calendar
0982:                       component:
0983:
0984:                         STATUS:NEEDS-ACTION
0985:
0986:                       The following is an example of this property for a "VJOURNAL"
0987:                       calendar component:
0988:
0989:                         STATUS:DRAFT
0990:                     */
0991:                    if (icalEventParser) {
0992:                        iCalEvent.setResources(extractAttribute(iCalLine,
0993:                                "STATUS"));
0994:                    }
0995:                } else if (iCalLine.startsWith("SUMMARY")) {
0996:                    /*
0997:                    4.8.1.12 Summary
0998:
0999:                       Property Name: SUMMARY
1000:
1001:                       Purpose: This property defines a short summary or subject for the
1002:                       calendar component.
1003:
1004:                       Value Type: TEXT
1005:
1006:                       Property Parameters: Non-standard, alternate text representation and
1007:                       language property parameters can be specified on this property.
1008:
1009:                       Conformance: The property can be specified in "VEVENT", "VTODO",
1010:                       "VJOURNAL" or "VALARM" calendar components.
1011:
1012:                       Description: This property is used in the "VEVENT", "VTODO" and
1013:                       "VJOURNAL" calendar components to capture a short, one line summary
1014:                       about the activity or journal entry.
1015:
1016:                       This property is used in the "VALARM" calendar component to capture
1017:                       the subject of an EMAIL category of alarm.
1018:
1019:                       Format Definition: The property is defined by the following notation:
1020:
1021:                         summary    = "SUMMARY" summparam ":" text CRLF
1022:
1023:                         summparam  = *(
1024:
1025:                                    ; the following are optional,
1026:                                    ; but MUST NOT occur more than once
1027:
1028:                                    (";" altrepparam) / (";" languageparam) /
1029:
1030:                                    ; the following is optional,
1031:                                    ; and MAY occur more than once
1032:
1033:                                    (";" xparam)
1034:
1035:                                    )
1036:
1037:                       Example: The following is an example of this property:
1038:
1039:                         SUMMARY:Department Party
1040:                     */
1041:                    if (icalEventParser) {
1042:                        iCalEvent.setSummary(extractAttribute(iCalLine,
1043:                                "SUMMARY"));
1044:                    }
1045:                } else if (iCalLine.startsWith("COMPLETED")) {
1046:                    /*
1047:                     4.8.2 Date and Time Component Properties
1048:
1049:                       The following properties specify date and time related information in
1050:                       calendar components.
1051:
1052:                    4.8.2.1 Date/Time Completed
1053:
1054:                       Property Name: COMPLETED
1055:
1056:                       Purpose: This property defines the date and time that a to-do was
1057:                       actually completed.
1058:
1059:                       Value Type: DATE-TIME
1060:
1061:                       Property Parameters: Non-standard property parameters can be
1062:                       specified on this property.
1063:
1064:                       Conformance: The property can be specified in a "VTODO" calendar
1065:                       component.
1066:
1067:                       Description: The date and time MUST be in a UTC format.
1068:
1069:                       Format Definition: The property is defined by the following notation:
1070:
1071:                         completed  = "COMPLETED" compparam ":" date-time CRLF
1072:                         compparam  = *(";" xparam)
1073:
1074:                       Example: The following is an example of this property:
1075:
1076:                         COMPLETED:19960401T235959Z
1077:
1078:                     */
1079:
1080:                } else if (iCalLine.startsWith("DTEND")) {
1081:                    /*
1082:                     4.8.2.2 Date/Time End
1083:
1084:                       Property Name: DTEND
1085:
1086:                       Purpose: This property specifies the date and time that a calendar
1087:                       component ends.
1088:
1089:                       Value Type: The default value type is DATE-TIME. The value type can
1090:                       be set to a DATE value type.
1091:
1092:                       Property Parameters: Non-standard, value data type, time zone
1093:                       identifier property parameters can be specified on this property.
1094:
1095:                       Conformance: This property can be specified in "VEVENT" or
1096:                       "VFREEBUSY" calendar components.
1097:
1098:                       Description: Within the "VEVENT" calendar component, this property
1099:                       defines the date and time by which the event ends. The value MUST be
1100:                       later in time than the value of the "DTSTART" property.
1101:
1102:                       Within the "VFREEBUSY" calendar component, this property defines the
1103:                       end date and time for the free or busy time information. The time
1104:                       MUST be specified in the UTC time format. The value MUST be later in
1105:                       time than the value of the "DTSTART" property.
1106:
1107:                       Format Definition: The property is defined by the following notation:
1108:
1109:                         dtend      = "DTEND" dtendparam":" dtendval CRLF
1110:
1111:                         dtendparam = *(
1112:
1113:                                    ; the following are optional,
1114:                                    ; but MUST NOT occur more than once
1115:
1116:                                    (";" "VALUE" "=" ("DATE-TIME" / "DATE")) /
1117:                                    (";" tzidparam) /
1118:
1119:                                    ; the following is optional,
1120:                                    ; and MAY occur more than once
1121:                                    (";" xparam)
1122:
1123:                                    )
1124:
1125:
1126:
1127:                         dtendval   = date-time / date
1128:                         ;Value MUST match value type
1129:
1130:                       Example: The following is an example of this property:
1131:
1132:                         DTEND:19960401T235959Z
1133:
1134:                         DTEND;VALUE=DATE:19980704
1135:
1136:                     */
1137:                    if (icalEventParser == true) {
1138:                        iCalEvent.setDateEnd(convertIcalDate(extractAttribute(
1139:                                iCalLine, "DTEND")));
1140:                    }
1141:                } else if (iCalLine.startsWith("DUE")) {
1142:                    /*
1143:                     4.8.2.3 Date/Time Due
1144:
1145:                       Property Name: DUE
1146:
1147:                       Purpose: This property defines the date and time that a to-do is
1148:                       expected to be completed.
1149:
1150:                       Value Type: The default value type is DATE-TIME. The value type can
1151:                       be set to a DATE value type.
1152:
1153:                       Property Parameters: Non-standard, value data type, time zone
1154:                       identifier property parameters can be specified on this property.
1155:
1156:                       Conformance: The property can be specified once in a "VTODO" calendar
1157:                       component.
1158:
1159:                       Description: The value MUST be a date/time equal to or after the
1160:                       DTSTART value, if specified.
1161:
1162:                       Format Definition: The property is defined by the following notation:
1163:
1164:                         due        = "DUE" dueparam":" dueval CRLF
1165:
1166:                         dueparam   = *(
1167:                                    ; the following are optional,
1168:                                    ; but MUST NOT occur more than once
1169:
1170:                                    (";" "VALUE" "=" ("DATE-TIME" / "DATE")) /
1171:                                    (";" tzidparam) /
1172:
1173:                                    ; the following is optional,
1174:                                    ; and MAY occur more than once
1175:
1176:                     *(";" xparam)
1177:
1178:                                    )
1179:
1180:
1181:
1182:                         dueval     = date-time / date
1183:                         ;Value MUST match value type
1184:
1185:                       Example: The following is an example of this property:
1186:
1187:                         DUE:19980430T235959Z
1188:
1189:                     */
1190:                } else if (iCalLine.startsWith("DTSTART")) {
1191:                    /*
1192:                    4.8.2.4 Date/Time Start
1193:
1194:                       Property Name: DTSTART
1195:
1196:                       Purpose: This property specifies when the calendar component begins.
1197:
1198:                       Value Type: The default value type is DATE-TIME. The time value MUST
1199:                       be one of the forms defined for the DATE-TIME value type. The value
1200:                       type can be set to a DATE value type.
1201:
1202:                       Property Parameters: Non-standard, value data type, time zone
1203:                       identifier property parameters can be specified on this property.
1204:
1205:                       Conformance: This property can be specified in the "VEVENT", "VTODO",
1206:                       "VFREEBUSY", or "VTIMEZONE" calendar components.
1207:
1208:                       Description: Within the "VEVENT" calendar component, this property
1209:                       defines the start date and time for the event. The property is
1210:                       REQUIRED in "VEVENT" calendar components. Events can have a start
1211:                       date/time but no end date/time. In that case, the event does not take
1212:                       up any time.
1213:
1214:                       Within the "VFREEBUSY" calendar component, this property defines the
1215:                       start date and time for the free or busy time information. The time
1216:                       MUST be specified in UTC time.
1217:
1218:                       Within the "VTIMEZONE" calendar component, this property defines the
1219:                       effective start date and time for a time zone specification. This
1220:                       property is REQUIRED within each STANDARD and DAYLIGHT part included
1221:                       in "VTIMEZONE" calendar components and MUST be specified as a local
1222:                       DATE-TIME without the "TZID" property parameter.
1223:
1224:                       Format Definition: The property is defined by the following notation:
1225:
1226:                         dtstart    = "DTSTART" dtstparam ":" dtstval CRLF
1227:
1228:                         dtstparam  = *(
1229:
1230:                                    ; the following are optional,
1231:                                    ; but MUST NOT occur more than once
1232:
1233:                                    (";" "VALUE" "=" ("DATE-TIME" / "DATE")) /
1234:                                    (";" tzidparam) /
1235:
1236:                                    ; the following is optional,
1237:                                    ; and MAY occur more than once
1238:
1239:                     *(";" xparam)
1240:
1241:                                    )
1242:
1243:
1244:
1245:                         dtstval    = date-time / date
1246:                         ;Value MUST match value type
1247:
1248:                       Example: The following is an example of this property:
1249:
1250:                         DTSTART:19980118T073000Z
1251:
1252:                     */
1253:
1254:                    if (icalTimeZoneParser == true) {
1255:                        if (timeZoneType.equalsIgnoreCase("STANDARD")) {
1256:                            icalTimeZone
1257:                                    .setstandardDtStart(convertIcalDate(extractAttribute(
1258:                                            iCalLine, "DTSTART")));
1259:                        } else {
1260:                            icalTimeZone
1261:                                    .setdaylightDtStart(convertIcalDate(extractAttribute(
1262:                                            iCalLine, "DTSTART")));
1263:                        }
1264:                    } else if (icalEventParser == true) {
1265:                        iCalEvent
1266:                                .setDateStart(convertIcalDate(extractAttribute(
1267:                                        iCalLine, "DTSTART")));
1268:                    }
1269:                } else if (iCalLine.startsWith("DURATION")) {
1270:                    /*
1271:                    4.8.2.5 Duration
1272:
1273:                       Property Name: DURATION
1274:
1275:                       Purpose: The property specifies a positive duration of time.
1276:
1277:                       Value Type: DURATION
1278:
1279:                       Property Parameters: Non-standard property parameters can be
1280:                       specified on this property.
1281:
1282:                       Conformance: The property can be specified in "VEVENT", "VTODO",
1283:                       "VFREEBUSY" or "VALARM" calendar components.
1284:
1285:                       Description: In a "VEVENT" calendar component the property may be
1286:                       used to specify a duration of the event, instead of an explicit end
1287:                       date/time. In a "VTODO" calendar component the property may be used
1288:                       to specify a duration for the to-do, instead of an explicit due
1289:                       date/time. In a "VFREEBUSY" calendar component the property may be
1290:                       used to specify the interval of free time being requested. In a
1291:                       "VALARM" calendar component the property may be used to specify the
1292:                       delay period prior to repeating an alarm.
1293:
1294:                       Format Definition: The property is defined by the following notation:
1295:
1296:                         duration   = "DURATION" durparam ":" dur-value CRLF
1297:                                      ;consisting of a positive duration of time.
1298:
1299:                         durparam   = *(";" xparam)
1300:
1301:                       Example: The following is an example of this property that specifies
1302:                       an interval of time of 1 hour and zero minutes and zero seconds:
1303:
1304:                         DURATION:PT1H0M0S
1305:
1306:                       The following is an example of this property that specifies an
1307:                       interval of time of 15 minutes.
1308:
1309:                         DURATION:PT15M
1310:
1311:                     */
1312:                    if (icalEventParser == true) {
1313:                        iCalEvent.setDuration(extractAttribute(iCalLine,
1314:                                "DURATION"));
1315:                    }
1316:                }
1317:
1318:                else if (iCalLine.startsWith("BEGIN:VEVENT")) {
1319:                    /*
1320:                     4.6.1 Event Component
1321:                     Component Name: "VEVENT"
1322:                     Purpose: Provide a grouping of component properties that describe an event.
1323:                     Format Definition: A "VEVENT" calendar component is defined by the following
1324:                     notation:      eventc     = "BEGIN" ":" "VEVENT" CRLF
1325:                          eventprop *alarmc
1326:                          "END" ":" "VEVENT" CRLF
1327:                         BEGIN:VEVENT
1328:                         UID:19970901T130000Z-123401@host.com
1329:                         DTSTAMP:19970901T1300Z
1330:                         DTSTART:19970903T163000Z
1331:                         DTEND:19970903T190000Z
1332:                         SUMMARY:Annual Employee Review
1333:                         CLASS:PRIVATE
1334:                         CATEGORIES:BUSINESS,HUMAN RESOURCES
1335:                         END:VEVENT
1336:
1337:                       Description: A "VEVENT" calendar component is a grouping of component
1338:                       properties, and possibly including "VALARM" calendar components, that
1339:                       represents a scheduled amount of time on a calendar. For example, it
1340:                       can be an activity; such as a one-hour long, department meeting from
1341:                       8:00 AM to 9:00 AM, tomorrow. Generally, an event will take up time
1342:                       on an individual calendar. Hence, the event will appear as an opaque
1343:                       interval in a search for busy time. Alternately, the event can have
1344:                       its Time Transparency set to "TRANSPARENT" in order to prevent
1345:                       blocking of the event in searches for busy time.
1346:                       The "VEVENT" is also the calendar component used to specify an
1347:                       anniversary or daily reminder within a calendar. These events have a
1348:                       DATE value type for the "DTSTART" property instead of the default
1349:                       data type of DATE-TIME. If such a "VEVENT" has a "DTEND" property, it
1350:                       MUST be specified as a DATE value also. The anniversary type of
1351:                       "VEVENT" can span more than one date (i.e, "DTEND" property value is
1352:                       set to a calendar date after the "DTSTART" property value).
1353:                       The "DTSTART" property for a "VEVENT" specifies the inclusive start
1354:                       of the event. For recurring events, it also specifies the very first
1355:                       instance in the recurrence set. The "DTEND" property for a "VEVENT"
1356:                       calendar component specifies the non-inclusive end of the event. For
1357:                       cases where a "VEVENT" calendar component specifies a "DTSTART"
1358:                       property with a DATE data type but no "DTEND" property, the events
1359:                       non-inclusive end is the end of the calendar date specified by the
1360:                       "DTSTART" property. For cases where a "VEVENT" calendar component
1361:                       specifies a "DTSTART" property with a DATE-TIME data type but no
1362:                       "DTEND" property, the event ends on the same calendar date and time
1363:                       of day specified by the "DTSTART" property.
1364:                       The "VEVENT" calendar component cannot be nested within another
1365:                       calendar component. However, "VEVENT" calendar components can be
1366:                       related to each other or to a "VTODO" or to a "VJOURNAL" calendar
1367:                       component with the "RELATED-TO" property.
1368:                     */
1369:                    icalEventParser = true;
1370:                    iCalEvent = new ICalendarVEvent();
1371:                    iCalEvent.setEventClass("");
1372:                } else if (iCalLine.startsWith("UID:")) {
1373:                    if (icalEventParser) {
1374:                        iCalEvent.setUid(extractAttribute(iCalLine, "UID"));
1375:                    }
1376:                } else if (iCalLine.startsWith("END:VEVENT")) {
1377:                    if (icalEventParser == true) {
1378:                        ical.icalEventCollection.add(iCalEvent);
1379:                        icalEventParser = false;
1380:                    }
1381:                } else if (iCalLine.startsWith("BEGIN:VTODO")) {
1382:                    /*
1383:                     4.6.2 To-do Component
1384:                     Component Name: VTODO    Purpose: Provide a grouping of calendar properties that describe a to-do.
1385:                     Formal Definition: A "VTODO" calendar component is defined by the following
1386:                     notation:      todoc      = "BEGIN" ":" "VTODO" CRLF
1387:                          todoprop *alarmc
1388:                          "END" ":" "VTODO" CRLF
1389:                        todoprop   = *(                 ; the following are optional,
1390:                        ; but MUST NOT occur more than once
1391:                            class / completed / created / description / dtstamp /
1392:                            dtstart / geo / last-mod / location / organizer /
1393:                            percent / priority / recurid / seq / status /
1394:                            summary / uid / url /
1395:                     ; either 'due' or 'duration' may appear in
1396:                     ; a 'todoprop', but 'due' and 'duration'
1397:                     ; MUST NOT occur in the same 'todoprop'
1398:                            due / duration /
1399:                     ; the following are optional,
1400:                     ; and MAY occur more than once
1401:                        attach / attendee / categories / comment / contact /
1402:                        exdate / exrule / rstatus / related / resources /
1403:                        rdate / rrule / x-prop                 )
1404:                     Description: A "VTODO" calendar component is a grouping of component
1405:                       properties and possibly "VALARM" calendar components that represent
1406:                       an action-item or assignment. For example, it can be used to
1407:                       represent an item of work assigned to an individual; such as "turn in
1408:                       travel expense today".    The "VTODO" calendar component cannot be nested within another
1409:                       calendar component. However, "VTODO" calendar components can be
1410:                       related to each other or to a "VTODO" or to a "VJOURNAL" calendar
1411:                       component with the "RELATED-TO" property.
1412:                     A "VTODO" calendar component without the "DTSTART" and "DUE" (or
1413:                        "DURATION") properties specifies a to-do that will be associated with
1414:                        each successive calendar date, until it is completed.
1415:                     Example: The following is an example of a "VTODO" calendar component:
1416:                     BEGIN:VTODO
1417:                     UID:19970901T130000Z-123404@host.com
1418:                     DTSTAMP:19970901T1300Z
1419:                     DTSTART:19970415T133000Z
1420:                     DUE:19970416T045959Z
1421:                     SUMMARY:1996 Income Tax Preparation
1422:                     CLASS:CONFIDENTIAL
1423:                     CATEGORIES:FAMILY,FINANCE
1424:                     PRIORITY:1
1425:                     STATUS:NEEDS-ACTION
1426:                     END:VTODO
1427:                     */
1428:                } else if (iCalLine.startsWith("END:VTODO")) {
1429:                    /*
1430:                     We will probably not do vtodos just yet..
1431:                     */
1432:                } else if (iCalLine.startsWith("BEGIN:VJOURNAL")) {
1433:                    /*
1434:                    Not implemented.
1435:                     */
1436:                } else if (iCalLine.startsWith("END:VJOURNAL")) {
1437:                    /*
1438:                    Not Implemented.
1439:                     */
1440:                } else if (iCalLine.startsWith("BEGIN:VFREEBUSY")) {
1441:                    /*
1442:                     *4.6.4 Free/Busy Component
1443:                     freebusyc  = "BEGIN" ":" "VFREEBUSY" CRLF
1444:                         fbprop
1445:                         "END" ":" "VFREEBUSY" CRLF
1446:                     fbprop     = *(
1447:                       ; the following are optional,
1448:                       ; but MUST NOT occur more than once
1449:                           contact / dtstart / dtend / duration / dtstamp /
1450:                           organizer / uid / url /
1451:                     ; the following are optional,
1452:                     ; and MAY occur more than once
1453:                     attendee / comment / freebusy / rstatus / x-prop
1454:                     )
1455:                     Description: A "VFREEBUSY" calendar component is a grouping of
1456:                      component properties that represents either a request for, a reply to
1457:                      a request for free or busy time information or a published set of
1458:                      busy time information.    When used to request free/busy time information, the "ATTENDEE"
1459:                      property specifies the calendar users whose free/busy time is being
1460:                      requested; the "ORGANIZER" property specifies the calendar user who
1461:                      is requesting the free/busy time; the "DTSTART" and "DTEND"
1462:                      properties specify the window of time for which the free/busy time is
1463:                      being requested; the "UID" and "DTSTAMP" properties are specified to
1464:                      assist in proper sequencing of multiple free/busy time requests.
1465:                      When used to reply to a request for free/busy time, the "ATTENDEE"
1466:                      property specifies the calendar user responding to the free/busy time
1467:                      request; the "ORGANIZER" property specifies the calendar user that
1468:                      originally requested the free/busy time; the "FREEBUSY" property
1469:                      specifies the free/busy time information (if it exists); and the
1470:                      "UID" and "DTSTAMP" properties are specified to assist in proper
1471:                      sequencing of multiple free/busy time replies.
1472:                      When used to publish busy time, the "ORGANIZER" property specifies
1473:                      the calendar user associated with the published busy time; the
1474:                      "DTSTART" and "DTEND" properties specify an inclusive time window
1475:                      that surrounds the busy time information; the "FREEBUSY" property
1476:                      specifies the published busy time information; and the "DTSTAMP"
1477:                      property specifies the date/time that ICalendar object was created.
1478:                      The "VFREEBUSY" calendar component cannot be nested within another
1479:                      calendar component. Multiple "VFREEBUSY" calendar components can be
1480:                      specified within an ICalendar object. This permits the grouping of
1481:                      Free/Busy information into logical collections, such as monthly
1482:                      groups of busy time information.
1483:                      The "VFREEBUSY" calendar component is intended for use in ICalendar
1484:                      object methods involving requests for free time, requests for busy
1485:                      time, requests for both free and busy, and the associated replies.
1486:                      Free/Busy information is represented with the "FREEBUSY" property.
1487:                      This property provides a terse representation of time periods. One or
1488:                      more "FREEBUSY" properties can be specified in the "VFREEBUSY"
1489:                      calendar component.
1490:                      When present in a "VFREEBUSY" calendar component, the "DTSTART" and
1491:                      "DTEND" properties SHOULD be specified prior to any "FREEBUSY"
1492:                      properties. In a free time request, these properties can be used in
1493:                      combination with the "DURATION" property to represent a request for a
1494:                      duration of free time within a specified window of time.
1495:                      The recurrence properties ("RRULE", "EXRULE", "RDATE", "EXDATE") are
1496:                      not permitted within a "VFREEBUSY" calendar component. Any recurring
1497:                      events are resolved into their individual busy time periods using the
1498:                      "FREEBUSY" property.
1499:                      Example: The following is an example of a "VFREEBUSY" calendar
1500:                      component used to request free or busy time information:
1501:                        BEGIN:VFREEBUSY
1502:                        ORGANIZER:MAILTO:jane_doe@host1.com
1503:                        ATTENDEE:MAILTO:john_public@host2.com
1504:                        DTSTART:19971015T050000Z
1505:                        DTEND:19971016T050000Z
1506:                        DTSTAMP:19970901T083000Z
1507:                        END:VFREEBUSY
1508:                      The following is an example of a "VFREEBUSY" calendar component used
1509:                      to reply to the request with busy time information:
1510:                        BEGIN:VFREEBUSY
1511:                        ORGANIZER:MAILTO:jane_doe@host1.com
1512:                        ATTENDEE:MAILTO:john_public@host2.com
1513:                        DTSTAMP:19970901T100000Z
1514:                        FREEBUSY;VALUE=PERIOD:19971015T050000Z/PT8H30M,
1515:                         19971015T160000Z/PT5H30M,19971015T223000Z/PT6H30M
1516:                        URL:http://host2.com/pub/busy/jpublic-01.ifb
1517:                        COMMENT:This ICalendar file contains busy time information for
1518:                         the next three months.
1519:                        END:VFREEBUSY
1520:                     The following is an example of a "VFREEBUSY" calendar component used
1521:                     to publish busy time information.
1522:                        BEGIN:VFREEBUSY
1523:                        ORGANIZER:jsmith@host.com
1524:                        DTSTART:19980313T141711Z
1525:                        DTEND:19980410T141711Z
1526:                        FREEBUSY:19980314T233000Z/19980315T003000Z
1527:                        FREEBUSY:19980316T153000Z/19980316T163000Z
1528:                        FREEBUSY:19980318T030000Z/19980318T040000Z
1529:                        URL:http://www.host.com/calendar/busytime/jsmith.ifb
1530:                        END:VFREEBUSY
1531:                     */
1532:
1533:                } else if (iCalLine.startsWith("END:VFREEBUSY")) {
1534:                    /*
1535:                    Not Implemented. We generate this!
1536:                     */
1537:                } else if (iCalLine.startsWith("BEGIN:VTIMEZONE")) {
1538:                    /*
1539:                    4.6.5 Time Zone Component
1540:
1541:                    Component Name: VTIMEZONE
1542:
1543:                    Purpose: Provide a grouping of component properties that defines a
1544:                    time zone.
1545:
1546:                    Formal Definition: A "VTIMEZONE" calendar component is defined by the
1547:                    following notation:
1548:
1549:                    timezonec  = "BEGIN" ":" "VTIMEZONE" CRLF
1550:
1551:                                 2*(
1552:
1553:                                 ; 'tzid' is required, but MUST NOT occur more
1554:                                 ; than once
1555:
1556:                               tzid /
1557:
1558:                                 ; 'last-mod' and 'tzurl' are optional,
1559:                               but MUST NOT occur more than once
1560:
1561:                               last-mod / tzurl /
1562:
1563:                                 ; one of 'standardc' or 'daylightc' MUST occur
1564:                               ..; and each MAY occur more than once.
1565:
1566:                               standardc / daylightc /
1567:
1568:                               ; the following is optional,
1569:                               ; and MAY occur more than once
1570:
1571:                                 x-prop
1572:
1573:                                 )
1574:
1575:                                 "END" ":" "VTIMEZONE" CRLF
1576:
1577:                    standardc  = "BEGIN" ":" "STANDARD" CRLF
1578:
1579:                                 tzprop
1580:
1581:                                 "END" ":" "STANDARD" CRLF
1582:
1583:                    daylightc  = "BEGIN" ":" "DAYLIGHT" CRLF
1584:
1585:                                 tzprop
1586:
1587:                                 "END" ":" "DAYLIGHT" CRLF
1588:
1589:                    tzprop     = 3*(
1590:
1591:                               ; the following are each REQUIRED,
1592:                               ; but MUST NOT occur more than once
1593:
1594:                               dtstart / tzoffsetto / tzoffsetfrom /
1595:
1596:                               ; the following are optional,
1597:                               ; and MAY occur more than once
1598:
1599:                               comment / rdate / rrule / tzname / x-prop
1600:
1601:                               )
1602:
1603:                    Description: A time zone is unambiguously defined by the set of time
1604:                    measurement rules determined by the governing body for a given
1605:                    geographic area. These rules describe at a minimum the base  offset
1606:                    from UTC for the time zone, often referred to as the Standard Time
1607:                    offset. Many locations adjust their Standard Time forward or backward
1608:                    by one hour, in order to accommodate seasonal changes in number of
1609:                    daylight hours, often referred to as Daylight  Saving Time. Some
1610:                    locations adjust their time by a fraction of an hour. Standard Time
1611:                    is also known as Winter Time. Daylight Saving Time is also known as
1612:                    Advanced Time, Summer Time, or Legal Time in certain countries. The
1613:                    following table shows the changes in time zone rules in effect for
1614:                    New York City starting from 1967. Each line represents a description
1615:                    or rule for a particular observance.
1616:
1617:                    Effective Observance Rule
1618:
1619:                    Date       (Date/Time)             Offset  Abbreviation
1620:
1621:                    1967-*     last Sun in Oct, 02:00  -0500   EST
1622:
1623:                    1967-1973  last Sun in Apr, 02:00  -0400   EDT
1624:
1625:                    1974-1974  Jan 6,  02:00           -0400   EDT
1626:
1627:                    1975-1975  Feb 23, 02:00           -0400   EDT
1628:
1629:                    1976-1986  last Sun in Apr, 02:00  -0400   EDT
1630:
1631:                    1987-*     first Sun in Apr, 02:00 -0400   EDT
1632:
1633:                       Note: The specification of a global time zone registry is not
1634:                       addressed by this document and is left for future study.
1635:                       However, implementers may find the Olson time zone database [TZ]
1636:                       a useful reference. It is an informal, public-domain collection
1637:                       of time zone information, which is currently being maintained by
1638:                       volunteer Internet participants, and is used in several
1639:                       operating systems. This database contains current and historical
1640:                       time zone information for a wide variety of locations around the
1641:                       globe; it provides a time zone identifier for every unique time
1642:                       zone rule set in actual use since 1970, with historical data
1643:                       going back to the introduction of standard time.
1644:
1645:                    Interoperability between two calendaring and scheduling applications,
1646:                    especially for recurring events, to-dos or journal entries, is
1647:                    dependent on the ability to capture and convey date and time
1648:                    information in an unambiguous format. The specification of current
1649:                    time zone information is integral to this behavior.
1650:
1651:                    If present, the "VTIMEZONE" calendar component defines the set of
1652:                    Standard Time and Daylight Saving Time observances (or rules) for a
1653:                    particular time zone for a given interval of time. The "VTIMEZONE"
1654:                    calendar component cannot be nested within other calendar components.
1655:                    Multiple "VTIMEZONE" calendar components can exist in an ICalendar
1656:                    object. In this situation, each "VTIMEZONE" MUST represent a unique
1657:                    time zone definition. This is necessary for some classes of events,
1658:                    such as airline flights, that start in one time zone and end in
1659:                    another.
1660:
1661:                    The "VTIMEZONE" calendar component MUST be present if the ICalendar
1662:                    object contains an RRULE that generates dates on both sides of a time
1663:                    zone shift (e.g. both in Standard Time and Daylight Saving Time)
1664:                    unless the ICalendar object intends to convey a floating time (See
1665:                    the section "4.1.10.11 Time" for proper interpretation of floating
1666:                    time). It can be present if the ICalendar object does not contain
1667:                    such a RRULE. In addition, if a RRULE is present, there MUST be valid
1668:                    time zone information for all recurrence instances.
1669:
1670:                    The "VTIMEZONE" calendar component MUST include the "TZID" property
1671:                    and at least one definition of a standard or daylight component. The
1672:                    standard or daylight component MUST include the "DTSTART",
1673:                    "TZOFFSETFROM" and "TZOFFSETTO" properties.
1674:
1675:                    An individual "VTIMEZONE" calendar component MUST be specified for
1676:                    each unique "TZID" parameter value specified in the ICalendar object.
1677:
1678:                    Each "VTIMEZONE" calendar component consists of a collection of one
1679:                    or more sub-components that describe the rule for a particular
1680:                    observance (either a Standard Time or a Daylight Saving Time
1681:                    observance). The "STANDARD" sub-component consists of a collection of
1682:                    properties that describe Standard Time. The "DAYLIGHT" sub-component
1683:                    consists of a collection of properties that describe Daylight Saving
1684:                    Time. In general this collection of properties consists of:
1685:
1686:                       - the first onset date-time for the observance
1687:
1688:                       - the last onset date-time for the observance, if a last onset
1689:                         is known.
1690:
1691:                       - the offset to be applied for the observance
1692:
1693:                       - a rule that describes the day and time when the observance
1694:                         takes effect
1695:
1696:                       - an optional name for the observance
1697:
1698:                    For a given time zone, there may be multiple unique definitions of
1699:                    the observances over a period of time. Each observance is described
1700:                    using either a "STANDARD" or "DAYLIGHT" sub-component. The collection
1701:                    of these sub-components is used to describe the time zone for a given
1702:                    period of time. The offset to apply at any given time is found by
1703:                    locating the observance that has the last onset date and time before
1704:                    the time in question, and using the offset value from that observance.
1705:
1706:                    The top-level properties in a "VTIMEZONE" calendar component are:
1707:
1708:                    The mandatory "TZID" property is a text value that uniquely
1709:                    identifies the VTIMZONE calendar component within the scope of an
1710:                    ICalendar object.
1711:
1712:                    The optional "LAST-MODIFIED" property is a UTC value that specifies
1713:                    the date and time that this time zone definition was last updated.
1714:
1715:                    The optional "TZURL" property is url value that points to a published
1716:                    VTIMEZONE definition. TZURL SHOULD refer to a resource that is
1717:                    accessible by anyone who might need to interpret the object. This
1718:                    SHOULD NOT normally be a file: URL or other URL that is not widely-
1719:                    accessible.
1720:
1721:                    The collection of properties that are used to define the STANDARD and
1722:                    DAYLIGHT sub-components include:
1723:
1724:                    The mandatory "DTSTART" property gives the effective onset date and
1725:                    local time for the time zone sub-component definition. "DTSTART" in
1726:                    this usage MUST be specified as a local DATE-TIME value.
1727:
1728:                    The mandatory "TZOFFSETFROM" property gives the UTC offset which is
1729:                    in use when the onset of this time zone observance begins.
1730:                    "TZOFFSETFROM" is combined with "DTSTART" to define the effective
1731:                    onset for the time zone sub-component definition. For example, the
1732:                    following represents the time at which the observance of Standard
1733:                    Time took effect in Fall 1967 for New York City:
1734:
1735:                    DTSTART:19671029T020000
1736:
1737:                    TZOFFSETFROM:-0400
1738:
1739:                    The mandatory "TZOFFSETTO " property gives the UTC offset for the
1740:                    time zone sub-component (Standard Time or Daylight Saving Time) when
1741:                    this observance is in use.
1742:
1743:                    The optional "TZNAME" property is the customary name for the time
1744:                    zone. It may be specified multiple times, to allow for specifying
1745:                    multiple language variants of the time zone names. This could be used
1746:                    for displaying dates.
1747:
1748:                    If specified, the onset for the observance defined by the time zone
1749:                    sub-component is defined by either the "RRULE" or "RDATE" property.
1750:                    If neither is specified, only one sub-component can be specified in
1751:                    the "VTIMEZONE" calendar component and it is assumed that the single
1752:                    observance specified is always in effect.
1753:
1754:                    The "RRULE" property defines the recurrence rule for the onset of the
1755:                    observance defined by this time zone sub-component. Some specific
1756:                    requirements for the usage of RRULE for this purpose include:
1757:
1758:                       - If observance is known to have an effective end date, the
1759:                       "UNTIL" recurrence rule parameter MUST be used to specify the
1760:                       last valid onset of this observance (i.e., the UNTIL date-time
1761:                       will be equal to the last instance generated by the recurrence
1762:                       pattern). It MUST be specified in UTC time.
1763:
1764:                       - The "DTSTART" and the "TZOFFSETTO" properties MUST be used
1765:                       when generating the onset date-time values (instances) from the
1766:                       RRULE.
1767:
1768:                    Alternatively, the "RDATE" property can be used to define the onset
1769:                    of the observance by giving the individual onset date and times.
1770:                    "RDATE" in this usage MUST be specified as a local DATE-TIME value in
1771:                    UTC time.
1772:
1773:                    The optional "COMMENT" property is also allowed for descriptive
1774:                    explanatory text.
1775:
1776:                    Example: The following are examples of the "VTIMEZONE" calendar
1777:                    component:
1778:
1779:                    This is an example showing time zone information for the Eastern
1780:                    United States using "RDATE" property. Note that this is only suitable
1781:                    for a recurring event that starts on or later than April 6, 1997 at
1782:                    03:00:00 EDT (i.e., the earliest effective transition date and time)
1783:                    and ends no later than April 7, 1998 02:00:00 EST (i.e., latest valid
1784:                    date and time for EST in this scenario). For example, this can be
1785:                    used for a recurring event that occurs every Friday, 8am-9:00 AM,
1786:                    starting June 1, 1997, ending December 31, 1997.
1787:
1788:                    BEGIN:VTIMEZONE
1789:                    TZID:US-Eastern
1790:                    LAST-MODIFIED:19870101T000000Z
1791:                    BEGIN:STANDARD
1792:                    DTSTART:19971026T020000
1793:                    RDATE:19971026T020000
1794:                    TZOFFSETFROM:-0400
1795:                    TZOFFSETTO:-0500
1796:                    TZNAME:EST
1797:                    END:STANDARD
1798:                    BEGIN:DAYLIGHT
1799:                    DTSTART:19971026T020000
1800:                    RDATE:19970406T020000
1801:                    TZOFFSETFROM:-0500
1802:                    TZOFFSETTO:-0400
1803:                    TZNAME:EDT
1804:                    END:DAYLIGHT
1805:                    END:VTIMEZONE
1806:
1807:                    This is a simple example showing the current time zone rules for the
1808:                    Eastern United States using a RRULE recurrence pattern. Note that
1809:                    there is no effective end date to either of the Standard Time or
1810:                    Daylight Time rules. This information would be valid for a recurring
1811:                    event starting today and continuing indefinitely.
1812:
1813:                    BEGIN:VTIMEZONE
1814:                    TZID:US-Eastern
1815:                    LAST-MODIFIED:19870101T000000Z
1816:                    TZURL:http://zones.stds_r_us.net/tz/US-Eastern
1817:                    BEGIN:STANDARD
1818:                    DTSTART:19671029T020000
1819:                    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
1820:                    TZOFFSETFROM:-0400
1821:                    TZOFFSETTO:-0500
1822:                    TZNAME:EST
1823:                    END:STANDARD
1824:                    BEGIN:DAYLIGHT
1825:                    DTSTART:19870405T020000
1826:                    RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
1827:                    TZOFFSETFROM:-0500
1828:                    TZOFFSETTO:-0400
1829:                    TZNAME:EDT
1830:                    END:DAYLIGHT
1831:                    END:VTIMEZONE
1832:
1833:                    This is an example showing a fictitious set of rules for the Eastern
1834:                    United States, where the Daylight Time rule has an effective end date
1835:                    (i.e., after that date, Daylight Time is no longer observed).
1836:
1837:                    BEGIN:VTIMEZONE
1838:                    TZID:US--Fictitious-Eastern
1839:                    LAST-MODIFIED:19870101T000000Z
1840:                    BEGIN:STANDARD
1841:                    DTSTART:19671029T020000
1842:                    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
1843:                    TZOFFSETFROM:-0400
1844:                    TZOFFSETTO:-0500
1845:                    TZNAME:EST
1846:                    END:STANDARD
1847:                    BEGIN:DAYLIGHT
1848:                    DTSTART:19870405T020000
1849:                    RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
1850:                    TZOFFSETFROM:-0500
1851:                    TZOFFSETTO:-0400
1852:                    TZNAME:EDT
1853:                    END:DAYLIGHT
1854:                    END:VTIMEZONE
1855:
1856:                    This is an example showing a fictitious set of rules for the Eastern
1857:                    United States, where the first Daylight Time rule has an effective
1858:                    end date. There is a second Daylight Time rule that picks up where
1859:                    the other left off.
1860:
1861:                    BEGIN:VTIMEZONE
1862:                    TZID:US--Fictitious-Eastern
1863:                    LAST-MODIFIED:19870101T000000Z
1864:                    BEGIN:STANDARD
1865:                    DTSTART:19671029T020000
1866:                    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
1867:                    TZOFFSETFROM:-0400
1868:                    TZOFFSETTO:-0500
1869:                    TZNAME:EST
1870:                    END:STANDARD
1871:                    BEGIN:DAYLIGHT
1872:                    DTSTART:19870405T020000
1873:                    RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
1874:                    TZOFFSETFROM:-0500
1875:                    TZOFFSETTO:-0400
1876:                    TZNAME:EDT
1877:                    END:DAYLIGHT
1878:                    BEGIN:DAYLIGHT
1879:                    DTSTART:19990424T020000
1880:                    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=4
1881:                    TZOFFSETFROM:-0500
1882:                    TZOFFSETTO:-0400
1883:                    TZNAME:EDT
1884:                    END:DAYLIGHT
1885:                    END:VTIMEZONE
1886:
1887:                     */
1888:                    icalTimeZone = new ICalendarTimeZone();
1889:                    icalTimeZoneParser = true;
1890:                } else if (iCalLine.startsWith("END:VTIMEZONE")) {
1891:                    icalTimeZoneParser = false;
1892:                    if (icalTimeZone == null) {
1893:                    } else {
1894:                        ical.icaltimeZoneCollection.add(icalTimeZone);
1895:                    }
1896:                } else if (iCalLine.startsWith("BEGIN:VALARM")) {
1897:                    /*
1898:                    4.6.6 Alarm Component
1899:
1900:                      Component Name: VALARM
1901:
1902:                      Purpose: Provide a grouping of component properties that define an
1903:                      alarm.
1904:                      Formal Definition: A "VALARM" calendar component is defined by the
1905:                      following notation:
1906:
1907:                             alarmc     = "BEGIN" ":" "VALARM" CRLF
1908:                                          (audioprop / dispprop / emailprop / procprop)
1909:                                          "END" ":" "VALARM" CRLF
1910:
1911:                        audioprop  = 2*(
1912:
1913:                                   ; 'action' and 'trigger' are both REQUIRED,
1914:                                   ; but MUST NOT occur more than once
1915:
1916:                                   action / trigger /
1917:
1918:                                   ; 'duration' and 'repeat' are both optional,
1919:                                   ; and MUST NOT occur more than once each,
1920:                                   ; but if one occurs, so MUST the other
1921:
1922:                                   duration / repeat /
1923:
1924:                                   ; the following is optional,
1925:                                   ; but MUST NOT occur more than once
1926:
1927:                                   attach /
1928:
1929:                                   ; the following is optional,
1930:                                   ; and MAY occur more than once
1931:
1932:                                   x-prop
1933:
1934:                                   )
1935:
1936:
1937:
1938:                        dispprop   = 3*(
1939:
1940:                                   ; the following are all REQUIRED,
1941:                                   ; but MUST NOT occur more than once
1942:
1943:                                   action / description / trigger /
1944:
1945:                                   ; 'duration' and 'repeat' are both optional,
1946:                                   ; and MUST NOT occur more than once each,
1947:                                   ; but if one occurs, so MUST the other
1948:
1949:                                   duration / repeat /
1950:
1951:                                   ; the following is optional,
1952:                                   ; and MAY occur more than once
1953:
1954:                     *x-prop
1955:
1956:                                   )
1957:
1958:
1959:
1960:                        emailprop  = 5*(
1961:
1962:                                   ; the following are all REQUIRED,
1963:                                   ; but MUST NOT occur more than once
1964:
1965:                                   action / description / trigger / summary
1966:
1967:                                   ; the following is REQUIRED,
1968:                                   ; and MAY occur more than once
1969:
1970:                                   attendee /
1971:
1972:                                   ; 'duration' and 'repeat' are both optional,
1973:                                   ; and MUST NOT occur more than once each,
1974:                                   ; but if one occurs, so MUST the other
1975:
1976:                                   duration / repeat /
1977:
1978:                                   ; the following are optional,
1979:                                   ; and MAY occur more than once
1980:
1981:                                   attach / x-prop
1982:
1983:                                   )
1984:
1985:
1986:
1987:                        procprop   = 3*(
1988:
1989:                                   ; the following are all REQUIRED,
1990:                                   ; but MUST NOT occur more than once
1991:
1992:                                   action / attach / trigger /
1993:
1994:                                   ; 'duration' and 'repeat' are both optional,
1995:                                   ; and MUST NOT occur more than once each,
1996:                                   ; but if one occurs, so MUST the other
1997:
1998:                                   duration / repeat /
1999:
2000:                                   ; 'description' is optional,
2001:                                   ; and MUST NOT occur more than once
2002:
2003:                                   description /
2004:
2005:                                   ; the following is optional,
2006:                                   ; and MAY occur more than once
2007:
2008:                                   x-prop
2009:
2010:                                   )
2011:
2012:                      Description: A "VALARM" calendar component is a grouping of component
2013:                      properties that is a reminder or alarm for an event or a to-do. For
2014:                      example, it may be used to define a reminder for a pending event or
2015:                      an overdue to-do.
2016:
2017:                      The "VALARM" calendar component MUST include the "ACTION" and
2018:                      "TRIGGER" properties. The "ACTION" property further constrains the
2019:                      "VALARM" calendar component in the following ways:
2020:
2021:                      When the action is "AUDIO", the alarm can also include one and only
2022:                      one "ATTACH" property, which MUST point to a sound resource, which is
2023:                      rendered when the alarm is triggered.
2024:
2025:                      When the action is "DISPLAY", the alarm MUST also include a
2026:                      "DESCRIPTION" property, which contains the text to be displayed when
2027:                      the alarm is triggered.
2028:
2029:                      When the action is "EMAIL", the alarm MUST include a "DESCRIPTION"
2030:                      property, which contains the text to be used as the message body, a
2031:                      "SUMMARY" property, which contains the text to be used as the message
2032:                      subject, and one or more "ATTENDEE" properties, which contain the
2033:                      email address of attendees to receive the message. It can also
2034:                      include one or more "ATTACH" properties, which are intended to be
2035:                      sent as message attachments. When the alarm is triggered, the email
2036:                      message is sent.
2037:
2038:                      When the action is "PROCEDURE", the alarm MUST include one and only
2039:                      one "ATTACH" property, which MUST point to a procedure resource,
2040:                      which is invoked when the alarm is triggered.
2041:
2042:                      The "VALARM" calendar component MUST only appear within either a
2043:                      "VEVENT" or "VTODO" calendar component. "VALARM" calendar components
2044:                      cannot be nested. Multiple mutually independent "VALARM" calendar
2045:                      components can be specified for a single "VEVENT" or "VTODO" calendar
2046:                      component.
2047:
2048:                      The "TRIGGER" property specifies when the alarm will be triggered.
2049:                      The "TRIGGER" property specifies a duration prior to the start of an
2050:                      event or a to-do. The "TRIGGER" edge may be explicitly set to be
2051:                      relative to the "START" or "END" of the event or to-do with the
2052:                      "RELATED" parameter of the "TRIGGER" property. The "TRIGGER" property
2053:                      value type can alternatively be set to an absolute calendar date and
2054:                      time of day value.
2055:
2056:                      In an alarm set to trigger on the "START" of an event or to-do, the
2057:                      "DTSTART" property MUST be present in the associated event or to-do.
2058:                      In an alarm in a "VEVENT" calendar component set to trigger on the
2059:                      "END" of the event, either the "DTEND" property MUST be present, or
2060:                      the "DTSTART" and "DURATION" properties MUST both be present. In an
2061:                      alarm in a "VTODO" calendar component set to trigger on the "END" of
2062:                      the to-do, either the "DUE" property MUST be present, or the
2063:                      "DTSTART" and "DURATION" properties MUST both be present.
2064:
2065:                      The alarm can be defined such that it triggers repeatedly. A
2066:                      definition of an alarm with a repeating trigger MUST include both the
2067:                      "DURATION" and "REPEAT" properties. The "DURATION" property specifies
2068:                      the delay period, after which the alarm will repeat. The "REPEAT"
2069:                      property specifies the number of additional repetitions that the
2070:                      alarm will triggered. This repitition count is in addition to the
2071:                      initial triggering of the alarm. Both of these properties MUST be
2072:                      present in order to specify a repeating alarm. If one of these two
2073:                      properties is absent, then the alarm will not repeat beyond the
2074:                      initial trigger.
2075:
2076:                      The "ACTION" property is used within the "VALARM" calendar component
2077:                      to specify the type of action invoked when the alarm is triggered.
2078:                      The "VALARM" properties provide enough information for a specific
2079:                      action to be invoked. It is typically the responsibility of a
2080:                      "Calendar User Agent" (CUA) to deliver the alarm in the specified
2081:                      fashion. An "ACTION" property value of AUDIO specifies an alarm that
2082:                      causes a sound to be played to alert the user; DISPLAY specifies an
2083:                      alarm that causes a text message to be displayed to the user; EMAIL
2084:                      specifies an alarm that causes an electronic email message to be
2085:                      delivered to one or more email addresses; and PROCEDURE specifies an
2086:                      alarm that causes a procedure to be executed. The "ACTION" property
2087:                      MUST specify one and only one of these values.
2088:
2089:                      In an AUDIO alarm, if the optional "ATTACH" property is included, it
2090:                      MUST specify an audio sound resource. The intention is that the sound
2091:                      will be played as the alarm effect. If an "ATTACH" property is
2092:                      specified that does not refer to a sound resource, or if the
2093:                      specified sound resource cannot be rendered (because its format is
2094:                      unsupported, or because it cannot be retrieved), then the CUA or
2095:                      other entity responsible for playing the sound may choose a fallback
2096:                      action, such as playing a built-in default sound, or playing no sound
2097:                      at all.
2098:
2099:                      In a DISPLAY alarm, the intended alarm effect is for the text value
2100:                      of the "DESCRIPTION" property to be displayed to the user.
2101:
2102:                      In an EMAIL alarm, the intended alarm effect is for an email message
2103:                      to be composed and delivered to all the addresses specified by the
2104:                      "ATTENDEE" properties in the "VALARM" calendar component. The
2105:                      "DESCRIPTION" property of the "VALARM" calendar component MUST be
2106:                      used as the body text of the message, and the "SUMMARY" property MUST
2107:                      be used as the subject text. Any "ATTACH" properties in the "VALARM"
2108:                      calendar component SHOULD be sent as attachments to the message.
2109:
2110:                      In a PROCEDURE alarm, the "ATTACH" property in the "VALARM" calendar
2111:                      component MUST specify a procedure or program that is intended to be
2112:                      invoked as the alarm effect. If the procedure or program is in a
2113:                      format that cannot be rendered, then no procedure alarm will be
2114:                      invoked. If the "DESCRIPTION" property is present, its value
2115:                      specifies the argument string to be passed to the procedure or
2116:                      program. "Calendar User Agents" that receive an ICalendar object with
2117:                      this category of alarm, can disable or allow the "Calendar User" to
2118:                      disable, or otherwise ignore this type of alarm. While a very useful
2119:                      alarm capability, the PROCEDURE type of alarm SHOULD be treated by
2120:                      the "Calendar User Agent" as a potential security risk.
2121:
2122:                      Example: The following example is for a "VALARM" calendar component
2123:                      that specifies an audio alarm that will sound at a precise time and
2124:                      repeat 4 more times at 15 minute intervals:
2125:
2126:                        BEGIN:VALARM
2127:                        TRIGGER;VALUE=DATE-TIME:19970317T133000Z
2128:                        REPEAT:4
2129:                        DURATION:PT15M
2130:                        ACTION:AUDIO
2131:                        ATTACH;FMTTYPE=audio/basic:ftp://host.com/pub/sounds/bell-01.aud
2132:                        END:VALARM
2133:
2134:                      The following example is for a "VALARM" calendar component that
2135:                      specifies a display alarm that will trigger 30 minutes before the
2136:                      scheduled start of the event or the due date/time of the to-do it is
2137:                      associated with and will repeat 2 more times at 15 minute intervals:
2138:
2139:                        BEGIN:VALARM
2140:                        TRIGGER:-PT30M
2141:                        REPEAT:2
2142:                        DURATION:PT15M
2143:                        ACTION:DISPLAY
2144:                        DESCRIPTION:Breakfast meeting with executive\n
2145:                         team at 8:30 AM EST.
2146:                        END:VALARM
2147:
2148:                      The following example is for a "VALARM" calendar component that
2149:                      specifies an email alarm that will trigger 2 days before the
2150:                      scheduled due date/time of a to-do it is associated with. It does not
2151:                      repeat. The email has a subject, body and attachment link.
2152:
2153:                        BEGIN:VALARM
2154:                        TRIGGER:-P2D
2155:                        ACTION:EMAIL
2156:                        ATTENDEE:MAILTO:john_doe@host.com
2157:                        SUMMARY:*** REMINDER: SEND AGENDA FOR WEEKLY STAFF MEETING ***
2158:                        DESCRIPTION:A draft agenda needs to be sent out to the attendees
2159:                          to the weekly managers meeting (MGR-LIST). Attached is a
2160:                          pointer the document template for the agenda file.
2161:                        ATTACH;FMTTYPE=application/binary:http://host.com/templates/agen
2162:                         da.doc
2163:                        END:VALARM
2164:
2165:                      The following example is for a "VALARM" calendar component that
2166:                      specifies a procedural alarm that will trigger at a precise date/time
2167:                      and will repeat 23 more times at one hour intervals. The alarm will
2168:                      invoke a procedure file.
2169:
2170:                        BEGIN:VALARM
2171:                        TRIGGER;VALUE=DATE-TIME:19980101T050000Z
2172:                        REPEAT:23
2173:                        DURATION:PT1H
2174:                        ACTION:PROCEDURE
2175:                        ATTACH;FMTTYPE=application/binary:ftp://host.com/novo-
2176:                         procs/felizano.exe
2177:                        END:VALARM
2178:
2179:                     */
2180:                } else if (iCalLine.startsWith("TRANSP:")) {
2181:                    /*
2182:                    4.8.2.7 Time Transparency
2183:
2184:                      Property Name: TRANSP
2185:
2186:                      Purpose: This property defines whether an event is transparent or not
2187:                      to busy time searches.
2188:
2189:                      Value Type: TEXT
2190:
2191:                      Property Parameters: Non-standard property parameters can be
2192:                      specified on this property.
2193:
2194:                      Conformance: This property can be specified once in a "VEVENT"
2195:                      calendar component.
2196:
2197:                      Description: Time Transparency is the characteristic of an event that
2198:                      determines whether it appears to consume time on a calendar. Events
2199:                      that consume actual time for the individual or resource associated
2200:
2201:                      with the calendar SHOULD be recorded as OPAQUE, allowing them to be
2202:                      detected by free-busy time searches. Other events, which do not take
2203:                      up the individual's (or resource's) time SHOULD be recorded as
2204:                      TRANSPARENT, making them invisible to free-busy time searches.
2205:
2206:                      Format Definition: The property is specified by the following
2207:                      notation:
2208:
2209:                        transp     = "TRANSP" tranparam ":" transvalue CRLF
2210:
2211:                        tranparam  = *(";" xparam)
2212:
2213:                        transvalue = "OPAQUE"      ;Blocks or opaque on busy time searches.
2214:                                   / "TRANSPARENT" ;Transparent on busy time searches.
2215:                           ;Default value is OPAQUE
2216:
2217:                      Example: The following is an example of this property for an event
2218:                      that is transparent or does not block on free/busy time searches:
2219:
2220:                        TRANSP:TRANSPARENT
2221:
2222:                      The following is an example of this property for an event that is
2223:                      opaque or blocks on free/busy time searches:
2224:
2225:                        TRANSP:OPAQUE
2226:
2227:                     */
2228:                    if (icalEventParser) {
2229:                        iCalEvent.setTransparency(extractAttribute(iCalLine,
2230:                                "TRANSP"));
2231:                    }
2232:                } else if (iCalLine.startsWith("TZID")) {
2233:                    /*
2234:                    4.8.3 Time Zone Component Properties
2235:
2236:                      The following properties specify time zone information in calendar
2237:                      components.
2238:
2239:                    4.8.3.1 Time Zone Identifier
2240:
2241:                      Property Name: TZID
2242:
2243:                      Purpose: This property specifies the text value that uniquely
2244:                      identifies the "VTIMEZONE" calendar component.
2245:
2246:                      Value Type: TEXT
2247:
2248:                      Property Parameters: Non-standard property parameters can be
2249:                      specified on this property.
2250:
2251:                      Conformance: This property MUST be specified in a "VTIMEZONE"
2252:                      calendar component.
2253:
2254:                      Description:
2255:                      This is the label by which a time zone calendar
2256:                      component is referenced by any ICalendar properties whose data type
2257:                      is either DATE-TIME or TIME and not intended to specify a UTC or a
2258:                      "floating" time. The presence of the SOLIDUS character (US-ASCII
2259:                      decimal 47) as a prefix, indicates that this TZID represents an
2260:                      unique ID in a globally defined time zone registry (when such
2261:                      registry is defined).
2262:
2263:                           Note: This document does not define a naming convention for time
2264:                           zone identifiers. Implementers may want to use the naming
2265:                           conventions defined in existing time zone specifications such as
2266:                           the public-domain Olson database [TZ]. The specification of
2267:                           globally unique time zone identifiers is not addressed by this
2268:                           document and is left for future study.
2269:
2270:                      Format Definition: This property is defined by the following
2271:                      notation:
2272:
2273:                        tzid       = "TZID" tzidpropparam ":" [tzidprefix] text CRLF
2274:
2275:                        tzidpropparam      = *(";" xparam)
2276:
2277:                        ;tzidprefix        = "/"
2278:                        ; Defined previously. Just listed here for reader convenience.
2279:
2280:                      Example: The following are examples of non-globally unique time zone
2281:                      identifiers:
2282:
2283:                        TZID:US-Eastern
2284:
2285:                        TZID:California-Los_Angeles
2286:
2287:                      The following is an example of a fictitious globally unique time zone
2288:                      identifier:
2289:
2290:                        TZID:/US-New_York-New_York
2291:
2292:                     */
2293:                    if (icalTimeZoneParser) {
2294:                        icalTimeZone
2295:                                .setTzID(extractAttribute(iCalLine, "TZID"));
2296:                    }
2297:                } else if (iCalLine.startsWith("BEGIN:STANDARD")) {
2298:                    // Time Zone Standard
2299:                    timeZoneType = "STANDARD";
2300:                } else if (iCalLine.startsWith("BEGIN:DAYLIGHT")) {
2301:                    // Time Zone Daylight
2302:                    timeZoneType = "DAYLIGHT";
2303:                } else if (iCalLine.startsWith("TZNAME")) {
2304:                    /*
2305:                    4.8.3.2 Time Zone Name
2306:
2307:                      Property Name: TZNAME
2308:
2309:                      Purpose: This property specifies the customary designation for a time
2310:                      zone description.
2311:
2312:                      Value Type: TEXT
2313:
2314:                      Property Parameters: Non-standard and language property parameters
2315:                      can be specified on this property.
2316:
2317:                      Conformance: This property can be specified in a "VTIMEZONE" calendar
2318:                      component.
2319:
2320:                      Description: This property may be specified in multiple languages; in
2321:                      order to provide for different language requirements.
2322:
2323:                      Format Definition: This property is defined by the following
2324:                      notation:
2325:
2326:                        tzname     = "TZNAME" tznparam ":" text CRLF
2327:
2328:                        tznparam   = *(
2329:
2330:                                   ; the following is optional,
2331:                                   ; but MUST NOT occur more than once
2332:
2333:                                   (";" languageparam) /
2334:
2335:                                   ; the following is optional,
2336:                                   ; and MAY occur more than once
2337:
2338:                                   (";" xparam)
2339:
2340:                                   )
2341:
2342:                      Example: The following are example of this property:
2343:
2344:                        TZNAME:EST
2345:
2346:                      The following is an example of this property when two different
2347:                      languages for the time zone name are specified:
2348:
2349:                        TZNAME;LANGUAGE=en:EST
2350:                        TZNAME;LANGUAGE=fr-CA:HNE
2351:
2352:                     */
2353:                    if (icalTimeZoneParser) {
2354:                        if (timeZoneType.equalsIgnoreCase("STANDARD")) {
2355:                            icalTimeZone.setstandardTzName(extractAttribute(
2356:                                    iCalLine, "TZNAME"));
2357:                        } else {
2358:                            icalTimeZone.setdaylightTzName(extractAttribute(
2359:                                    iCalLine, "TZNAME"));
2360:                        }
2361:                    }
2362:                } else if (iCalLine.startsWith("TZOFFSETFROM")) {
2363:                    /*
2364:                    4.8.3.3 Time Zone Offset From
2365:
2366:                      Property Name: TZOFFSETFROM
2367:
2368:                      Purpose: This property specifies the offset which is in use prior to
2369:                      this time zone observance.
2370:
2371:                      Value Type: UTC-OFFSET
2372:
2373:                      Property Parameters: Non-standard property parameters can be
2374:                      specified on this property.
2375:
2376:                      Conformance: This property MUST be specified in a "VTIMEZONE"
2377:                      calendar component.
2378:
2379:                      Description: This property specifies the offset which is in use prior
2380:                      to this time observance. It is used to calculate the absolute time at
2381:                      which the transition to a given observance takes place. This property
2382:                      MUST only be specified in a "VTIMEZONE" calendar component. A
2383:                      "VTIMEZONE" calendar component MUST include this property. The
2384:                      property value is a signed numeric indicating the number of hours and
2385:                      possibly minutes from UTC. Positive numbers represent time zones east
2386:                      of the prime meridian, or ahead of UTC. Negative numbers represent
2387:                      time zones west of the prime meridian, or behind UTC.
2388:
2389:                      Format Definition: The property is defined by the following notation:
2390:
2391:                        tzoffsetfrom       = "TZOFFSETFROM" frmparam ":" utc-offset
2392:                                             CRLF
2393:
2394:                        frmparam   = *(";" xparam)
2395:
2396:                      Example: The following are examples of this property:
2397:
2398:                        TZOFFSETFROM:-0500
2399:
2400:                        TZOFFSETFROM:+1345
2401:
2402:                     */
2403:                    if (icalTimeZoneParser) {
2404:                        String offSetVal = iCalLine.substring("TZOFFSETFROM:"
2405:                                .length());
2406:                        if (offSetVal.startsWith("+")) {
2407:                            offSetVal = offSetVal.substring(1);
2408:                        }
2409:                        if (timeZoneType.equalsIgnoreCase("STANDARD")) {
2410:                            icalTimeZone
2411:                                    .setstandardTzOffsetFrom(java.lang.Integer
2412:                                            .parseInt(offSetVal));
2413:                        } else {
2414:                            icalTimeZone
2415:                                    .setdaylightTzOffsetFrom(java.lang.Integer
2416:                                            .parseInt(offSetVal));
2417:                        }
2418:                    }
2419:                } else if (iCalLine.startsWith("TZOFFSETTO")) {
2420:                    /*
2421:                    4.8.3.4 Time Zone Offset To
2422:
2423:                      Property Name: TZOFFSETTO
2424:
2425:                      Purpose: This property specifies the offset which is in use in this
2426:                      time zone observance.
2427:
2428:                      Value Type: UTC-OFFSET
2429:
2430:                      Property Parameters: Non-standard property parameters can be
2431:                      specified on this property.
2432:
2433:                      Conformance: This property MUST be specified in a "VTIMEZONE"
2434:                      calendar component.
2435:
2436:                      Description: This property specifies the offset which is in use in
2437:                      this time zone observance. It is used to calculate the absolute time
2438:                      for the new observance. The property value is a signed numeric
2439:                      indicating the number of hours and possibly minutes from UTC.
2440:                      Positive numbers represent time zones east of the prime meridian, or
2441:                      ahead of UTC. Negative numbers represent time zones west of the prime
2442:                      meridian, or behind UTC.
2443:
2444:                      Format Definition: The property is defined by the following notation:
2445:
2446:                        tzoffsetto = "TZOFFSETTO" toparam ":" utc-offset CRLF
2447:
2448:                        toparam    = *(";" xparam)
2449:
2450:                      Example: The following are examples of this property:
2451:
2452:                        TZOFFSETTO:-0400
2453:
2454:                        TZOFFSETTO:+1245
2455:
2456:                     */
2457:                } else if (iCalLine.startsWith("TZURL")) {
2458:                    /*
2459:                    4.8.3.5 Time Zone URL
2460:
2461:                      Property Name: TZURL
2462:
2463:                      Purpose: The TZURL provides a means for a VTIMEZONE component to
2464:                      point to a network location that can be used to retrieve an up-to-
2465:                      date version of itself.
2466:
2467:                      Value Type: URI
2468:
2469:                      Property Parameters: Non-standard property parameters can be
2470:                      specified on this property.
2471:
2472:                      Conformance: This property can be specified in a "VTIMEZONE" calendar
2473:                      component.
2474:
2475:                      Description: The TZURL provides a means for a VTIMEZONE component to
2476:                      point to a network location that can be used to retrieve an up-to-
2477:                      date version of itself. This provides a hook to handle changes
2478:                      government bodies impose upon time zone definitions. Retrieval of
2479:                      this resource results in an ICalendar object containing a single
2480:                      VTIMEZONE component and a METHOD property set to PUBLISH.
2481:
2482:                      Format Definition: The property is defined by the following notation:
2483:
2484:                        tzurl      = "TZURL" tzurlparam ":" uri CRLF
2485:
2486:                        tzurlparam = *(";" xparam)
2487:
2488:                      Example: The following is an example of this property:
2489:
2490:                        TZURL:http://timezones.r.us.net/tz/US-California-Los_Angeles
2491:
2492:                     */
2493:                } else if (iCalLine.startsWith("ATTENDEE")) {
2494:                    /*
2495:                       4.8.4 Relationship Component Properties
2496:
2497:                          The following properties specify relationship information in calendar
2498:                          components.
2499:
2500:                       4.8.4.1 Attendee
2501:
2502:                          Property Name: ATTENDEE
2503:
2504:                          Purpose: The property defines an "Attendee" within a calendar
2505:                          component.
2506:
2507:                          Value Type: CAL-ADDRESS
2508:
2509:                          Property Parameters: Non-standard, language, calendar user type,
2510:                          group or list membership, participation role, participation status,
2511:                          RSVP expectation, delegatee, delegator, sent by, common name or
2512:                          directory entry reference property parameters can be specified on
2513:                          this property.
2514:
2515:                          Conformance: This property MUST be specified in an ICalendar object
2516:                          that specifies a group scheduled calendar entity. This property MUST
2517:                          NOT be specified in an ICalendar object when publishing the calendar
2518:                          information (e.g., NOT in an ICalendar object that specifies the
2519:                          publication of a calendar user's busy time, event, to-do or journal).
2520:                          This property is not specified in an ICalendar object that specifies
2521:                          only a time zone definition or that defines calendar entities that
2522:                          are not group scheduled entities, but are entities only on a single
2523:                          user's calendar.
2524:
2525:                          Description: The property MUST only be specified within calendar
2526:                          components to specify participants, non-participants and the chair of
2527:                          a group scheduled calendar entity. The property is specified within
2528:                          an "EMAIL" category of the "VALARM" calendar component to specify an
2529:                          email address that is to receive the email type of ICalendar alarm.
2530:
2531:                          The property parameter CN is for the common or displayable name
2532:                          associated with the calendar address; ROLE, for the intended role
2533:                          that the attendee will have in the calendar component; PARTSTAT, for
2534:                          the status of the attendee's participation; RSVP, for indicating
2535:                          whether the favor of a reply is requested; CUTYPE, to indicate the
2536:                          type of calendar user; MEMBER, to indicate the groups that the
2537:                          attendee belongs to; DELEGATED-TO, to indicate the calendar users
2538:                          that the original request was delegated to; and DELEGATED-FROM, to
2539:                          indicate whom the request was delegated from; SENT-BY, to indicate
2540:                          whom is acting on behalf of the ATTENDEE; and DIR, to indicate the
2541:                          URI that points to the directory information corresponding to the
2542:                          attendee. These property parameters can be specified on an "ATTENDEE"
2543:                          property in either a "VEVENT", "VTODO" or "VJOURNAL" calendar
2544:                          component. They MUST not be specified in an "ATTENDEE" property in a
2545:                          "VFREEBUSY" or "VALARM" calendar component. If the LANGUAGE property
2546:                          parameter is specified, the identified language applies to the CN
2547:                          parameter.
2548:
2549:                          A recipient delegated a request MUST inherit the RSVP and ROLE values
2550:                          from the attendee that delegated the request to them.
2551:
2552:                          Multiple attendees can be specified by including multiple "ATTENDEE"
2553:                          properties within the calendar component.
2554:
2555:                          Format Definition: The property is defined by the following notation:
2556:
2557:                            attendee   = "ATTENDEE" attparam ":" cal-address CRLF
2558:
2559:                            attparam   = *(
2560:
2561:                                       ; the following are optional,
2562:                                       ; but MUST NOT occur more than once
2563:
2564:                                       (";" cutypeparam) / (";"memberparam) /
2565:                                       (";" roleparam) / (";" partstatparam) /
2566:                                       (";" rsvpparam) / (";" deltoparam) /
2567:                                       (";" delfromparam) / (";" sentbyparam) /
2568:                                       (";"cnparam) / (";" dirparam) /
2569:                                       (";" languageparam) /
2570:
2571:                                       ; the following is optional,
2572:                                       ; and MAY occur more than once
2573:
2574:                                       (";" xparam)
2575:
2576:                                       )
2577:
2578:                          Example: The following are examples of this property's use for a to-
2579:                          do:
2580:
2581:                            ORGANIZER:MAILTO:jsmith@host1.com
2582:                            ATTENDEE;MEMBER="MAILTO:DEV-GROUP@host2.com":
2583:                             MAILTO:joecool@host2.com
2584:                            ATTENDEE;DELEGATED-FROM="MAILTO:immud@host3.com":
2585:                             MAILTO:ildoit@host1.com
2586:
2587:                          The following is an example of this property used for specifying
2588:                          multiple attendees to an event:
2589:
2590:                            ORGANIZER:MAILTO:jsmith@host1.com
2591:                            ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=Henry Cabot
2592:                             :MAILTO:hcabot@host2.com
2593:                            ATTENDEE;ROLE=REQ-PARTICIPANT;DELEGATED-FROM="MAILTO:bob@host.com"
2594:                             ;PARTSTAT=ACCEPTED;CN=Jane Doe:MAILTO:jdoe@host1.com
2595:
2596:                          The following is an example of this property with a URI to the
2597:                          directory information associated with the attendee:
2598:
2599:                            ATTENDEE;CN=John Smith;DIR="ldap://host.com:6666/o=eDABC%
2600:                             20Industries,c=3DUS??(cn=3DBJim%20Dolittle)":MAILTO:jimdo@
2601:                             host1.com
2602:
2603:                          The following is an example of this property with "delegatee" and
2604:                          "delegator" information for an event:
2605:
2606:                            ORGANIZER;CN=John Smith:MAILTO:jsmith@host.com
2607:                            ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;DELEGATED-FROM=
2608:                             "MAILTO:iamboss@host2.com";CN=Henry Cabot:MAILTO:hcabot@
2609:                             host2.com
2610:                            ATTENDEE;ROLE=NON-PARTICIPANT;PARTSTAT=DELEGATED;DELEGATED-TO=
2611:                             "MAILTO:hcabot@host2.com";CN=The Big Cheese:MAILTO:iamboss
2612:                             @host2.com
2613:                            ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Jane Doe
2614:                             :MAILTO:jdoe@host1.com
2615:
2616:                          Example: The following is an example of this property's use when
2617:                          another calendar user is acting on behalf of the "Attendee":
2618:
2619:                            ATTENDEE;SENT-BY=MAILTO:jan_doe@host1.com;CN=John Smith:MAILTO:
2620:                             jsmith@host1.com
2621:                     */
2622:                    // This should be implemented as a collection under the VEVENT. Some other time
2623:                } else if (iCalLine.startsWith("CONTACT")) {
2624:                    /*
2625:                    4.8.4.2 Contact
2626:
2627:                      Property Name: CONTACT
2628:
2629:                      Purpose: The property is used to represent contact information or
2630:                      alternately a reference to contact information associated with the
2631:                      calendar component.
2632:
2633:                      Value Type: TEXT
2634:
2635:                      Property Parameters: Non-standard, alternate text representation and
2636:                      language property parameters can be specified on this property.
2637:
2638:                      Conformance: The property can be specified in a "VEVENT", "VTODO",
2639:                      "VJOURNAL" or "VFREEBUSY" calendar component.
2640:
2641:                      Description: The property value consists of textual contact
2642:                      information. An alternative representation for the property value can
2643:                      also be specified that refers to a URI pointing to an alternate form,
2644:                      such as a vCard [RFC 2426], for the contact information.
2645:
2646:                      Format Definition: The property is defined by the following notation:
2647:
2648:                        contact    = "CONTACT" contparam ":" text CRLF
2649:
2650:                        contparam  = *(
2651:                                   ; the following are optional,
2652:                                   ; but MUST NOT occur more than once
2653:
2654:                                   (";" altrepparam) / (";" languageparam) /
2655:
2656:                                   ; the following is optional,
2657:                                   ; and MAY occur more than once
2658:
2659:                                   (";" xparam)
2660:
2661:                                   )
2662:
2663:                      Example: The following is an example of this property referencing
2664:                      textual contact information:
2665:
2666:                        CONTACT:Jim Dolittle\, ABC Industries\, +1-919-555-1234
2667:
2668:                      The following is an example of this property with an alternate
2669:                      representation of a LDAP URI to a directory entry containing the
2670:                      contact information:
2671:
2672:                        CONTACT;ALTREP="ldap://host.com:6666/o=3DABC%20Industries\,
2673:                         c=3DUS??(cn=3DBJim%20Dolittle)":Jim Dolittle\, ABC Industries\,
2674:                         +1-919-555-1234
2675:
2676:                      The following is an example of this property with an alternate
2677:                      representation of a MIME body part containing the contact
2678:                      information, such as a vCard [RFC 2426] embedded in a [MIME-DIR]
2679:                      content-type:
2680:
2681:                        CONTACT;ALTREP="CID=<part3.msg970930T083000SILVER@host.com>":Jim
2682:                          Dolittle\, ABC Industries\, +1-919-555-1234
2683:
2684:                      The following is an example of this property referencing a network
2685:                      resource, such as a vCard [RFC 2426] object containing the contact
2686:                      information:
2687:
2688:                        CONTACT;ALTREP="http://host.com/pdi/jdoe.vcf":Jim
2689:                          Dolittle\, ABC Industries\, +1-919-555-1234
2690:
2691:                     */
2692:                    if (icalEventParser) {
2693:                        // We will break this field into currently two bits. One is the original iCalendar data
2694:                        // 'organizer' the other is the email address.
2695:                        iCalEvent.setContact(extractAttribute(iCalLine,
2696:                                "CONTACT"));
2697:                    }
2698:                } else if (iCalLine.startsWith("ORGANIZER")) {
2699:                    /*
2700:                    4.8.4.3 Organizer
2701:
2702:                      Property Name: ORGANIZER
2703:
2704:                      Purpose: The property defines the organizer for a calendar component.
2705:
2706:                      Value Type: CAL-ADDRESS
2707:
2708:                      Property Parameters: Non-standard, language, common name, directory
2709:                      entry reference, sent by property parameters can be specified on this
2710:                      property.
2711:
2712:                      Conformance: This property MUST be specified in an ICalendar object
2713:                      that specifies a group scheduled calendar entity. This property MUST
2714:                      be specified in an ICalendar object that specifies the publication of
2715:                      a calendar user's busy time. This property MUST NOT be specified in
2716:                      an ICalendar object that specifies only a time zone definition or
2717:                      that defines calendar entities that are not group scheduled entities,
2718:                      but are entities only on a single user's calendar.
2719:
2720:                      Description: The property is specified within the "VEVENT", "VTODO",
2721:                      "VJOURNAL calendar components to specify the organizer of a group
2722:                      scheduled calendar entity. The property is specified within the
2723:                      "VFREEBUSY" calendar component to specify the calendar user
2724:                      requesting the free or busy time. When publishing a "VFREEBUSY"
2725:                      calendar component, the property is used to specify the calendar that
2726:                      the published busy time came from.
2727:
2728:                      The property has the property parameters CN, for specifying the
2729:                      common or display name associated with the "Organizer", DIR, for
2730:                      specifying a pointer to the directory information associated with the
2731:                      "Organizer", SENT-BY, for specifying another calendar user that is
2732:                      acting on behalf of the "Organizer". The non-standard parameters may
2733:                      also be specified on this property. If the LANGUAGE property
2734:                      parameter is specified, the identified language applies to the CN
2735:                      parameter value.
2736:
2737:                      Format Definition: The property is defined by the following notation:
2738:
2739:                        organizer  = "ORGANIZER" orgparam ":"
2740:                                     cal-address CRLF
2741:
2742:                        orgparam   = *(
2743:
2744:                                   ; the following are optional,
2745:                                   ; but MUST NOT occur more than once
2746:
2747:                                   (";" cnparam) / (";" dirparam) / (";" sentbyparam) /
2748:                                   (";" languageparam) /
2749:
2750:                                   ; the following is optional,
2751:                                   ; and MAY occur more than once
2752:
2753:                                   (";" xparam)
2754:
2755:                                   )
2756:
2757:                      Example: The following is an example of this property:
2758:
2759:                        ORGANIZER;CN=John Smith:MAILTO:jsmith@host1.com
2760:
2761:                      The following is an example of this property with a pointer to the
2762:                      directory information associated with the organizer:
2763:
2764:                        ORGANIZER;CN=JohnSmith;DIR="ldap://host.com:6666/o=3DDC%20Associ
2765:                         ates,c=3DUS??(cn=3DJohn%20Smith)":MAILTO:jsmith@host1.com
2766:
2767:                      The following is an example of this property used by another calendar
2768:                      user who is acting on behalf of the organizer, with responses
2769:                      intended to be sent back to the organizer, not the other calendar
2770:                      user:
2771:
2772:                        ORGANIZER;SENT-BY="MAILTO:jane_doe@host.com":
2773:                         MAILTO:jsmith@host1.com
2774:
2775:                     */
2776:                    //        	 Add support for parsing the iCal Event Organizer
2777:                    if (icalEventParser) {
2778:                        // We will break this field into currently two bits. One is the original iCalendar data
2779:                        // 'organizer' the other is the email address.
2780:                        parseOrganizer(iCalEvent, extractAttribute(iCalLine,
2781:                                "ORGANIZER"));
2782:                    } else
2783:                        // iCal level
2784:                        ical.setOrganizer(extractAttribute(iCalLine,
2785:                                "ORGANIZER"));
2786:                } else if (iCalLine.startsWith("RECURRENCE-ID")) {
2787:                    /*
2788:                    4.8.4.4 Recurrence ID
2789:
2790:                      Property Name: RECURRENCE-ID
2791:
2792:                      Purpose: This property is used in conjunction with the "UID" and
2793:                      "SEQUENCE" property to identify a specific instance of a recurring
2794:                      "VEVENT", "VTODO" or "VJOURNAL" calendar component. The property
2795:                      value is the effective value of the "DTSTART" property of the
2796:                      recurrence instance.
2797:
2798:                      Value Type: The default value type for this property is DATE-TIME.
2799:                      The time format can be any of the valid forms defined for a DATE-TIME
2800:                      value type. See DATE-TIME value type definition for specific
2801:                      interpretations of the various forms. The value type can be set to
2802:                      DATE.
2803:
2804:                      Property Parameters: Non-standard property, value data type, time
2805:                      zone identifier and recurrence identifier range parameters can be
2806:                      specified on this property.
2807:
2808:                      Conformance: This property can be specified in an ICalendar object
2809:                      containing a recurring calendar component.
2810:
2811:                      Description: The full range of calendar components specified by a
2812:                      recurrence set is referenced by referring to just the "UID" property
2813:                      value corresponding to the calendar component. The "RECURRENCE-ID"
2814:                      property allows the reference to an individual instance within the
2815:                      recurrence set.
2816:
2817:                      If the value of the "DTSTART" property is a DATE type value, then the
2818:                      value MUST be the calendar date for the recurrence instance.
2819:
2820:                      The date/time value is set to the time when the original recurrence
2821:                      instance would occur; meaning that if the intent is to change a
2822:                      Friday meeting to Thursday, the date/time is still set to the
2823:                      original Friday meeting.
2824:
2825:                      The "RECURRENCE-ID" property is used in conjunction with the "UID"
2826:                      and "SEQUENCE" property to identify a particular instance of a
2827:                      recurring event, to-do or journal. For a given pair of "UID" and
2828:                      "SEQUENCE" property values, the "RECURRENCE-ID" value for a
2829:                      recurrence instance is fixed. When the definition of the recurrence
2830:                      set for a calendar component changes, and hence the "SEQUENCE"
2831:                      property value changes, the "RECURRENCE-ID" for a given recurrence
2832:                      instance might also change.The "RANGE" parameter is used to specify
2833:                      the effective range of recurrence instances from the instance
2834:                      specified by the "RECURRENCE-ID" property value. The default value
2835:                      for the range parameter is the single recurrence instance only. The
2836:                      value can also be "THISANDPRIOR" to indicate a range defined by the
2837:                      given recurrence instance and all prior instances or the value can be
2838:                      "THISANDFUTURE" to indicate a range defined by the given recurrence
2839:                      instance and all subsequent instances.
2840:
2841:                      Format Definition: The property is defined by the following notation:
2842:
2843:                        recurid    = "RECURRENCE-ID" ridparam ":" ridval CRLF
2844:
2845:                        ridparam   = *(
2846:
2847:                                   ; the following are optional,
2848:                                   ; but MUST NOT occur more than once
2849:
2850:                                   (";" "VALUE" "=" ("DATE-TIME" / "DATE)) /
2851:                                   (";" tzidparam) / (";" rangeparam) /
2852:                                   ; the following is optional,
2853:                                   ; and MAY occur more than once
2854:
2855:                                   (";" xparam)
2856:
2857:                                   )
2858:
2859:                        ridval     = date-time / date
2860:                        ;Value MUST match value type
2861:
2862:                      Example: The following are examples of this property:
2863:
2864:                        RECURRENCE-ID;VALUE=DATE:19960401
2865:
2866:                        RECURRENCE-ID;RANGE=THISANDFUTURE:19960120T120000Z
2867:
2868:                     */
2869:
2870:                    // Added to support fixing single occurrence Exceptions
2871:                    // for a recurring event
2872:                    if (icalEventParser) {
2873:                        iCalEvent.setRecurrenceId(true);
2874:                    }
2875:
2876:                } else if (iCalLine.startsWith("RELATED-TO")) {
2877:                    /*
2878:                    4.8.4.5 Related To
2879:
2880:                      Property Name: RELATED-TO
2881:
2882:                      Purpose: The property is used to represent a relationship or
2883:                      reference between one calendar component and another.
2884:
2885:                      Value Type: TEXT
2886:
2887:                      Property Parameters: Non-standard and relationship type property
2888:                      parameters can be specified on this property.
2889:
2890:                      Conformance: The property can be specified one or more times in the
2891:                      "VEVENT", "VTODO" or "VJOURNAL" calendar components.
2892:
2893:                      Description: The property value consists of the persistent, globally
2894:                      unique identifier of another calendar component. This value would be
2895:                      represented in a calendar component by the "UID" property.
2896:
2897:                      By default, the property value points to another calendar component
2898:                      that has a PARENT relationship to the referencing object. The
2899:                      "RELTYPE" property parameter is used to either explicitly state the
2900:                      default PARENT relationship type to the referenced calendar component
2901:                      or to override the default PARENT relationship type and specify
2902:                      either a CHILD or SIBLING relationship. The PARENT relationship
2903:                      indicates that the calendar component is a subordinate of the
2904:                      referenced calendar component. The CHILD relationship indicates that
2905:                      the calendar component is a superior of the referenced calendar
2906:                      component. The SIBLING relationship indicates that the calendar
2907:                      component is a peer of the referenced calendar component.
2908:
2909:                      Changes to a calendar component referenced by this property can have
2910:                      an implicit impact on the related calendar component. For example, if
2911:                      a group event changes its start or end date or time, then the
2912:                      related, dependent events will need to have their start and end dates
2913:                      changed in a corresponding way. Similarly, if a PARENT calendar
2914:                      component is canceled or deleted, then there is an implied impact to
2915:                      the related CHILD calendar components. This property is intended only
2916:                      to provide information on the relationship of calendar components. It
2917:                      is up to the target calendar system to maintain any property
2918:                      implications of this relationship.
2919:
2920:                      Format Definition: The property is defined by the following notation:
2921:
2922:                        related    = "RELATED-TO" [relparam] ":" text CRLF
2923:
2924:                        relparam   = *(
2925:
2926:                                   ; the following is optional,
2927:                                   ; but MUST NOT occur more than once
2928:
2929:                                   (";" reltypeparam) /
2930:
2931:                                   ; the following is optional,
2932:                                   ; and MAY occur more than once
2933:
2934:                                   (";" xparm)
2935:
2936:                                   )
2937:
2938:                      The following is an example of this property:
2939:
2940:                        RELATED-TO:<jsmith.part7.19960817T083000.xyzMail@host3.com>
2941:
2942:                        RELATED-TO:<19960401-080045-4000F192713-0052@host1.com>
2943:
2944:                     */
2945:                    if (icalEventParser) {
2946:                        iCalEvent.setRelatedTo(extractAttribute(iCalLine,
2947:                                "RELATED-TO"));
2948:                    }
2949:                } else if (iCalLine.startsWith("URL")) {
2950:                    /*
2951:                    4.8.4.6 Uniform Resource Locator
2952:
2953:                      Property Name: URL
2954:
2955:                      Purpose: This property defines a Uniform Resource Locator (URL)
2956:                      associated with the ICalendar object.
2957:
2958:                      Value Type: URI
2959:
2960:                      Property Parameters: Non-standard property parameters can be
2961:                      specified on this property.
2962:
2963:                      Conformance: This property can be specified once in the "VEVENT",
2964:                      "VTODO", "VJOURNAL" or "VFREEBUSY" calendar components.
2965:
2966:                      Description: This property may be used in a calendar component to
2967:                      convey a location where a more dynamic rendition of the calendar
2968:                      information associated with the calendar component can be found. This
2969:                      memo does not attempt to standardize the form of the URI, nor the
2970:                      format of the resource pointed to by the property value. If the URL
2971:                      property and Content-Location MIME header are both specified, they
2972:                      MUST point to the same resource.
2973:
2974:                      Format Definition: The property is defined by the following notation:
2975:
2976:                        url        = "URL" urlparam ":" uri CRLF
2977:
2978:                        urlparam   = *(";" xparam)
2979:
2980:                      Example: The following is an example of this property:
2981:
2982:                        URL:http://abc.com/pub/calendars/jsmith/mytime.ics
2983:
2984:                     */
2985:                    // Add support for parsing and iCal Event URL
2986:                    if (icalEventParser) {
2987:                        String url = extractAttribute(iCalLine, "URL");
2988:                        if (url.startsWith("VALUE=URI:")) {
2989:                            url = url.substring(10);
2990:                        }
2991:                        iCalEvent.setUrl(url);
2992:                    }
2993:
2994:                } else if (iCalLine.startsWith("EXDATE")) {
2995:                    /*
2996:                    4.8.5 Recurrence Component Properties
2997:
2998:                      The following properties specify recurrence information in calendar
2999:                      components.
3000:
3001:                    4.8.5.1 Exception Date/Times
3002:
3003:                      Property Name: EXDATE
3004:
3005:                      Purpose: This property defines the list of date/time exceptions for a
3006:                      recurring calendar component.
3007:
3008:                      Value Type: The default value type for this property is DATE-TIME.
3009:                      The value type can be set to DATE.
3010:
3011:                      Property Parameters: Non-standard, value data type and time zone
3012:                      identifier property parameters can be specified on this property.
3013:
3014:                      Conformance: This property can be specified in an ICalendar object
3015:                      that includes a recurring calendar component.
3016:
3017:                      Description: The exception dates, if specified, are used in computing
3018:                      the recurrence set. The recurrence set is the complete set of
3019:                      recurrence instances for a calendar component. The recurrence set is
3020:                      generated by considering the initial "DTSTART" property along with
3021:                      the "RRULE", "RDATE", "EXDATE" and "EXRULE" properties contained
3022:                      within the ICalendar object. The "DTSTART" property defines the first
3023:                      instance in the recurrence set. Multiple instances of the "RRULE" and
3024:                      "EXRULE" properties can also be specified to define more
3025:                      sophisticated recurrence sets. The final recurrence set is generated
3026:                      by gathering all of the start date-times generated by any of the
3027:                      specified "RRULE" and "RDATE" properties, and then excluding any
3028:                      start date and times which fall within the union of start date and
3029:                      times generated by any specified "EXRULE" and "EXDATE" properties.
3030:                      This implies that start date and times within exclusion related
3031:                      properties (i.e., "EXDATE" and "EXRULE") take precedence over those
3032:                      specified by inclusion properties (i.e., "RDATE" and "RRULE"). Where
3033:                      duplicate instances are generated by the "RRULE" and "RDATE"
3034:                      properties, only one recurrence is considered. Duplicate instances
3035:                      are ignored.
3036:
3037:                      The "EXDATE" property can be used to exclude the value specified in
3038:                      "DTSTART". However, in such cases the original "DTSTART" date MUST
3039:                      still be maintained by the calendaring and scheduling system because
3040:                      the original "DTSTART" value has inherent usage dependencies by other
3041:                      properties such as the "RECURRENCE-ID".
3042:
3043:                      Format Definition: The property is defined by the following notation:
3044:
3045:                        exdate     = "EXDATE" exdtparam ":" exdtval *("," exdtval) CRLF
3046:
3047:                        exdtparam  = *(
3048:
3049:                                   ; the following are optional,
3050:                                   ; but MUST NOT occur more than once
3051:
3052:                                   (";" "VALUE" "=" ("DATE-TIME" / "DATE")) /
3053:
3054:                                   (";" tzidparam) /
3055:
3056:                                   ; the following is optional,
3057:                                   ; and MAY occur more than once
3058:
3059:                                   (";" xparam)
3060:
3061:                                   )
3062:
3063:                        exdtval    = date-time / date
3064:                        ;Value MUST match value type
3065:
3066:                      Example: The following is an example of this property:
3067:
3068:                        EXDATE:19960402T010000Z,19960403T010000Z,19960404T010000Z
3069:
3070:                     */
3071:                    if (icalEventParser) {
3072:                        // Fix a bug parsing recurring event Exception Dates
3073:                        parseExDate(iCalEvent, iCalLine.substring(7));
3074:
3075:                        //iCalEvent.exDateCollection.add(iCalLine.substring(18));
3076:                        iCalEvent.setExDatesExist(true);
3077:                    }
3078:                } else if (iCalLine.startsWith("RRULE")) {
3079:                    /*
3080:                    4.8.5.4 Recurrence Rule
3081:
3082:                      Property Name: RRULE
3083:
3084:                      Purpose: This property defines a rule or repeating pattern for
3085:                      recurring events, to-dos, or time zone definitions.
3086:
3087:                      Value Type: RECUR
3088:
3089:                      Property Parameters: Non-standard property parameters can be
3090:                      specified on this property.
3091:
3092:                      Conformance: This property can be specified one or more times in
3093:                      recurring "VEVENT", "VTODO" and "VJOURNAL" calendar components. It
3094:                      can also be specified once in each STANDARD or DAYLIGHT sub-component
3095:                      of the "VTIMEZONE" calendar component.
3096:
3097:                      Description: The recurrence rule, if specified, is used in computing
3098:                      the recurrence set. The recurrence set is the complete set of
3099:                      recurrence instances for a calendar component. The recurrence set is
3100:                      generated by considering the initial "DTSTART" property along with
3101:                      the "RRULE", "RDATE", "EXDATE" and "EXRULE" properties contained
3102:                      within the ICalendar object. The "DTSTART" property defines the first
3103:                      instance in the recurrence set. Multiple instances of the "RRULE" and
3104:                      "EXRULE" properties can also be specified to define more
3105:                      sophisticated recurrence sets. The final recurrence set is generated
3106:                      by gathering all of the start date/times generated by any of the
3107:                      specified "RRULE" and "RDATE" properties, and excluding any start
3108:                      date/times which fall within the union of start date/times generated
3109:                      by any specified "EXRULE" and "EXDATE" properties. This implies that
3110:                      start date/times within exclusion related properties (i.e., "EXDATE"
3111:                      and "EXRULE") take precedence over those specified by inclusion
3112:                      properties (i.e., "RDATE" and "RRULE"). Where duplicate instances are
3113:                      generated by the "RRULE" and "RDATE" properties, only one recurrence
3114:                      is considered. Duplicate instances are ignored.
3115:
3116:                      The "DTSTART" and "DTEND" property pair or "DTSTART" and "DURATION"
3117:                      property pair, specified within the ICalendar object defines the
3118:                      first instance of the recurrence. When used with a recurrence rule,
3119:                      the "DTSTART" and "DTEND" properties MUST be specified in local time
3120:                      and the appropriate set of "VTIMEZONE" calendar components MUST be
3121:                      included. For detail on the usage of the "VTIMEZONE" calendar
3122:                      component, see the "VTIMEZONE" calendar component definition.
3123:
3124:                      Any duration associated with the ICalendar object applies to all
3125:                      members of the generated recurrence set. Any modified duration for
3126:                      specific recurrences MUST be explicitly specified using the "RDATE"
3127:                      property.
3128:
3129:                      Format Definition: This property is defined by the following
3130:                      notation:
3131:
3132:                        rrule      = "RRULE" rrulparam ":" recur CRLF
3133:
3134:                        rrulparam  = *(";" xparam)
3135:
3136:                      Example: All examples assume the Eastern United States time zone.
3137:
3138:                      Daily for 10 occurrences:
3139:
3140:                        DTSTART;TZID=US-Eastern:19970902T090000
3141:                        RRULE:FREQ=DAILY;COUNT=10
3142:
3143:                        ==> (1997 9:00 AM EDT)September 2-11
3144:
3145:                      Daily until December 24, 1997:
3146:
3147:                        DTSTART;TZID=US-Eastern:19970902T090000
3148:                        RRULE:FREQ=DAILY;UNTIL=19971224T000000Z
3149:
3150:                        ==> (1997 9:00 AM EDT)September 2-30;October 1-25
3151:                            (1997 9:00 AM EST)October 26-31;November 1-30;December 1-23
3152:
3153:                      Every other day - forever:
3154:
3155:                        DTSTART;TZID=US-Eastern:19970902T090000
3156:                        RRULE:FREQ=DAILY;INTERVAL=2
3157:                        ==> (1997 9:00 AM EDT)September2,4,6,8...24,26,28,30;
3158:                             October 2,4,6...20,22,24
3159:                            (1997 9:00 AM EST)October 26,28,30;November 1,3,5,7...25,27,29;
3160:                             Dec 1,3,...
3161:
3162:                      Every 10 days, 5 occurrences:
3163:                     *
3164:                        DTSTART;TZID=US-Eastern:19970902T090000
3165:                        RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5
3166:
3167:                        ==> (1997 9:00 AM EDT)September 2,12,22;October 2,12
3168:
3169:                      Everyday in January, for 3 years:
3170:
3171:                        DTSTART;TZID=US-Eastern:19980101T090000
3172:                        RRULE:FREQ=YEARLY;UNTIL=20000131T090000Z;
3173:                         BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA
3174:                        or
3175:                        RRULE:FREQ=DAILY;UNTIL=20000131T090000Z;BYMONTH=1
3176:
3177:                        ==> (1998 9:00 AM EDT)January 1-31
3178:                            (1999 9:00 AM EDT)January 1-31
3179:                            (2000 9:00 AM EDT)January 1-31
3180:
3181:                      Weekly for 10 occurrences
3182:
3183:                        DTSTART;TZID=US-Eastern:19970902T090000
3184:                        RRULE:FREQ=WEEKLY;COUNT=10
3185:
3186:                        ==> (1997 9:00 AM EDT)September 2,9,16,23,30;October 7,14,21
3187:                            (1997 9:00 AM EST)October 28;November 4
3188:
3189:                      Weekly until December 24, 1997
3190:
3191:                        DTSTART;TZID=US-Eastern:19970902T090000
3192:                        RRULE:FREQ=WEEKLY;UNTIL=19971224T000000Z
3193:
3194:                        ==> (1997 9:00 AM EDT)September 2,9,16,23,30;October 7,14,21
3195:                            (1997 9:00 AM EST)October 28;November 4,11,18,25;
3196:                                              December 2,9,16,23
3197:                      Every other week - forever:
3198:
3199:                        DTSTART;TZID=US-Eastern:19970902T090000
3200:                        RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU
3201:
3202:                        ==> (1997 9:00 AM EDT)September 2,16,30;October 14
3203:                            (1997 9:00 AM EST)October 28;November 11,25;December 9,23
3204:                            (1998 9:00 AM EST)January 6,20;February
3205:                        ...
3206:
3207:                      Weekly on Tuesday and Thursday for 5 weeks:
3208:
3209:                       DTSTART;TZID=US-Eastern:19970902T090000
3210:                       RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH
3211:                       or
3212:
3213:                       RRULE:FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH
3214:
3215:                       ==> (1997 9:00 AM EDT)September 2,4,9,11,16,18,23,25,30;October 2
3216:
3217:                      Every other week on Monday, Wednesday and Friday until December 24,
3218:                      1997, but starting on Tuesday, September 2, 1997:
3219:
3220:                        DTSTART;TZID=US-Eastern:19970902T090000
3221:                        RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;WKST=SU;
3222:                         BYDAY=MO,WE,FR
3223:                        ==> (1997 9:00 AM EDT)September 2,3,5,15,17,19,29;October
3224:                        1,3,13,15,17
3225:                            (1997 9:00 AM EST)October 27,29,31;November 10,12,14,24,26,28;
3226:                                              December 8,10,12,22
3227:
3228:                      Every other week on Tuesday and Thursday, for 8 occurrences:
3229:
3230:                        DTSTART;TZID=US-Eastern:19970902T090000
3231:                        RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH
3232:
3233:                        ==> (1997 9:00 AM EDT)September 2,4,16,18,30;October 2,14,16
3234:
3235:                      Monthly on the 1st Friday for ten occurrences:
3236:
3237:                        DTSTART;TZID=US-Eastern:19970905T090000
3238:                        RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR
3239:
3240:                        ==> (1997 9:00 AM EDT)September 5;October 3
3241:                            (1997 9:00 AM EST)November 7;Dec 5
3242:                            (1998 9:00 AM EST)January 2;February 6;March 6;April 3
3243:                            (1998 9:00 AM EDT)May 1;June 5
3244:
3245:                      Monthly on the 1st Friday until December 24, 1997:
3246:
3247:                        DTSTART;TZID=US-Eastern:19970905T090000
3248:                        RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR
3249:
3250:                        ==> (1997 9:00 AM EDT)September 5;October 3
3251:                            (1997 9:00 AM EST)November 7;December 5
3252:
3253:                      Every other month on the 1st and last Sunday of the month for 10
3254:                      occurrences:
3255:
3256:                        DTSTART;TZID=US-Eastern:19970907T090000
3257:                        RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU
3258:
3259:                        ==> (1997 9:00 AM EDT)September 7,28
3260:                            (1997 9:00 AM EST)November 2,30
3261:                            (1998 9:00 AM EST)January 4,25;March 1,29
3262:                            (1998 9:00 AM EDT)May 3,31
3263:
3264:                      Monthly on the second to last Monday of the month for 6 months:
3265:
3266:                        DTSTART;TZID=US-Eastern:19970922T090000
3267:                        RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO
3268:
3269:                        ==> (1997 9:00 AM EDT)September 22;October 20
3270:                            (1997 9:00 AM EST)November 17;December 22
3271:                            (1998 9:00 AM EST)January 19;February 16
3272:
3273:                      Monthly on the third to the last day of the month, forever:
3274:
3275:                        DTSTART;TZID=US-Eastern:19970928T090000
3276:                        RRULE:FREQ=MONTHLY;BYMONTHDAY=-3
3277:
3278:                        ==> (1997 9:00 AM EDT)September 28
3279:                            (1997 9:00 AM EST)October 29;November 28;December 29
3280:                            (1998 9:00 AM EST)January 29;February 26
3281:                        ...
3282:
3283:                      Monthly on the 2nd and 15th of the month for 10 occurrences:
3284:
3285:                        DTSTART;TZID=US-Eastern:19970902T090000
3286:                        RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=2,15
3287:
3288:                        ==> (1997 9:00 AM EDT)September 2,15;October 2,15
3289:                            (1997 9:00 AM EST)November 2,15;December 2,15
3290:                            (1998 9:00 AM EST)January 2,15
3291:
3292:                      Monthly on the first and last day of the month for 10 occurrences:
3293:
3294:                        DTSTART;TZID=US-Eastern:19970930T090000
3295:                        RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1
3296:
3297:                        ==> (1997 9:00 AM EDT)September 30;October 1
3298:                            (1997 9:00 AM EST)October 31;November 1,30;December 1,31
3299:                            (1998 9:00 AM EST)January 1,31;February 1
3300:
3301:                      Every 18 months on the 10th thru 15th of the month for 10
3302:                      occurrences:
3303:
3304:                        DTSTART;TZID=US-Eastern:19970910T090000
3305:                        RRULE:FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,
3306:                         15
3307:
3308:                        ==> (1997 9:00 AM EDT)September 10,11,12,13,14,15
3309:                            (1999 9:00 AM EST)March 10,11,12,13
3310:
3311:                      Every Tuesday, every other month:
3312:
3313:                        DTSTART;TZID=US-Eastern:19970902T090000
3314:                        RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU
3315:
3316:                        ==> (1997 9:00 AM EDT)September 2,9,16,23,30
3317:                            (1997 9:00 AM EST)November 4,11,18,25
3318:                            (1998 9:00 AM EST)January 6,13,20,27;March 3,10,17,24,31
3319:                        ...
3320:
3321:                      Yearly in June and July for 10 occurrences:
3322:
3323:                        DTSTART;TZID=US-Eastern:19970610T090000
3324:                        RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7
3325:                        ==> (1997 9:00 AM EDT)June 10;July 10
3326:                            (1998 9:00 AM EDT)June 10;July 10
3327:                            (1999 9:00 AM EDT)June 10;July 10
3328:                            (2000 9:00 AM EDT)June 10;July 10
3329:                            (2001 9:00 AM EDT)June 10;July 10
3330:                        Note: Since none of the BYDAY, BYMONTHDAY or BYYEARDAY components
3331:                        are specified, the day is gotten from DTSTART
3332:
3333:                      Every other year on January, February, and March for 10 occurrences:
3334:
3335:                        DTSTART;TZID=US-Eastern:19970310T090000
3336:                        RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3
3337:
3338:                        ==> (1997 9:00 AM EST)March 10
3339:                            (1999 9:00 AM EST)January 10;February 10;March 10
3340:                            (2001 9:00 AM EST)January 10;February 10;March 10
3341:                            (2003 9:00 AM EST)January 10;February 10;March 10
3342:
3343:                      Every 3rd year on the 1st, 100th and 200th day for 10 occurrences:
3344:
3345:                        DTSTART;TZID=US-Eastern:19970101T090000
3346:                        RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200
3347:
3348:                        ==> (1997 9:00 AM EST)January 1
3349:                            (1997 9:00 AM EDT)April 10;July 19
3350:                            (2000 9:00 AM EST)January 1
3351:                            (2000 9:00 AM EDT)April 9;July 18
3352:                            (2003 9:00 AM EST)January 1
3353:                            (2003 9:00 AM EDT)April 10;July 19
3354:                            (2006 9:00 AM EST)January 1
3355:
3356:                      Every 20th Monday of the year, forever:
3357:
3358:                        DTSTART;TZID=US-Eastern:19970519T090000
3359:                        RRULE:FREQ=YEARLY;BYDAY=20MO
3360:
3361:                        ==> (1997 9:00 AM EDT)May 19
3362:                            (1998 9:00 AM EDT)May 18
3363:                            (1999 9:00 AM EDT)May 17
3364:                        ...
3365:
3366:                      Monday of week number 20 (where the default start of the week is
3367:                      Monday), forever:
3368:
3369:                        DTSTART;TZID=US-Eastern:19970512T090000
3370:                        RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO
3371:
3372:                        ==> (1997 9:00 AM EDT)May 12
3373:                            (1998 9:00 AM EDT)May 11
3374:                            (1999 9:00 AM EDT)May 17
3375:                        ...
3376:
3377:                      Every Thursday in March, forever:
3378:
3379:                        DTSTART;TZID=US-Eastern:19970313T090000
3380:                        RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=TH
3381:
3382:                        ==> (1997 9:00 AM EST)March 13,20,27
3383:                            (1998 9:00 AM EST)March 5,12,19,26
3384:                            (1999 9:00 AM EST)March 4,11,18,25
3385:                        ...
3386:
3387:                      Every Thursday, but only during June, July, and August, forever:
3388:
3389:                        DTSTART;TZID=US-Eastern:19970605T090000
3390:                        RRULE:FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8
3391:
3392:                        ==> (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;
3393:                                          August 7,14,21,28
3394:                            (1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;
3395:                                          August 6,13,20,27
3396:                            (1999 9:00 AM EDT)June 3,10,17,24;July 1,8,15,22,29;
3397:                                          August 5,12,19,26
3398:                        ...
3399:
3400:                      Every Friday the 13th, forever:
3401:
3402:                        DTSTART;TZID=US-Eastern:19970902T090000
3403:                        EXDATE;TZID=US-Eastern:19970902T090000
3404:                        RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
3405:
3406:                        ==> (1998 9:00 AM EST)February 13;March 13;November 13
3407:                            (1999 9:00 AM EDT)August 13
3408:                            (2000 9:00 AM EDT)October 13
3409:                        ...
3410:
3411:                      The first Saturday that follows the first Sunday of the month,
3412:                       forever:
3413:
3414:                        DTSTART;TZID=US-Eastern:19970913T090000
3415:                        RRULE:FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13
3416:
3417:                        ==> (1997 9:00 AM EDT)September 13;October 11
3418:                            (1997 9:00 AM EST)November 8;December 13
3419:                            (1998 9:00 AM EST)January 10;February 7;March 7
3420:                            (1998 9:00 AM EDT)April 11;May 9;June 13...
3421:                        ...
3422:
3423:                      Every four years, the first Tuesday after a Monday in November,
3424:                      forever (U.S. Presidential Election day):
3425:
3426:                        DTSTART;TZID=US-Eastern:19961105T090000
3427:                        RRULE:FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,
3428:                         5,6,7,8
3429:
3430:                        ==> (1996 9:00 AM EST)November 5
3431:                            (2000 9:00 AM EST)November 7
3432:                            (2004 9:00 AM EST)November 2
3433:                        ...
3434:
3435:                      The 3rd instance into the month of one of Tuesday, Wednesday or
3436:                      Thursday, for the next 3 months:
3437:
3438:                        DTSTART;TZID=US-Eastern:19970904T090000
3439:                        RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3
3440:
3441:                        ==> (1997 9:00 AM EDT)September 4;October 7
3442:                            (1997 9:00 AM EST)November 6
3443:
3444:                      The 2nd to last weekday of the month:
3445:
3446:                        DTSTART;TZID=US-Eastern:19970929T090000
3447:                        RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2
3448:
3449:                        ==> (1997 9:00 AM EDT)September 29
3450:                            (1997 9:00 AM EST)October 30;November 27;December 30
3451:                            (1998 9:00 AM EST)January 29;February 26;March 30
3452:                        ...
3453:
3454:                      Every 3 hours from 9:00 AM to 5:00 PM on a specific day:
3455:
3456:                        DTSTART;TZID=US-Eastern:19970902T090000
3457:                        RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z
3458:
3459:                        ==> (September 2, 1997 EDT)09:00,12:00,15:00
3460:
3461:                      Every 15 minutes for 6 occurrences:
3462:
3463:                        DTSTART;TZID=US-Eastern:19970902T090000
3464:                        RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6
3465:
3466:                        ==> (September 2, 1997 EDT)09:00,09:15,09:30,09:45,10:00,10:15
3467:
3468:                      Every hour and a half for 4 occurrences:
3469:
3470:                        DTSTART;TZID=US-Eastern:19970902T090000
3471:                        RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4
3472:
3473:                        ==> (September 2, 1997 EDT)09:00,10:30;12:00;13:30
3474:
3475:                      Every 20 minutes from 9:00 AM to 4:40 PM every day:
3476:
3477:                        DTSTART;TZID=US-Eastern:19970902T090000
3478:                        RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40
3479:                        or
3480:                        RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16
3481:
3482:                        ==> (September 2, 1997 EDT)9:00,9:20,9:40,10:00,10:20,
3483:                                                   ... 16:00,16:20,16:40
3484:                            (September 3, 1997 EDT)9:00,9:20,9:40,10:00,10:20,
3485:                                                  ...16:00,16:20,16:40
3486:                        ...
3487:
3488:                      An example where the days generated makes a difference because of
3489:                      WKST:
3490:
3491:                        DTSTART;TZID=US-Eastern:19970805T090000
3492:                        RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO
3493:
3494:                        ==> (1997 EDT)Aug 5,10,19,24
3495:
3496:                        changing only WKST from MO to SU, yields different results...
3497:
3498:                        DTSTART;TZID=US-Eastern:19970805T090000
3499:                        RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=SU
3500:                        ==> (1997 EDT)August 5,17,19,31
3501:
3502:                     */
3503:                    try {
3504:                        if (icalTimeZoneParser) {
3505:                            if (timeZoneType.equalsIgnoreCase("STANDARD")) {
3506:                                icalTimeZone.setstandardRRule(extractAttribute(
3507:                                        iCalLine, "RRULE"));
3508:                            } else {
3509:                                icalTimeZone.setdaylightRRule(extractAttribute(
3510:                                        iCalLine, "RRULE"));
3511:                            }
3512:                        }
3513:                        if (icalEventParser) {
3514:                            iCalEvent.setRRule(extractAttribute(iCalLine,
3515:                                    "RRULE"));
3516:                            RepeatRules rr = new RepeatRules();
3517:                            rr.parseRepeatRules(iCalEvent.getRRule());
3518:                            // Move parsed values back into iCalEvent.
3519:                            iCalEvent.setRepeatRules(rr);
3520:                        }
3521:                    } catch (Exception e) {
3522:                        logger
3523:                                .fine("Error processing RRULE line of ICalendar, line:"
3524:                                        + lineCtr + "Exception" + e);
3525:                    }
3526:                } else if (iCalLine.startsWith("CREATED")) {
3527:                    /*
3528:                    4.8.7 Change Management Component Properties
3529:
3530:                      The following properties specify change management information in
3531:                      calendar components.
3532:
3533:                    4.8.7.1 Date/Time Created
3534:
3535:                      Property Name: CREATED
3536:
3537:                      Purpose: This property specifies the date and time that the calendar
3538:                      information was created by the calendar user agent in the calendar
3539:                      store.
3540:
3541:                           Note: This is analogous to the creation date and time for a file
3542:                           in the file system.
3543:
3544:                      Value Type: DATE-TIME
3545:
3546:                      Property Parameters: Non-standard property parameters can be
3547:                      specified on this property.
3548:
3549:                      Conformance: The property can be specified once in "VEVENT", "VTODO"
3550:                      or "VJOURNAL" calendar components.
3551:
3552:                      Description: The date and time is a UTC value.
3553:
3554:                      Format Definition: The property is defined by the following notation:
3555:
3556:                        created    = "CREATED" creaparam ":" date-time CRLF
3557:
3558:                        creaparam  = *(";" xparam)
3559:
3560:                      Example: The following is an example of this property:
3561:
3562:                        CREATED:19960329T133000Z
3563:                     */
3564:                    if (icalEventParser)
3565:                        iCalEvent.setCreated(convertIcalDate(extractAttribute(
3566:                                iCalLine, "CREATED")));
3567:                } else if (iCalLine.startsWith("DTSTAMP")) {
3568:                    /*
3569:                    4.8.7.2 Date/Time Stamp
3570:
3571:                      Property Name: DTSTAMP
3572:
3573:                      Purpose: The property indicates the date/time that the instance of
3574:                      the ICalendar object was created.
3575:
3576:                      Value Type: DATE-TIME
3577:
3578:                      Property Parameters: Non-standard property parameters can be
3579:                      specified on this property.
3580:
3581:                      Conformance: This property MUST be included in the "VEVENT", "VTODO",
3582:                      "VJOURNAL" or "VFREEBUSY" calendar components.
3583:
3584:                      Description: The value MUST be specified in the UTC time format.
3585:
3586:                      This property is also useful to protocols such as [IMIP] that have
3587:                      inherent latency issues with the delivery of content. This property
3588:                      will assist in the proper sequencing of messages containing ICalendar
3589:                      objects.
3590:
3591:                      This property is different than the "CREATED" and "LAST-MODIFIED"
3592:                      properties. These two properties are used to specify when the
3593:                      particular calendar data in the calendar store was created and last
3594:                      modified. This is different than when the ICalendar object
3595:                      representation of the calendar service information was created or
3596:                      last modified.
3597:
3598:                      Format Definition: The property is defined by the following notation:
3599:
3600:                        dtstamp    = "DTSTAMP" stmparam ":" date-time CRLF
3601:
3602:                        stmparam   = *(";" xparam)
3603:
3604:                      Example:
3605:
3606:                        DTSTAMP:19971210T080000Z
3607:
3608:                     */
3609:                    if (icalEventParser)
3610:                        iCalEvent
3611:                                .setDateStamp(convertIcalDate(extractAttribute(
3612:                                        iCalLine, "DTSTAMP")));
3613:                } else if (iCalLine.startsWith("LAST-MODIFIED")) {
3614:                    /*
3615:                    4.8.7.3 Last Modified
3616:
3617:                      Property Name: LAST-MODIFIED
3618:
3619:                      Purpose: The property specifies the date and time that the
3620:                      information associated with the calendar component was last revised
3621:                      in the calendar store.
3622:
3623:                           Note: This is analogous to the modification date and time for a
3624:                           file in the file system.
3625:
3626:                      Value Type: DATE-TIME
3627:
3628:                      Property Parameters: Non-standard property parameters can be
3629:                      specified on this property.
3630:
3631:                      Conformance: This property can be specified in the "EVENT", "VTODO",
3632:                      "VJOURNAL" or "VTIMEZONE" calendar components.
3633:
3634:                      Description: The property value MUST be specified in the UTC time
3635:                      format.
3636:
3637:                      Format Definition: The property is defined by the following notation:
3638:
3639:                        last-mod   = "LAST-MODIFIED" lstparam ":" date-time CRLF
3640:
3641:                        lstparam   = *(";" xparam)
3642:
3643:                      Example: The following is are examples of this property:
3644:
3645:                        LAST-MODIFIED:19960817T133000Z
3646:
3647:                     */
3648:                    if (icalEventParser)
3649:                        iCalEvent
3650:                                .setLastModified(convertIcalDate(extractAttribute(
3651:                                        iCalLine, "LAST-MODIFIED")));
3652:                } else if (iCalLine.startsWith("SEQUENCE")) {
3653:                    /*
3654:                    4.8.7.4 Sequence Number
3655:
3656:                      Property Name: SEQUENCE
3657:
3658:                      Purpose: This property defines the revision sequence number of the
3659:                      calendar component within a sequence of revisions.
3660:
3661:                      Value Type: integer
3662:
3663:                      Property Parameters: Non-standard property parameters can be
3664:                      specified on this property.
3665:
3666:                      Conformance: The property can be specified in "VEVENT", "VTODO" or
3667:                      "VJOURNAL" calendar component.
3668:
3669:                      Description: When a calendar component is created, its sequence
3670:                      number is zero (US-ASCII decimal 48). It is monotonically incremented
3671:                      by the "Organizer's" CUA each time the "Organizer" makes a
3672:                      significant revision to the calendar component. When the "Organizer"
3673:                      makes changes to one of the following properties, the sequence number
3674:                      MUST be incremented:
3675:
3676:                        .  "DTSTART"
3677:
3678:                        .  "DTEND"
3679:
3680:                        .  "DUE"
3681:
3682:                        .  "RDATE"
3683:
3684:                        .  "RRULE"
3685:
3686:                        .  "EXDATE"
3687:
3688:                        .  "EXRULE"
3689:
3690:                        .  "STATUS"
3691:
3692:                      In addition, changes made by the "Organizer" to other properties can
3693:                      also force the sequence number to be incremented. The "Organizer" CUA
3694:                      MUST increment the sequence number when ever it makes changes to
3695:                      properties in the calendar component that the "Organizer" deems will
3696:                      jeopardize the validity of the participation status of the
3697:                      "Attendees". For example, changing the location of a meeting from one
3698:                      locale to another distant locale could effectively impact the
3699:                      participation status of the "Attendees".
3700:
3701:                      The "Organizer" includes this property in an ICalendar object that it
3702:                      sends to an "Attendee" to specify the current version of the calendar
3703:                      component.
3704:
3705:                      The "Attendee" includes this property in an ICalendar object that it
3706:                      sends to the "Organizer" to specify the version of the calendar
3707:                      component that the "Attendee" is referring to.
3708:
3709:                      A change to the sequence number is not the mechanism that an
3710:                      "Organizer" uses to request a response from the "Attendees". The
3711:                      "RSVP" parameter on the "ATTENDEE" property is used by the
3712:                      "Organizer" to indicate that a response from the "Attendees" is
3713:                      requested.
3714:
3715:                      Format Definition: This property is defined by the following
3716:                      notation:
3717:
3718:                        seq = "SEQUENCE" seqparam ":" integer CRLF
3719:                        ; Default is "0"
3720:
3721:                        seqparam   = *(";" xparam)
3722:
3723:                      Example: The following is an example of this property for a calendar
3724:                      component that was just created by the "Organizer".
3725:
3726:                        SEQUENCE:0
3727:
3728:                      The following is an example of this property for a calendar component
3729:                      that has been revised two different times by the "Organizer".
3730:
3731:                        SEQUENCE:2
3732:
3733:                     */
3734:                    if (icalEventParser) {
3735:                        try {
3736:                            iCalEvent.setSequence(Integer
3737:                                    .parseInt((extractAttribute(iCalLine,
3738:                                            "SEQUENCE"))));
3739:                        } catch (Exception e) {
3740:                            logger.severe("Parse Integer error on data :"
3741:                                    + extractAttribute(iCalLine, "SEQUENCE")
3742:                                    + "Exception is : " + e);
3743:                            e.printStackTrace(System.err);
3744:                        }
3745:                    }
3746:                } else if (iCalLine.startsWith("X-")) {
3747:                    /*
3748:                    4.8.8 Miscellaneous Component Properties
3749:
3750:                      The following properties specify information about a number of
3751:                      miscellaneous features of calendar components.
3752:
3753:                    4.8.8.1 Non-standard Properties
3754:
3755:                      Property Name: Any property name with a "X-" prefix
3756:
3757:                      Purpose: This class of property provides a framework for defining
3758:                      non-standard properties.
3759:
3760:                      Value Type: TEXT
3761:
3762:                      Property Parameters: Non-standard and language property parameters
3763:                      can be specified on this property.
3764:
3765:                      Conformance: This property can be specified in any calendar
3766:                      component.
3767:
3768:                      Description: The MIME Calendaring and Scheduling Content Type
3769:                      provides a "standard mechanism for doing non-standard things". This
3770:                      extension support is provided for implementers to "push the envelope"
3771:                      on the existing version of the memo. Extension properties are
3772:                      specified by property and/or property parameter names that have the
3773:                      prefix text of "X-" (the two character sequence: LATIN CAPITAL LETTER
3774:                      X character followed by the HYPEN-MINUS character). It is recommended
3775:                      that vendors concatenate onto this sentinel another short prefix text
3776:                      to identify the vendor. This will facilitate readability of the
3777:                      extensions and minimize possible collision of names between different
3778:                      vendors. User agents that support this content type are expected to
3779:                      be able to parse the extension properties and property parameters but
3780:                      can ignore them.
3781:
3782:                      At present, there is no registration authority for names of extension
3783:                      properties and property parameters. The data type for this property
3784:                      is TEXT. Optionally, the data type can be any of the other valid data
3785:                      types.
3786:
3787:                      Format Definition: The property is defined by the following notation:
3788:
3789:                        x-prop     = x-name *(";" xparam) [";" languageparam] ":" text CRLF
3790:                           ; Lines longer than 75 octets should be folded
3791:
3792:                      Example: The following might be the ABC vendor's extension for an
3793:                      audio-clip form of subject property:
3794:
3795:                        X-ABC-MMSUBJ;X-ABC-MMSUBJTYPE=wave:http://load.noise.org/mysubj.wav
3796:
3797:                     */
3798:                } else if (iCalLine.startsWith("REQUEST-STATUS")) {
3799:                    /*
3800:                    4.8.8.2 Request Status
3801:
3802:                      Property Name: REQUEST-STATUS
3803:
3804:                      Purpose: This property defines the status code returned for a
3805:                      scheduling request.
3806:
3807:                      Value Type: TEXT
3808:
3809:                      Property Parameters: Non-standard and language property parameters
3810:                      can be specified on this property.
3811:
3812:                      Conformance: The property can be specified in "VEVENT", "VTODO",
3813:                      "VJOURNAL" or "VFREEBUSY" calendar component.
3814:
3815:                      Description: This property is used to return status code information
3816:                      related to the processing of an associated ICalendar object. The data
3817:                      type for this property is TEXT.
3818:
3819:                      The value consists of a short return status component, a longer
3820:                      return status description component, and optionally a status-specific
3821:                      data component. The components of the value are separated by the
3822:                      SEMICOLON character (US-ASCII decimal 59).
3823:
3824:                      The short return status is a PERIOD character (US-ASCII decimal 46)
3825:                      separated 3-tuple of integers. For example, "3.1.1". The successive
3826:                      levels of integers provide for a successive level of status code
3827:                      granularity.
3828:
3829:                      The following are initial classes for the return status code.
3830:                      Individual ICalendar object methods will define specific return
3831:                      status codes for these classes. In addition, other classes for the
3832:                      return status code may be defined using the registration process
3833:                      defined later in this memo.
3834:
3835:                        |==============+===============================================|
3836:                        | Short Return | Longer Return Status Description              |
3837:                        | Status Code  |                                               |
3838:                        |==============+===============================================|
3839:                        |    1.xx      | Preliminary success. This class of status     |
3840:                        |              | of status code indicates that the request has |
3841:                        |              | request has been initially processed but that |
3842:                        |              | completion is pending.                        |
3843:                        |==============+===============================================|
3844:                        |    2.xx      | Successful. This class of status code         |
3845:                        |              | indicates that the request was completed      |
3846:                        |              | successfuly. However, the exact status code   |
3847:                        |              | can indicate that a fallback has been taken.  |
3848:                        |==============+===============================================|
3849:                        |    3.xx      | Client Error. This class of status code       |
3850:                        |              | indicates that the request was not successful.|
3851:                        |              | The error is the result of either a syntax or |
3852:                        |              | a semantic error in the client formatted      |
3853:                        |              | request. Request should not be retried until  |
3854:                        |              | the condition in the request is corrected.    |
3855:                        |==============+===============================================|
3856:                        |    4.xx      | Scheduling Error. This class of status code   |
3857:                        |              | indicates that the request was not successful.|
3858:                        |              | Some sort of error occurred within the        |
3859:                        |              | calendaring and scheduling service, not       |
3860:                        |              | directly related to the request itself.       |
3861:                        |==============+===============================================|
3862:
3863:                      Format Definition: The property is defined by the following notation:
3864:
3865:                        rstatus    = "REQUEST-STATUS" rstatparam ":"
3866:                                     statcode ";" statdesc [";" extdata]
3867:
3868:                        rstatparam = *(
3869:
3870:                                   ; the following is optional,
3871:                                   ; but MUST NOT occur more than once
3872:
3873:                                   (";" languageparm) /
3874:
3875:                                   ; the following is optional,
3876:                                   ; and MAY occur more than once
3877:
3878:                                   (";" xparam)
3879:
3880:                                   )
3881:
3882:                        statcode   = 1*DIGIT *("." 1*DIGIT)
3883:                        ;Hierarchical, numeric return status code
3884:
3885:                        statdesc   = text
3886:                        ;Textual status description
3887:
3888:                        extdata    = text
3889:                        ;Textual exception data. For example, the offending property
3890:                        ;name and value or complete property line.
3891:
3892:                      Example: The following are some possible examples of this property.
3893:                      The COMMA and SEMICOLON separator characters in the property value
3894:                      are BACKSLASH character escaped because they appear in a  text value.
3895:
3896:                        REQUEST-STATUS:2.0;Success
3897:
3898:                        REQUEST-STATUS:3.1;Invalid property value;DTSTART:96-Apr-01
3899:
3900:                        REQUEST-STATUS:2.8; Success\, repeating event ignored. Scheduled
3901:                         as a single event.;RRULE:FREQ=WEEKLY\;INTERVAL=2
3902:
3903:                        REQUEST-STATUS:4.1;Event conflict. Date/time is busy.
3904:
3905:                        REQUEST-STATUS:3.7;Invalid calendar user;ATTENDEE:
3906:                         MAILTO:jsmith@host.com
3907:
3908:                     */
3909:                    if (icalEventParser) {
3910:                        iCalEvent.setRequestStatus(extractAttribute(iCalLine,
3911:                                "REQUEST-STATUS"));
3912:                    }
3913:                } else {
3914:                    logger.fine("Line not parsed (probably correct but check):"
3915:                            + iCalLine);
3916:                }
3917:            }
3918:
3919:            public Date convertIcalDate(String iCalString) {
3920:                /*
3921:                 * DTSTART:19970714T133000            ;Local time
3922:                 * DTSTART:19970714T173000Z           ;UTC time
3923:                 * DTSTART;TZID=US-Eastern:19970714T133000    ;Local time and time
3924:                 *               ; zone reference
3925:                 *DTSTART;VALUE=DATE;
3926:                   TZID=/softwarestudio.org/Olson_20011030_5/Europe/Amsterdam:20030902
3927:                 *
3928:                 * Point of all this, return date as local.
3929:                 */
3930:                //logger.fine(iCalEvent.getSummary());
3931:                //logger.fine(iCalString);
3932:                String iCalFormat = null;
3933:                int startPoint = 0;
3934:                String tzName = null;
3935:
3936:                TimeZone offsetZone = java.util.TimeZone.getDefault();
3937:
3938:                if (iCalString.startsWith("TZID=")) {
3939:                    // Time for a specific Time Zone
3940:                    startPoint = iCalString.indexOf(":") + 1;
3941:                    // Get timezone.
3942:                    offsetZone = getTimeZoneFromDate(iCalString, startPoint);
3943:                    /*
3944:                     if (iCalString.indexOf("TZID=/softwarestudio.org/Olson_20011030_5/") != -1)
3945:                     {
3946:                     tzName = iCalString.substring("TZID=/softwarestudio.org/Olson_20011030_5/".length(),startPoint -1);
3947:                     }
3948:                     else
3949:                     {
3950:                     tzName = iCalString.substring("TZID=".length(),startPoint -1);
3951:                     }
3952:                     offsetZone = TimeZone.getTimeZone(tzName);
3953:                     **/
3954:                    //logger.fine("TZID St Pt = " + startPoint + " String " + iCalString);
3955:                    iCalString = iCalString.substring(startPoint,
3956:                            startPoint + 8)
3957:                            + iCalString.substring(startPoint + 9,
3958:                                    startPoint + 15);
3959:                    iCalFormat = "yyyyMMddHHmmss";
3960:                    // Need to do the offset thing to get in local date/time.
3961:                    // Currently expect that all time is local.
3962:                } else if (iCalString.startsWith("VALUE=DATE:")) {
3963:                    startPoint = iCalString.indexOf(":") + 1;
3964:                    iCalString = iCalString.substring(startPoint,
3965:                            startPoint + 8);
3966:                    // + "000000" ;
3967:                    iCalFormat = "yyyyMMdd";
3968:                } else if (iCalString.startsWith("VALUE=DATE;")) {
3969:                    // decipher dates of type: VALUE=DATE;TZID=/softwarestudio.org/Olson_20011030_5/Australia/Sydney:20020918
3970:                    startPoint = iCalString.indexOf(";") + 1;
3971:                    iCalString = iCalString.substring(startPoint);
3972:                    startPoint = iCalString.indexOf(":") + 1;
3973:                    // Get timezone.
3974:                    //logger.fine("TZID 2 St Pt = " + startPoint + " String " + iCalString);
3975:                    offsetZone = getTimeZoneFromDate(iCalString, startPoint);
3976:                    //iCalString = iCalString.substring(startPoint ,startPoint  + 8) + iCalString.substring(startPoint  + 10, startPoint + 16);
3977:                    iCalString = iCalString.substring(startPoint);
3978:                    iCalFormat = "yyyyMMdd";
3979:                } else if (iCalString.startsWith("VALUE=DATE-TIME;")) {
3980:                    // decipher dates of type: VALUE=DATE-TIME;TZID=/softwarestudio.org/Olson_20011030_5/Australia/Sydney:20020918T120000
3981:                    startPoint = iCalString.indexOf(";") + 1;
3982:                    iCalString = iCalString.substring(startPoint);
3983:                    startPoint = iCalString.indexOf(":") + 1;
3984:                    // Get timezone.
3985:                    //logger.fine("TZID 2 St Pt = " + startPoint + " String " + iCalString);
3986:                    offsetZone = getTimeZoneFromDate(iCalString, startPoint);
3987:                    //iCalString = iCalString.substring(startPoint ,startPoint  + 8) + iCalString.substring(startPoint  + 10, startPoint + 16);
3988:                    iCalString = iCalString.substring(startPoint);
3989:                    iCalFormat = "yyyyMMdd'T'HHmmss";
3990:                } else if (iCalString.startsWith("VALUE=DATE-TIME:")) {
3991:                    // decipher dates of type: VALUE=DATE-TIME:20020918T120000
3992:                    startPoint = iCalString.indexOf(":") + 1;
3993:                    offsetZone = gmt;
3994:                    iCalString = iCalString.substring(startPoint);
3995:                    iCalFormat = "yyyyMMdd'T'HHmmss";
3996:                } else if (iCalString.endsWith("Z")) {
3997:                    // UTC Time
3998:                    offsetZone = gmt;
3999:                    iCalString = iCalString.substring(0, 8)
4000:                            + iCalString.substring(9, 15);
4001:                    iCalFormat = "yyyyMMddHHmmss";
4002:                } else if (iCalString.substring(8, 9).equalsIgnoreCase("T")) {
4003:                    // Local Time
4004:                    iCalString = iCalString.substring(0, 8)
4005:                            + iCalString.substring(9);
4006:                    iCalFormat = "yyyyMMddHHmmss";
4007:                } else {
4008:                    logger.fine("Date Type not known:(" + iCalString + ")");
4009:                    return null;
4010:                }
4011:
4012:                Date date = null;
4013:                try {
4014:                    SimpleDateFormat formatter = new SimpleDateFormat(
4015:                            iCalFormat);
4016:                    formatter.setTimeZone(offsetZone);
4017:                    //logger.fine("Parsing:" + iCalFormat + "with:" + iCalString );
4018:                    date = (Date) formatter.parse(iCalString);
4019:                } catch (Exception e) {
4020:                    System.err.print("Parse error - " + e);
4021:                }
4022:                return date;
4023:            }
4024:
4025:            public TimeZone getTimeZoneFromDate(String iCalString,
4026:                    int startPoint) {
4027:                TimeZone tz = null;
4028:                try {
4029:                    String tzName = null;
4030:                    if (iCalString
4031:                            .indexOf("TZID=/softwarestudio.org/Olson_20011030_5/") != -1) {
4032:                        tzName = iCalString.substring(
4033:                                "TZID=/softwarestudio.org/Olson_20011030_5/"
4034:                                        .length(), startPoint - 1);
4035:                    } else {
4036:                        tzName = iCalString.substring("TZID=".length(),
4037:                                startPoint - 1);
4038:                    }
4039:                    tz = TimeZone.getTimeZone(tzName);
4040:                } catch (Exception e) {
4041:                    System.err.print("iCal Line - " + lineCtr
4042:                            + "Parse error - " + e);
4043:                }
4044:                return tz;
4045:            }
4046:
4047:            public String extractAttribute(String attribLine, String attribName) {
4048:                String attr = "";
4049:                /*
4050:                if (attribName.equals("TRANSP"))
4051:                {
4052:                    logger.fine (attribLine
4053:                                + attribLine.length()
4054:                                        );
4055:                }
4056:                 */
4057:                // Returns Attribute Value.. Add 1 for the colon :
4058:                try {
4059:                    attr = attribLine.substring(attribName.length() + 1);
4060:                } catch (Exception e) {
4061:                    logger.fine("iCal Line - " + lineCtr
4062:                            + "Parse error when extracting Attribute - "
4063:                            + attribName + " from Attribute Line - "
4064:                            + attribLine + "Parse error is: " + e);
4065:                }
4066:                // Fix bugs where escaped characters were not being unescaped
4067:                // Convert "\n" to a LF and "\r" to a CR
4068:                attr = attr.replaceAll("\\\\n", "\n");
4069:                attr = attr.replaceAll("\\\\r", "\r");
4070:                attr = attr.replaceAll("\\\\,", ",");
4071:                attr = attr.replaceAll("\\\\\"", "\"");
4072:                attr = attr.replaceAll("\\\\;", ";");
4073:
4074:                return attr;
4075:            }
4076:
4077:            public void parseOrganizer(ICalendarVEvent iCalEvent,
4078:                    String organizer) {
4079:                String iCalOrganizer = extractAttribute(organizer, "ORGANIZER");
4080:                iCalEvent.setOrganizer(iCalOrganizer);
4081:
4082:                int startPoint = -1;
4083:                int ii = 0;
4084:                boolean mailto = false;
4085:                while (organizer != null && ii < 10) {
4086:                    ii++;
4087:                    String attr = null;
4088:                    startPoint = organizer.indexOf(":");
4089:                    if (startPoint != -1) {
4090:                        attr = organizer.substring(0, startPoint);
4091:                        organizer = organizer.substring(startPoint + 1);
4092:                    } else {
4093:                        attr = organizer;
4094:                        organizer = null;
4095:                    }
4096:                    if (attr.toUpperCase().startsWith("CN=")) {
4097:                        attr = attr.substring(3);
4098:                        if (attr.startsWith("\"")) {
4099:                            attr = attr.substring(1);
4100:                        }
4101:                        if (attr.endsWith("\"")) {
4102:                            attr = attr.substring(0, attr.length() - 1);
4103:                        }
4104:                        iCalEvent.setOrganizer(attr);
4105:                    } else if (attr.toUpperCase().startsWith("MAILTO")) {
4106:                        mailto = true;
4107:                    } else if (mailto) {
4108:                        mailto = false;
4109:                        iCalEvent.setOrganizerEmail(attr);
4110:                    }
4111:                }
4112:            }
4113:
4114:            public void parseExDate(ICalendarVEvent iCalEvent, String exDate) {
4115:                int startPoint = -1;
4116:                int ii = 0;
4117:                boolean mailto = false;
4118:                while (exDate != null && ii < 10) {
4119:                    ii++;
4120:                    String attr = null;
4121:                    startPoint = exDate.indexOf(":");
4122:                    if (startPoint != -1) {
4123:                        attr = exDate.substring(0, startPoint);
4124:                        exDate = exDate.substring(startPoint + 1);
4125:                    } else {
4126:                        attr = exDate;
4127:                        exDate = null;
4128:                    }
4129:                    if (!attr.toUpperCase().startsWith("TZID=")) {
4130:                        StringTokenizer st = new StringTokenizer(attr, ",");
4131:                        while (st.hasMoreTokens()) {
4132:                            String exdate = st.nextToken();
4133:                            logger.fine("iCalendarParser.parseExDate() add "
4134:                                    + exdate);
4135:                            iCalEvent.exDateCollection.add(exdate);
4136:                        }
4137:                    }
4138:                }
4139:            }
4140:
4141:            /*
4142:             * Stuff left to parse..
4143:             * @author sfg
4144:             *
4145:             * TODO To change the template for this generated type comment go to
4146:             * Window - Preferences - Java - Code Style - Code Templates
4147:             *
4148:             *
4149:             *
4150:             		Parameter Name: ALTREP
4151:                   Purpose: To specify an alternate text representation for the property
4152:                   value.    Format Definition: The property parameter is defined by the following
4153:                   notation:
4154:                   STUART: ALTREP is used within another parameter..
4155:                   Look at the bits between the = double quotes.
4156:
4157:                   Parameter Name CN
4158:                   ecify the common name to be associated with the
4159:                // calendar user specified by the property.
4160:                // CN=parameter value
4161:            	//ical.setCommonName(extractAttribute(iCalLine,ICalendarParser.CN));
4162:
4163:            }
4164:            else if (iCalLine.startsWith(ICalendarParser.CUTYPE) )
4165:            {
4166:
4167:                Parameter Name: CUTYPE    Purpose: To specify the type of calendar user specified by the
4168:               property.    Format Definition: The property parameter is defined by the following
4169:               notation:      cutypeparam        = "CUTYPE" "="
4170:                                     ("INDIVIDUAL"          ; An individual
4171:                                    / "GROUP"               ; A group of individuals
4172:                                    / "RESOURCE"            ; A physical resource
4173:                                    / "ROOM"                ; A room resource
4174:                                    / "UNKNOWN"             ; Otherwise not known
4175:                                    / x-name                ; Experimental type
4176:                                    / iana-token)           ; Other IANA registered
4177:                                                            ; type
4178:                 ; Default is INDIVIDUAL
4179:                   Description: This parameter can be specified on properties with a
4180:                   CAL-ADDRESS value type. The parameter identifies the type of calendar
4181:                   user specified by the property. If not specified on a property that
4182:                   allows this parameter, the default is INDIVIDUAL.
4183:
4184:            	//ical.setCuType(extractAttribute(iCalLine,ICalendarParser.CUTYPE));
4185:            }
4186:            else if (iCalLine.startsWith("DELEGATED-FROM") )
4187:            {
4188:
4189:               Parameter Name: DELEGATED-FROM
4190:                Purpose: To specify the calendar users that have delegated their
4191:                participation to the calendar user specified by the property.
4192:                Format Definition: The property parameter is defined by the following
4193:                notation:
4194:                delfromparam       = "DELEGATED-FROM" "=" DQUOTE cal-address DQUOTE
4195:             *("," DQUOTE cal-address DQUOTE)
4196:                Description: This parameter can be specified on properties with a
4197:                CAL-ADDRESS value type. This parameter can be specified on a property
4198:                that has a value type of calendar address. This parameter specifies
4199:                those calendar uses that have delegated their participation in a
4200:                group scheduled event or to-do to the calendar user specified by the
4201:                property. The value MUST be a MAILTO URI as defined in [RFC 1738].
4202:                The individual calendar address parameter values MUST each be
4203:                specified in a quoted-string.
4204:                Example:      ATTENDEE;DELEGATED-FROM="MAILTO:jsmith@host.com":MAILTO:
4205:                 jdoe@host.com
4206:
4207:            	//ical.setDelegatedFrom(extractAttribute(iCalLine,ICalendarParser.DELETEGATEDFROM));
4208:            }
4209:            else if (iCalLine.startsWith("DELEGATED-TO") )
4210:            {
4211:
4212:                Parameter Name: DELEGATED-TO
4213:                Purpose: To specify the calendar users to whom the calendar user
4214:                        specified by the property has delegated participation.
4215:                Format Definition: The property parameter is defined by the following
4216:                notation:      deltoparam = "DELEGATED-TO" "=" DQUOTE cal-address DQUOTE
4217:             *("," DQUOTE cal-address DQUOTE)
4218:                Description: This parameter can be specified on properties with a
4219:                            CAL-ADDRESS value type. This parameter specifies those calendar users
4220:                            whom have been delegated participation in a group scheduled event or
4221:                            to-do by the calendar user specified by the property. The value MUST
4222:                            be a MAILTO URI as defined in [RFC 1738]. The individual calendar
4223:                            address parameter values MUST each be specified in a quoted-string.
4224:                Example:      ATTENDEE;DELEGATED-TO="MAILTO:jdoe@host.com","MAILTO:jqpublic@
4225:                            host.com":MAILTO:jsmith@host.com
4226:                   	ical.setDelegatedTo(extractAttribute(iCalLine,ICalendarParser.DELEGATEDTO));
4227:            }
4228:
4229:                    4.2.6 Directory Entry Reference
4230:                            Parameter Name: DIR
4231:                            Purpose: To specify reference to a directory entry associated with
4232:                                    the calendar user specified by the property.
4233:                            Format Definition: The property parameter is defined by the following notation
4234:
4235:                            dirparam   = "DIR" "=" DQUOTE uri DQUOTE
4236:                            Description: This parameter can be specified on properties with a
4237:                                        CAL-ADDRESS value type. The parameter specifies a reference to the
4238:                                        directory entry associated with the calendar user specified by the
4239:                                        property. The parameter value is a URI. The individual URI parameter
4240:                                        values MUST each be specified in a quoted-string.
4241:                            Example:      ORGANIZER;DIR="ldap://host.com:6666/o=eDABC%20Industries,c=3DUS??
4242:                                          (cn=3DBJim%20Dolittle)":MAILTO:jimdo@host1.com
4243:
4244:
4245:
4246:                    4.2.7 Inline Encoding
4247:                    Parameter Name: ENCODING
4248:                    Purpose: To specify an alternate inline encoding for the property value.
4249:                    Format Definition: The property parameter is defined by the following
4250:                        notation:
4251:                    encodingparam      = "ENCODING" "="
4252:                                  ("8BIT" ; "8bit" text encoding is defined in [RFC 2045]
4253:                                                / "BASE64"
4254:                                ; "BASE64" binary encoding format is defined in [RFC 2045]
4255:                                                / iana-token
4256:                                ; Some other IANA registered ICalendar encoding type
4257:                                                / x-name)
4258:                                ; A non-standard, experimental encoding type
4259:                    Description: The property parameter identifies the inline encoding
4260:                           used in a property value. The default encoding is "8BIT",
4261:                           corresponding to a property value consisting of text. The "BASE64"
4262:                           encoding type corresponds to a property value encoded using the
4263:                           "BASE64" encoding defined in [RFC 2045].
4264:                    If the value type parameter is ";VALUE=BINARY", then the inline
4265:                           encoding parameter MUST be specified with the value
4266:                           ";ENCODING=BASE64".
4267:                    Example:      ATTACH;FMTYPE=IMAGE/JPEG;ENCODING=BASE64;VALUE=BINARY:MIICajC
4268:                              CAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDA
4269:                              qBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRw
4270:                              <...remainder of "BASE64" encoded binary data...>
4271:
4272:
4273:                }
4274:
4275:
4276:                    4.2.8 Format Type
4277:                    Parameter Name: FMTTYPE
4278:                    Purpose: To specify the content type of a referenced object.
4279:                    Format Definition: The property parameter is defined by the following
4280:                    notation:      fmttypeparam       = "FMTTYPE" "=" iana-token
4281:                                                ; A IANA registered content type
4282:                                             / x-name
4283:                                                ; A non-standard content type
4284:                    Description: This parameter can be specified on properties that are
4285:                                   used to reference an object. The parameter specifies the content type
4286:                                   of the referenced object. For example, on the "ATTACH" property, a
4287:                                   FTP type URI value does not, by itself, necessarily convey the type
4288:                                   of content associated with the resource. The parameter value MUST be
4289:                                   the TEXT for either an IANA registered content type or a non-standard
4290:                                   content type.
4291:                    Example:       ATTACH;FMTTYPE=application/binary:ftp://domain.com/pub/docs/agenda.doc
4292:
4293:                    4.2.9 Free/Busy Time Type
4294:                    Parameter Name: FBTYPE
4295:                    Purpose: To specify the free or busy time type.
4296:                    Format Definition: The property parameter is defined by the following
4297:                    notation:      fbtypeparam        = "FBTYPE" "=" ("FREE" / "BUSY"
4298:                                / "BUSY-UNAVAILABLE" / "BUSY-TENTATIVE"
4299:                                / x-name
4300:                            ; Some experimental ICalendar data type.
4301:                                / iana-token)
4302:             *
4303:                    Description: The parameter specifies the free or busy time type. The
4304:                       value FREE indicates that the time interval is free for scheduling.
4305:                       The value BUSY indicates that the time interval is busy because one
4306:                       or more events have been scheduled for that interval. The value
4307:                       BUSY-UNAVAILABLE indicates that the time interval is busy and that
4308:                       the interval can not be scheduled. The value BUSY-TENTATIVE indicates
4309:                       that the time interval is busy because one or more events have been
4310:                       tentatively scheduled for that interval. If not specified on a
4311:                       property that allows this parameter, the default is BUSY.
4312:                    Example: The following is an example of this parameter on a FREEBUSY property.
4313:                    FREEBUSY;FBTYPE=BUSY:19980415T133000Z/19980415T170000Z
4314:
4315:                }
4316:                else
4317:                           if (iCalLine.startsWith("LANGUAGE") )
4318:                {
4319:
4320:                   4.2.10 Language
4321:                   Parameter Name: LANGUAGE
4322:                   Purpose: To specify the language for text values in a property or property parameter.
4323:                   Format Definition: The property parameter is defined by the following
4324:                   notation:      languageparam =    "LANGUAGE" "=" language
4325:                        language = <Text identifying a language, as defined in [RFC 1766]>
4326:                   Description: This parameter can be specified on properties with a
4327:                   text value type. The parameter identifies the language of the text in
4328:                   the property or property parameter value. The value of the "language"
4329:                   property parameter is that defined in [RFC 1766].
4330:                   For transport in a MIME entity, the Content-Language header field can
4331:                   be used to set the default language for the entire body part.
4332:                   Otherwise, no default language is assumed.
4333:                    Example:      SUMMARY;LANGUAGE=us-EN:Company Holiday Party
4334:                                    LOCATION;LANGUAGE=en:Germany
4335:                                    LOCATION;LANGUAGE=no:Tyskland
4336:
4337:
4338:                }
4339:
4340:                                         if (iCalLine.startsWith("MEMBER") )
4341:                {
4342:
4343:                    4.2.11  Group or List Membership
4344:                    Parameter Name: MEMBER
4345:                    Purpose: To specify the group or list membership of the calendar user
4346:                    specified by the property.
4347:                    Format Definition: The property parameter is defined by the following
4348:                    notation:      memberparam        = "MEMBER" "=" DQUOTE cal-address DQUOTE
4349:             *("," DQUOTE cal-address DQUOTE)
4350:                    Description: This parameter can be specified on properties with a
4351:                    CAL-ADDRESS value type. The parameter identifies the groups or list
4352:                    membership for the calendar user specified by the property. The
4353:                    parameter value either a single calendar address in a quoted-string
4354:                    or a COMMA character (US-ASCII decimal 44) list of calendar
4355:                    addresses, each in a quoted-string. The individual calendar address
4356:                    parameter values MUST each be specified in a quoted-string.
4357:                    Example:      ATTENDEE;MEMBER="MAILTO:ietf-calsch@imc.org":MAILTO:jsmith@host.com
4358:                    ATTENDEE;MEMBER="MAILTO:projectA@host.com","MAILTO:projectB@host.com":MAILTO:janedoe@host.com
4359:
4360:                }
4361:                else if (iCalLine.startsWith("PARTSTAT") )
4362:                {
4363:
4364:                    4.2.12 Participation Status
4365:                    Parameter Name: PARTSTAT
4366:                    Purpose: To specify the participation status for the calendar user
4367:                    specified by the property.
4368:                    Format Definition: The property parameter is defined by the following
4369:                    notation:      partstatparam      = "PARTSTAT" "="
4370:                                 ("NEEDS-ACTION"        ; Event needs action
4371:                                / "ACCEPTED"            ; Event accepted
4372:                                / "DECLINED"            ; Event declined Dawson & Stenerson
4373:                                / "TENTATIVE"           ; Event tentatively
4374:                                                        ; accepted
4375:                                / "DELEGATED"           ; Event delegated
4376:                                / x-name                ; Experimental status
4377:                                / iana-token)           ; Other IANA registered
4378:                                                        ; status
4379:                     ; These are the participation statuses for a "VEVENT". Default is
4380:                     ; NEEDS-ACTION
4381:                    partstatparam      /= "PARTSTAT" "="
4382:                                 ("NEEDS-ACTION"        ; To-do needs action
4383:                                / "ACCEPTED"            ; To-do accepted
4384:                                / "DECLINED"            ; To-do declined
4385:                                / "TENTATIVE"           ; To-do tentatively
4386:                                                        ; accepted
4387:                                / "DELEGATED"           ; To-do delegated
4388:                                / "COMPLETED"           ; To-do completed.
4389:                                                        ; COMPLETED property has
4390:                                                        ;date/time completed.
4391:                                / "IN-PROCESS"          ; To-do in process of
4392:                                                        ; being completed
4393:                                / x-name                ; Experimental status
4394:                                / iana-token)           ; Other IANA registered
4395:                                                        ; status
4396:                     ; These are the participation statuses for a "VTODO". Default is
4397:                     ; NEEDS-ACTION      partstatparam      /= "PARTSTAT" "="
4398:                                 ("NEEDS-ACTION"        ; Journal needs action
4399:                                / "ACCEPTED"            ; Journal accepted
4400:                                / "DECLINED"            ; Journal declined
4401:                                / x-name                ; Experimental status
4402:                                / iana-token)           ; Other IANA registered
4403:                                                        ; status
4404:                     ; These are the participation statuses for a "VJOURNAL". Default is
4405:                     ; NEEDS-ACTION
4406:                        Description: This parameter can be specified on properties with a
4407:                       CAL-ADDRESS value type. The parameter identifies the participation
4408:                       status for the calendar user specified by the property value. The
4409:                       parameter values differ depending on whether they are associated with
4410:                       a group scheduled "VEVENT", "VTODO" or "VJOURNAL". The values MUST
4411:                       match one of the values allowed for the given calendar component. If
4412:                       not specified on a property that allows this parameter, the default
4413:                       value is NEEDS-ACTION.    Example:      ATTENDEE;PARTSTAT=DECLINED:MAILTO:jsmith@host.com
4414:
4415:                }
4416:                else
4417:
4418:            	if (iCalLine.startsWith("RANGE") )
4419:                {
4420:
4421:                    4.2.13  Recurrence Identifier Range
4422:                    Parameter Name: RANGE
4423:                    Purpose: To specify the effective range of recurrence instances from
4424:                    the instance specified by the recurrence identifier specified by the
4425:                    property.
4426:                    Format Definition: The property parameter is defined by the following
4427:                    notation:      rangeparam = "RANGE" "=" ("THISANDPRIOR"
4428:                        ; To specify all instances prior to the recurrence identifier
4429:                                    / "THISANDFUTURE")
4430:                        ; To specify the instance specified by the recurrence identifier
4431:                        ; and all subsequent recurrence instances
4432:                    Description: The parameter can be specified on a property that
4433:                    specifies a recurrence identifier. The parameter specifies the
4434:                    effective range of recurrence instances that is specified by the
4435:                    property. The effective range is from the recurrence identified
4436:                    specified by the property. If this parameter is not specified an
4437:                    allowed property, then the default range is the single instance
4438:                    specified by the recurrence identifier value of the property. The
4439:                    parameter value can be "THISANDPRIOR" to indicate a range defined by
4440:                    the recurrence identified value of the property and all prior
4441:                    instances. The parameter value can also be "THISANDFUTURE" to
4442:                    indicate a range defined by the recurrence identifier and all
4443:                    subsequent instances.
4444:
4445:                    Example:      RECURRENCE-ID;RANGE=THISANDPRIOR:19980401T133000Z
4446:
4447:
4448:
4449:            		// TODO Should implement this
4450:                }
4451:                else if (iCalLine.startsWith("RELATED") )
4452:                {
4453:
4454:                    4.2.14 Alarm Trigger Relationship
4455:                    Parameter Name: RELATED
4456:                    Purpose: To specify the relationship of the alarm trigger with
4457:                    respect to the start or end of the calendar component.
4458:                    Format Definition: The property parameter is defined by the following
4459:                    notation:      trigrelparam       = "RELATED" "="
4460:                                     ("START"       ; Trigger off of start
4461:                                    / "END")        ; Trigger off of end Dawson & Stenerson
4462:                    Description: The parameter can be specified on properties that
4463:                       specify an alarm trigger with a DURATION value type. The parameter
4464:                       specifies whether the alarm will trigger relative to the start or end
4465:                       of the calendar component. The parameter value START will set the
4466:                       alarm to trigger off the start of the calendar component; the
4467:                       parameter value END will set the alarm to trigger off the end of the
4468:                       calendar component. If the parameter is not specified on an allowable
4469:                       property, then the default is START.
4470:
4471:                    Example:      TRIGGER;RELATED=END:PT5M
4472:
4473:                }
4474:                else if (iCalLine.startsWith("RELTYPE") )
4475:                {
4476:
4477:                    4.2.15 Relationship Type
4478:                    Parameter Name: RELTYPE
4479:                    Purpose: To specify the type of hierarchical relationship associated
4480:                    with the calendar component specified by the property.
4481:                    Format Definition: The property parameter is defined by the following
4482:                    notation:      reltypeparam       = "RELTYPE" "="
4483:                                 ("PARENT"      ; Parent relationship. Default.
4484:                                / "CHILD"       ; Child relationship
4485:                                / "SIBLING      ; Sibling relationship
4486:                                / iana-token    ; Some other IANA registered
4487:                                                ; ICalendar relationship type
4488:                                / x-name)       ; A non-standard, experimental
4489:                                                ; relationship type
4490:                    Description: This parameter can be specified on a property that
4491:                       references another related calendar. The parameter specifies the
4492:                       hierarchical relationship type of the calendar component referenced
4493:                       by the property. The parameter value can be PARENT, to indicate that
4494:                       the referenced calendar component is a superior of calendar
4495:                       component; CHILD to indicate that the referenced calendar component
4496:                       is a subordinate of the calendar component; SIBLING to indicate that
4497:                       the referenced calendar component is a peer of the calendar
4498:                       component. If this parameter is not specified on an allowable
4499:                       property, the default relationship type is PARENT.
4500:                    Example:      RELATED-TO;RELTYPE=SIBLING:<19960401-080045-4000F192713@host.com>
4501:
4502:                }
4503:                else if (iCalLine.startsWith("ROLE") )
4504:                {
4505:
4506:                    4.2.16 Participation Role
4507:                    Parameter Name: ROLE
4508:                    Purpose: To specify the participation role for the calendar user
4509:                    specified by the property.
4510:                    Format Definition: The property parameter is defined by the following
4511:                    notation:      roleparam  = "ROLE" "="
4512:                         ("CHAIR"               ; Indicates chair of the
4513:                                                ; calendar entity
4514:                        / "REQ-PARTICIPANT"     ; Indicates a participant whose
4515:                                                ; participation is required
4516:                        / "OPT-PARTICIPANT"     ; Indicates a participant whose
4517:                                                ; participation is optional
4518:                        / "NON-PARTICIPANT"     ; Indicates a participant who is
4519:                                                ; copied for information
4520:                                                ; purposes only
4521:                        / x-name                ; Experimental role
4522:                        / iana-token)           ; Other IANA role
4523:                    ; Default is REQ-PARTICIPANT
4524:                    Description: This parameter can be specified on properties with a
4525:                    CAL-ADDRESS value type. The parameter specifies the participation
4526:                    role for the calendar user specified by the property in the group
4527:                    schedule calendar component. If not specified on a property that
4528:                    allows this parameter, the default value is REQ-PARTICIPANT.
4529:                    Example:      ATTENDEE;ROLE=CHAIR:MAILTO:mrbig@host.com
4530:
4531:                }
4532:                else if (iCalLine.startsWith("RSVP") )
4533:                {
4534:
4535:                    4.2.17  RSVP Expectation
4536:                    Parameter Name: RSVP
4537:                    Purpose: To specify whether there is an expectation of a favor of a
4538:                    reply from the calendar user specified by the property value.
4539:                    Format Definition: The property parameter is defined by the following
4540:                    notation:      rsvpparam = "RSVP" "=" ("TRUE" / "FALSE")
4541:                        ; Default is FALSE
4542:                    Description: This parameter can be specified on properties with a
4543:                       CAL-ADDRESS value type. The parameter identifies the expectation of a
4544:                       reply from the calendar user specified by the property value. This
4545:                       parameter is used by the "Organizer" to request a participation
4546:                       status reply from an "Attendee" of a group scheduled event or to-do.
4547:                       If not specified on a property that allows this parameter, the
4548:                        default value is FALSE.
4549:                    Example:      ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host.com
4550:
4551:
4552:                }
4553:                else if (iCalLine.startsWith("SENT-BY") )
4554:                {
4555:
4556:                    4.2.18  Sent By
4557:                    Parameter Name: SENT-BY
4558:                    Purpose: To specify the calendar user that is acting on behalf of the
4559:                    calendar user specified by the property.
4560:                    Format Definition: The property parameter is defined by the following
4561:                    notation:      sentbyparam        = "SENT-BY" "=" DQUOTE cal-address DQUOTE
4562:                    Description: This parameter can be specified on properties with a
4563:                   CAL-ADDRESS value type. The parameter specifies the calendar user
4564:                   that is acting on behalf of the calendar user specified by the
4565:                   property. The parameter value MUST be a MAILTO URI as defined in [RFC
4566:                   1738]. The individual calendar address parameter values MUST each be
4567:                   specified in a quoted-string.
4568:                    Example:      ORGANIZER;SENT-BY:"MAILTO:sray@host.com":MAILTO:jsmith@host.com
4569:
4570:                }
4571:                else if (iCalLine.startsWith("VALUE") )
4572:                {
4573:
4574:                    4.2.20 Value Data Types
4575:                    Parameter Name: VALUE
4576:                    Purpose: To explicitly specify the data type format for a property value.
4577:                    Format Definition: The "VALUE" property parameter is defined by the following
4578:                    notation:      valuetypeparam = "VALUE" "=" valuetype      valuetype  = ("BINARY"
4579:                        / "BOOLEAN"
4580:                        / "CAL-ADDRESS"
4581:                        / "DATE"
4582:                        / "DATE-TIME"
4583:                        / "DURATION"
4584:                        / "FLOAT"
4585:                        / "INTEGER"
4586:                        / "PERIOD"
4587:                        / "RECUR"
4588:                        / "TEXT"
4589:                        / "TIME"
4590:                        / "URI"
4591:                        / "UTC-OFFSET"
4592:                        / x-name
4593:                        ; Some experimental ICalendar data type.
4594:                        / iana-token)
4595:                        ; Some other IANA registered ICalendar data type.
4596:                    Description: The parameter specifies the data type and format of the
4597:                       property value. The property values MUST be of a single value type.
4598:                       For example, a "RDATE" property cannot have a combination of DATE-
4599:                       TIME and TIME value types.    If the property's value is the default value type, then this
4600:                       parameter need not be specified. However, if the property's default
4601:                       value type is overridden by some other allowable value type, then
4602:                       this parameter MUST be specified.
4603:
4604:                }
4605:
4606:
4607:                else
4608:
4609:            else if (iCalLine.startsWith("METHOD") )
4610:                {
4611:
4612:                    4.7.2 Method
4613:
4614:                       Property Name: METHOD
4615:
4616:                       Purpose: This property defines the ICalendar object method associated
4617:                       with the calendar object.
4618:
4619:                       Value Type: TEXT
4620:
4621:                       Property Parameters: Non-standard property parameters can be
4622:                       specified on this property.
4623:
4624:                       Conformance: The property can be specified in an ICalendar object.
4625:
4626:                       Description: When used in a MIME message entity, the value of this
4627:                       property MUST be the same as the Content-Type "method" parameter
4628:                       value. This property can only appear once within the ICalendar
4629:                       object. If either the "METHOD" property or the Content-Type "method"
4630:                       parameter is specified, then the other MUST also be specified.
4631:
4632:                       No methods are defined by this specification. This is the subject of
4633:                       other specifications, such as the ICalendar Transport-independent
4634:
4635:                       Interoperability Protocol (iTIP) defined by [ITIP].
4636:
4637:                       If this property is not present in the ICalendar object, then a
4638:                       scheduling transaction MUST NOT be assumed. In such cases, the
4639:                       ICalendar object is merely being used to transport a snapshot of some
4640:                       calendar information; without the intention of conveying a scheduling
4641:                       semantic.
4642:
4643:                       Format Definition: The property is defined by the following notation:
4644:
4645:                         method     = "METHOD" metparam ":" metvalue CRLF
4646:
4647:                         metparam   = *(";" xparam)
4648:
4649:                         metvalue   = iana-token
4650:
4651:                       Example: The following is a hypothetical example of this property to
4652:                       convey that the ICalendar object is a request for a meeting:
4653:
4654:                         METHOD:REQUEST
4655:
4656:                }
4657:
4658:               else if (iCalLine.startsWith("FREEBUSY") )
4659:                {
4660:
4661:                     4.8.2.6 Free/Busy Time
4662:
4663:                       Property Name: FREEBUSY
4664:
4665:                       Purpose: The property defines one or more free or busy time
4666:                       intervals.
4667:
4668:                       Value Type: PERIOD. The date and time values MUST be in an UTC time
4669:                       format.
4670:
4671:                       Property Parameters: Non-standard or free/busy time type property
4672:                       parameters can be specified on this property.
4673:
4674:                       Conformance: The property can be specified in a "VFREEBUSY" calendar
4675:                       component.
4676:
4677:                       Property Parameter: "FBTYPE" and non-standard parameters can be
4678:                       specified on this property.
4679:
4680:                       Description: These time periods can be specified as either a start
4681:                       and end date-time or a start date-time and duration. The date and
4682:                       time MUST be a UTC time format.
4683:
4684:                       "FREEBUSY" properties within the "VFREEBUSY" calendar component
4685:                       SHOULD be sorted in ascending order, based on start time and then end
4686:                       time, with the earliest periods first.
4687:
4688:                       The "FREEBUSY" property can specify more than one value, separated by
4689:                       the COMMA character (US-ASCII decimal 44). In such cases, the
4690:                       "FREEBUSY" property values SHOULD all be of the same "FBTYPE"
4691:                       property parameter type (e.g., all values of a particular "FBTYPE"
4692:                       listed together in a single property).
4693:
4694:                       Format Definition: The property is defined by the following notation:
4695:
4696:                         freebusy   = "FREEBUSY" fbparam ":" fbvalue
4697:                                      CRLF
4698:
4699:                         fbparam    = *(
4700:                                    ; the following is optional,
4701:                                    ; but MUST NOT occur more than once
4702:
4703:                                    (";" fbtypeparam) /
4704:
4705:                                    ; the following is optional,
4706:                                    ; and MAY occur more than once
4707:
4708:                                    (";" xparam)
4709:
4710:                                    )
4711:
4712:                         fbvalue    = period *["," period]
4713:                         ;Time value MUST be in the UTC time format.
4714:
4715:                       Example: The following are some examples of this property:
4716:
4717:                         FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:19970308T160000Z/PT8H30M
4718:
4719:                         FREEBUSY;FBTYPE=FREE:19970308T160000Z/PT3H,19970308T200000Z/PT1H
4720:
4721:                         FREEBUSY;FBTYPE=FREE:19970308T160000Z/PT3H,19970308T200000Z/PT1H,
4722:                          19970308T230000Z/19970309T000000Z
4723:
4724:
4725:                }
4726:
4727:                else if (iCalLine.startsWith("EXRULE") )
4728:                {
4729:
4730:                    4.8.5.2 Exception Rule
4731:
4732:                       Property Name: EXRULE
4733:
4734:                       Purpose: This property defines a rule or repeating pattern for an
4735:                       exception to a recurrence set.
4736:
4737:                       Value Type: RECUR
4738:
4739:                       Property Parameters: Non-standard property parameters can be
4740:                       specified on this property.
4741:
4742:                       Conformance: This property can be specified in "VEVENT", "VTODO" or
4743:                       "VJOURNAL" calendar components.
4744:
4745:                       Description: The exception rule, if specified, is used in computing
4746:                       the recurrence set. The recurrence set is the complete set of
4747:                       recurrence instances for a calendar component. The recurrence set is
4748:                       generated by considering the initial "DTSTART" property along with
4749:                       the "RRULE", "RDATE", "EXDATE" and "EXRULE" properties contained
4750:                       within the ICalendar object. The "DTSTART" defines the first instance
4751:                       in the recurrence set. Multiple instances of the "RRULE" and "EXRULE"
4752:                       properties can also be specified to define more sophisticated
4753:                       recurrence sets. The final recurrence set is generated by gathering
4754:                       all of the start date-times generated by any of the specified "RRULE"
4755:                       and "RDATE" properties, and excluding any start date and times which
4756:                       fall within the union of start date and times generated by any
4757:                       specified "EXRULE" and "EXDATE" properties. This implies that start
4758:                       date and times within exclusion related properties (i.e., "EXDATE"
4759:                       and "EXRULE") take precedence over those specified by inclusion
4760:                       properties (i.e., "RDATE" and "RRULE"). Where duplicate instances are
4761:                       generated by the "RRULE" and "RDATE" properties, only one recurrence
4762:                       is considered. Duplicate instances are ignored.
4763:
4764:                       The "EXRULE" property can be used to exclude the value specified in
4765:                       "DTSTART". However, in such cases the original "DTSTART" date MUST
4766:                       still be maintained by the calendaring and scheduling system because
4767:                       the original "DTSTART" value has inherent usage dependencies by other
4768:                       properties such as the "RECURRENCE-ID".
4769:
4770:                       Format Definition: The property is defined by the following notation:
4771:
4772:                         exrule     = "EXRULE" exrparam ":" recur CRLF
4773:
4774:                         exrparam   = *(";" xparam)
4775:
4776:                       Example: The following are examples of this property. Except every
4777:                       other week, on Tuesday and Thursday for 4 occurrences:
4778:
4779:                         EXRULE:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,TH
4780:
4781:                       Except daily for 10 occurrences:
4782:
4783:                         EXRULE:FREQ=DAILY;COUNT=10
4784:
4785:                       Except yearly in June and July for 8 occurrences:
4786:
4787:                         EXRULE:FREQ=YEARLY;COUNT=8;BYMONTH=6,7
4788:
4789:
4790:                }
4791:                else if (iCalLine.startsWith("RDATE") )
4792:                {
4793:
4794:                    4.8.5.3 Recurrence Date/Times
4795:
4796:                       Property Name: RDATE
4797:
4798:                       Purpose: This property defines the list of date/times for a
4799:                       recurrence set.
4800:
4801:                       Value Type: The default value type for this property is DATE-TIME.
4802:                       The value type can be set to DATE or PERIOD.
4803:
4804:                       Property Parameters: Non-standard, value data type and time zone
4805:                       identifier property parameters can be specified on this property.
4806:
4807:                       Conformance: The property can be specified in "VEVENT", "VTODO",
4808:                       "VJOURNAL" or "VTIMEZONE" calendar components.
4809:
4810:                       Description: This property can appear along with the "RRULE" property
4811:                       to define an aggregate set of repeating occurrences. When they both
4812:                       appear in an ICalendar object, the recurring events are defined by
4813:                       the union of occurrences defined by both the "RDATE" and "RRULE".
4814:
4815:                       The recurrence dates, if specified, are used in computing the
4816:                       recurrence set. The recurrence set is the complete set of recurrence
4817:                       instances for a calendar component. The recurrence set is generated
4818:                       by considering the initial "DTSTART" property along with the "RRULE",
4819:                       "RDATE", "EXDATE" and "EXRULE" properties contained within the
4820:                       ICalendar object. The "DTSTART" property defines the first instance
4821:                       in the recurrence set. Multiple instances of the "RRULE" and "EXRULE"
4822:                       properties can also be specified to define more sophisticated
4823:                       recurrence sets. The final recurrence set is generated by gathering
4824:                       all of the start date/times generated by any of the specified "RRULE"
4825:                       and "RDATE" properties, and excluding any start date/times which fall
4826:                       within the union of start date/times generated by any specified
4827:                       "EXRULE" and "EXDATE" properties. This implies that start date/times
4828:                       within exclusion related properties (i.e., "EXDATE" and "EXRULE")
4829:                       take precedence over those specified by inclusion properties (i.e.,
4830:                       "RDATE" and "RRULE"). Where duplicate instances are generated by the
4831:                       "RRULE" and "RDATE" properties, only one recurrence is considered.
4832:                       Duplicate instances are ignored.
4833:
4834:                       Format Definition: The property is defined by the following notation:
4835:
4836:                         rdate      = "RDATE" rdtparam ":" rdtval *("," rdtval) CRLF
4837:
4838:                         rdtparam   = *(
4839:
4840:                                    ; the following are optional,
4841:                                    ; but MUST NOT occur more than once
4842:
4843:                                    (";" "VALUE" "=" ("DATE-TIME" / "DATE" / "PERIOD")) /
4844:                                    (";" tzidparam) /
4845:
4846:                                    ; the following is optional,
4847:                                    ; and MAY occur more than once
4848:
4849:                                    (";" xparam)
4850:
4851:                                    )
4852:
4853:                         rdtval     = date-time / date / period
4854:                         ;Value MUST match value type
4855:
4856:                       Example: The following are examples of this property:
4857:
4858:                         RDATE:19970714T123000Z
4859:
4860:                         RDATE;TZID=US-EASTERN:19970714T083000
4861:
4862:                         RDATE;VALUE=PERIOD:19960403T020000Z/19960403T040000Z,
4863:                          19960404T010000Z/PT3H
4864:
4865:                         RDATE;VALUE=DATE:19970101,19970120,19970217,19970421
4866:                          19970526,19970704,19970901,19971014,19971128,19971129,19971225
4867:
4868:
4869:                }
4870:                              else if (iCalLine.startsWith("ACTION") )
4871:                {
4872:
4873:                    4.8.6 Alarm Component Properties
4874:
4875:                       The following properties specify alarm information in calendar
4876:                       components.
4877:
4878:                    4.8.6.1 Action
4879:
4880:                       Property Name: ACTION
4881:
4882:                       Purpose: This property defines the action to be invoked when an alarm
4883:                       is triggered.
4884:
4885:                       Value Type: TEXT
4886:
4887:                       Property Parameters: Non-standard property parameters can be
4888:                       specified on this property.
4889:
4890:                       Conformance: This property MUST be specified once in a "VALARM"
4891:                       calendar component.
4892:
4893:                       Description: Each "VALARM" calendar component has a particular type
4894:                       of action associated with it. This property specifies the type of
4895:                       action
4896:
4897:                       Format Definition: The property is defined by the following notation:
4898:
4899:                         action     = "ACTION" actionparam ":" actionvalue CRLF
4900:
4901:                         actionparam        = *(";" xparam)
4902:
4903:                         actionvalue        = "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
4904:                                            / iana-token / x-name
4905:
4906:                       Example: The following are examples of this property in a "VALARM"
4907:                       calendar component:
4908:
4909:                         ACTION:AUDIO
4910:
4911:                         ACTION:DISPLAY
4912:
4913:                         ACTION:PROCEDURE
4914:
4915:                }
4916:
4917:                        else if (iCalLine.startsWith("REPEAT") )
4918:                {
4919:
4920:                    4.8.6.2 Repeat Count
4921:
4922:                       Property Name: REPEAT
4923:
4924:                       Purpose: This property defines the number of time the alarm should be
4925:                       repeated, after the initial trigger.
4926:
4927:                       Value Type: INTEGER
4928:
4929:                       Property Parameters: Non-standard property parameters can be
4930:                       specified on this property.
4931:
4932:                       Conformance: This property can be specified in a "VALARM" calendar
4933:                       component.
4934:
4935:                       Description: If the alarm triggers more than once, then this property
4936:                       MUST be specified along with the "DURATION" property.
4937:
4938:                       Format Definition: The property is defined by the following notation:
4939:
4940:                         repeatcnt  = "REPEAT" repparam ":" integer CRLF
4941:                         ;Default is "0", zero.
4942:
4943:                         repparam   = *(";" xparam)
4944:
4945:                       Example: The following is an example of this property for an alarm
4946:                       that repeats 4 additional times with a 5 minute delay after the
4947:                       initial triggering of the alarm:
4948:
4949:                         REPEAT:4
4950:                         DURATION:PT5M
4951:
4952:
4953:                }
4954:                else if (iCalLine.startsWith("TRIGGER") )
4955:                {
4956:
4957:                        4.8.6.3 Trigger
4958:
4959:                           Property Name: TRIGGER
4960:
4961:                           Purpose: This property specifies when an alarm will trigger.
4962:
4963:                           Value Type: The default value type is DURATION. The value type can be
4964:                           set to a DATE-TIME value type, in which case the value MUST specify a
4965:                           UTC formatted DATE-TIME value.
4966:
4967:                           Property Parameters: Non-standard, value data type, time zone
4968:                           identifier or trigger relationship property parameters can be
4969:                           specified on this property. The trigger relationship property
4970:                           parameter MUST only be specified when the value type is DURATION.
4971:
4972:                           Conformance: This property MUST be specified in the "VALARM" calendar
4973:                           component.
4974:
4975:                           Description: Within the "VALARM" calendar component, this property
4976:                           defines when the alarm will trigger. The default value type is
4977:                           DURATION, specifying a relative time for the trigger of the alarm.
4978:                           The default duration is relative to the start of an event or to-do
4979:                           that the alarm is associated with. The duration can be explicitly set
4980:                           to trigger from either the end or the start of the associated event
4981:                           or to-do with the "RELATED" parameter. A value of START will set the
4982:                           alarm to trigger off the start of the associated event or to-do. A
4983:                           value of END will set the alarm to trigger off the end of the
4984:                           associated event or to-do.
4985:
4986:                           Either a positive or negative duration may be specified for the
4987:                           "TRIGGER" property. An alarm with a positive duration is triggered
4988:                           after the associated start or end of the event or to-do. An alarm
4989:                           with a negative duration is triggered before the associated start or
4990:                           end of the event or to-do.
4991:
4992:                           The "RELATED" property parameter is not valid if the value type of
4993:                           the property is set to DATE-TIME (i.e., for an absolute date and time
4994:                           alarm trigger). If a value type of DATE-TIME is specified, then the
4995:                           property value MUST be specified in the UTC time format. If an
4996:                           absolute trigger is specified on an alarm for a recurring event or
4997:                           to-do, then the alarm will only trigger for the specified absolute
4998:                           date/time, along with any specified repeating instances.
4999:
5000:                           If the trigger is set relative to START, then the "DTSTART" property
5001:                           MUST be present in the associated "VEVENT" or "VTODO" calendar
5002:                           component. If an alarm is specified for an event with the trigger set
5003:                           relative to the END, then the "DTEND" property or the "DSTART" and
5004:                           "DURATION' properties MUST be present in the associated "VEVENT"
5005:                           calendar component. If the alarm is specified for a to-do with a
5006:                           trigger set relative to the END, then either the "DUE" property or
5007:                           the "DSTART" and "DURATION' properties MUST be present in the
5008:                           associated "VTODO" calendar component.
5009:
5010:                           Alarms specified in an event or to-do which is defined in terms of a
5011:                           DATE value type will be triggered relative to 00:00:00 UTC on the
5012:                           specified date. For example, if "DTSTART:19980205, then the duration
5013:                           trigger will be relative to19980205T000000Z.
5014:
5015:                           Format Definition: The property is defined by the following notation:
5016:
5017:                             trigger    = "TRIGGER" (trigrel / trigabs)
5018:
5019:                             trigrel    = *(
5020:
5021:                                        ; the following are optional,
5022:                                        ; but MUST NOT occur more than once
5023:
5024:                                          (";" "VALUE" "=" "DURATION") /
5025:                                          (";" trigrelparam) /
5026:
5027:                                        ; the following is optional,
5028:                                        ; and MAY occur more than once
5029:
5030:                                          (";" xparam)
5031:                                          ) ":"  dur-value
5032:
5033:                             trigabs    = 1*(
5034:
5035:                                        ; the following is REQUIRED,
5036:                                        ; but MUST NOT occur more than once
5037:
5038:                                          (";" "VALUE" "=" "DATE-TIME") /
5039:
5040:                                        ; the following is optional,
5041:                                        ; and MAY occur more than once
5042:
5043:                                          (";" xparam)
5044:
5045:                                          ) ":" date-time
5046:
5047:                           Example: A trigger set 15 minutes prior to the start of the event or
5048:                           to-do.
5049:
5050:                             TRIGGER:-P15M
5051:
5052:                           A trigger set 5 minutes after the end of the event or to-do.
5053:
5054:                             TRIGGER;RELATED=END:P5M
5055:
5056:                           A trigger set to an absolute date/time.
5057:
5058:                             TRIGGER;VALUE=DATE-TIME:19980101T050000Z
5059:
5060:                }
5061:
5062:
5063:             */
5064:
5065:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.