src/net/fortuna/ical4j/model/component/VJournal.java

changeset 0
fb9019fb1bf7
child 3
73bdfa70b04e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/net/fortuna/ical4j/model/component/VJournal.java	Tue Feb 10 18:12:00 2015 +0100
     1.3 @@ -0,0 +1,543 @@
     1.4 +/**
     1.5 + * Copyright (c) 2012, Ben Fortuna
     1.6 + * All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + *
    1.12 + *  o Redistributions of source code must retain the above copyright
    1.13 + * notice, this list of conditions and the following disclaimer.
    1.14 + *
    1.15 + *  o Redistributions in binary form must reproduce the above copyright
    1.16 + * notice, this list of conditions and the following disclaimer in the
    1.17 + * documentation and/or other materials provided with the distribution.
    1.18 + *
    1.19 + *  o Neither the name of Ben Fortuna nor the names of any other contributors
    1.20 + * may be used to endorse or promote products derived from this software
    1.21 + * without specific prior written permission.
    1.22 + *
    1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.25 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.26 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    1.27 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.28 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.29 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.30 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.31 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.32 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.33 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.34 + */
    1.35 +package net.fortuna.ical4j.model.component;
    1.36 +
    1.37 +import java.util.HashMap;
    1.38 +import java.util.Map;
    1.39 +
    1.40 +import net.fortuna.ical4j.model.Date;
    1.41 +import net.fortuna.ical4j.model.Property;
    1.42 +import net.fortuna.ical4j.model.PropertyList;
    1.43 +import net.fortuna.ical4j.model.ValidationException;
    1.44 +import net.fortuna.ical4j.model.Validator;
    1.45 +import net.fortuna.ical4j.model.property.Clazz;
    1.46 +import net.fortuna.ical4j.model.property.Created;
    1.47 +import net.fortuna.ical4j.model.property.Description;
    1.48 +import net.fortuna.ical4j.model.property.DtStamp;
    1.49 +import net.fortuna.ical4j.model.property.DtStart;
    1.50 +import net.fortuna.ical4j.model.property.LastModified;
    1.51 +import net.fortuna.ical4j.model.property.Method;
    1.52 +import net.fortuna.ical4j.model.property.Organizer;
    1.53 +import net.fortuna.ical4j.model.property.RecurrenceId;
    1.54 +import net.fortuna.ical4j.model.property.Sequence;
    1.55 +import net.fortuna.ical4j.model.property.Status;
    1.56 +import net.fortuna.ical4j.model.property.Summary;
    1.57 +import net.fortuna.ical4j.model.property.Uid;
    1.58 +import net.fortuna.ical4j.model.property.Url;
    1.59 +import net.fortuna.ical4j.util.CompatibilityHints;
    1.60 +import net.fortuna.ical4j.util.PropertyValidator;
    1.61 +
    1.62 +/**
    1.63 + * $Id$ [Apr 5, 2004]
    1.64 + *
    1.65 + * Defines an iCalendar VJOURNAL component.
    1.66 + *
    1.67 + * <pre>
    1.68 + *    4.6.3 Journal Component
    1.69 + *
    1.70 + *       Component Name: VJOURNAL
    1.71 + *
    1.72 + *       Purpose: Provide a grouping of component properties that describe a
    1.73 + *       journal entry.
    1.74 + *
    1.75 + *       Formal Definition: A &quot;VJOURNAL&quot; calendar component is defined by the
    1.76 + *       following notation:
    1.77 + *
    1.78 + *         journalc   = &quot;BEGIN&quot; &quot;:&quot; &quot;VJOURNAL&quot; CRLF
    1.79 + *                      jourprop
    1.80 + *                      &quot;END&quot; &quot;:&quot; &quot;VJOURNAL&quot; CRLF
    1.81 + *
    1.82 + *         jourprop   = *(
    1.83 + *
    1.84 + *                    ; the following are optional,
    1.85 + *                    ; but MUST NOT occur more than once
    1.86 + *
    1.87 + *                    class / created / description / dtstart / dtstamp /
    1.88 + *                    last-mod / organizer / recurid / seq / status /
    1.89 + *                    summary / uid / url /
    1.90 + *
    1.91 + *                    ; the following are optional,
    1.92 + *                    ; and MAY occur more than once
    1.93 + *
    1.94 + *                    attach / attendee / categories / comment /
    1.95 + *                    contact / exdate / exrule / related / rdate /
    1.96 + *                    rrule / rstatus / x-prop
    1.97 + *
    1.98 + *                    )
    1.99 + * </pre>
   1.100 + *
   1.101 + * Example 1 - Creating a journal associated with an event:
   1.102 + *
   1.103 + * <pre><code>
   1.104 + * DtStart meetingDate = (DtStart) meeting.getProperties().getProperty(
   1.105 + *         Property.DTSTART);
   1.106 + *
   1.107 + * VJournal minutes = new VJournal(meetingDate.getTime(),
   1.108 + *         &quot;Progress Meeting - Minutes&quot;);
   1.109 + *
   1.110 + * // add timezone information..
   1.111 + * TzId tzParam = meetingDate.getParameters().getParmaeter(Parameter.TZID);
   1.112 + * minutes.getProperties().getProperty(Property.DTSTART).getParameters().add(
   1.113 + *         tzParam);
   1.114 + *
   1.115 + * // add description..
   1.116 + * minutes.getProperties().add(new Description(&quot;1. Agenda.., 2. Action Items..&quot;));
   1.117 + * </code></pre>
   1.118 + *
   1.119 + * @author Ben Fortuna
   1.120 + */
   1.121 +public class VJournal extends CalendarComponent {
   1.122 +
   1.123 +    private static final long serialVersionUID = -7635140949183238830L;
   1.124 +
   1.125 +    private final Map methodValidators = new HashMap();
   1.126 +    {
   1.127 +        methodValidators.put(Method.ADD, new AddValidator());
   1.128 +        methodValidators.put(Method.CANCEL, new CancelValidator());
   1.129 +        methodValidators.put(Method.PUBLISH, new PublishValidator());
   1.130 +    }
   1.131 +    
   1.132 +    /**
   1.133 +     * Default constructor.
   1.134 +     */
   1.135 +    public VJournal() {
   1.136 +        super(VJOURNAL);
   1.137 +        getProperties().add(new DtStamp());
   1.138 +    }
   1.139 +
   1.140 +    /**
   1.141 +     * Constructor.
   1.142 +     * @param properties a list of properties
   1.143 +     */
   1.144 +    public VJournal(final PropertyList properties) {
   1.145 +        super(VJOURNAL, properties);
   1.146 +    }
   1.147 +
   1.148 +    /**
   1.149 +     * Constructs a new VJOURNAL instance associated with the specified time with the specified summary.
   1.150 +     * @param start the date the journal entry is associated with
   1.151 +     * @param summary the journal summary
   1.152 +     */
   1.153 +    public VJournal(final Date start, final String summary) {
   1.154 +        this();
   1.155 +        getProperties().add(new DtStart(start));
   1.156 +        getProperties().add(new Summary(summary));
   1.157 +    }
   1.158 +
   1.159 +    /**
   1.160 +     * {@inheritDoc}
   1.161 +     */
   1.162 +    public final void validate(final boolean recurse)
   1.163 +            throws ValidationException {
   1.164 +
   1.165 +        if (!CompatibilityHints
   1.166 +                .isHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION)) {
   1.167 +
   1.168 +            // From "4.8.4.7 Unique Identifier":
   1.169 +            // Conformance: The property MUST be specified in the "VEVENT", "VTODO",
   1.170 +            // "VJOURNAL" or "VFREEBUSY" calendar components.
   1.171 +            PropertyValidator.getInstance().assertOne(Property.UID,
   1.172 +                    getProperties());
   1.173 +
   1.174 +            // From "4.8.7.2 Date/Time Stamp":
   1.175 +            // Conformance: This property MUST be included in the "VEVENT", "VTODO",
   1.176 +            // "VJOURNAL" or "VFREEBUSY" calendar components.
   1.177 +            PropertyValidator.getInstance().assertOne(Property.DTSTAMP,
   1.178 +                    getProperties());
   1.179 +        }
   1.180 +
   1.181 +        /*
   1.182 +         * ; the following are optional, ; but MUST NOT occur more than once class / created / description / dtstart /
   1.183 +         * dtstamp / last-mod / organizer / recurid / seq / status / summary / uid / url /
   1.184 +         */
   1.185 +        PropertyValidator.getInstance().assertOneOrLess(Property.CLASS,
   1.186 +                getProperties());
   1.187 +        PropertyValidator.getInstance().assertOneOrLess(Property.CREATED,
   1.188 +                getProperties());
   1.189 +        PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION,
   1.190 +                getProperties());
   1.191 +        PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART,
   1.192 +                getProperties());
   1.193 +        PropertyValidator.getInstance().assertOneOrLess(Property.DTSTAMP,
   1.194 +                getProperties());
   1.195 +        PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED,
   1.196 +                getProperties());
   1.197 +        PropertyValidator.getInstance().assertOneOrLess(Property.ORGANIZER,
   1.198 +                getProperties());
   1.199 +        PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID,
   1.200 +                getProperties());
   1.201 +        PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE,
   1.202 +                getProperties());
   1.203 +        PropertyValidator.getInstance().assertOneOrLess(Property.STATUS,
   1.204 +                getProperties());
   1.205 +        PropertyValidator.getInstance().assertOneOrLess(Property.SUMMARY,
   1.206 +                getProperties());
   1.207 +        PropertyValidator.getInstance().assertOneOrLess(Property.UID,
   1.208 +                getProperties());
   1.209 +        PropertyValidator.getInstance().assertOneOrLess(Property.URL,
   1.210 +                getProperties());
   1.211 +
   1.212 +        final Status status = (Status) getProperty(Property.STATUS);
   1.213 +        if (status != null && !Status.VJOURNAL_DRAFT.getValue().equals(status.getValue())
   1.214 +                && !Status.VJOURNAL_FINAL.getValue().equals(status.getValue())
   1.215 +                && !Status.VJOURNAL_CANCELLED.getValue().equals(status.getValue())) {
   1.216 +            throw new ValidationException("Status property ["
   1.217 +                    + status.toString() + "] may not occur in VJOURNAL");
   1.218 +        }
   1.219 +
   1.220 +        /*
   1.221 +         * ; the following are optional, ; and MAY occur more than once attach / attendee / categories / comment /
   1.222 +         * contact / exdate / exrule / related / rdate / rrule / rstatus / x-prop
   1.223 +         */
   1.224 +
   1.225 +        if (recurse) {
   1.226 +            validateProperties();
   1.227 +        }
   1.228 +    }
   1.229 +
   1.230 +    /**
   1.231 +     * {@inheritDoc}
   1.232 +     */
   1.233 +    protected Validator getValidator(Method method) {
   1.234 +        return (Validator) methodValidators.get(method);
   1.235 +    }
   1.236 +
   1.237 +    /**
   1.238 +     * <pre>
   1.239 +     * Component/Property  Presence
   1.240 +     * ------------------- ----------------------------------------------
   1.241 +     * METHOD               1      MUST be "ADD"
   1.242 +     * VJOURNAL             1
   1.243 +     *     DESCRIPTION      1      Can be null.
   1.244 +     *     DTSTAMP          1
   1.245 +     *     DTSTART          1
   1.246 +     *     ORGANIZER        1
   1.247 +     *     SEQUENCE         1      MUST be greater than 0
   1.248 +     *     UID              1      MUST match that of the original journal
   1.249 +     * 
   1.250 +     *     ATTACH           0+
   1.251 +     *     CATEGORIES       0 or 1 This property MAY contain a list of values
   1.252 +     *     CLASS            0 or 1
   1.253 +     *     COMMENT          0 or 1
   1.254 +     *     CONTACT          0+
   1.255 +     *     CREATED          0 or 1
   1.256 +     *     EXDATE           0+
   1.257 +     *     EXRULE           0+
   1.258 +     *     LAST-MODIFIED    0 or 1
   1.259 +     *     RDATE            0+
   1.260 +     *     RELATED-TO       0+
   1.261 +     *     RRULE            0+
   1.262 +     *     STATUS           0 or 1  MAY be one of DRAFT/FINAL/CANCELLED
   1.263 +     *     SUMMARY          0 or 1  Can be null
   1.264 +     *     URL              0 or 1
   1.265 +     *     X-PROPERTY       0+
   1.266 +     * 
   1.267 +     *     ATTENDEE         0
   1.268 +     *     RECURRENCE-ID    0
   1.269 +     * 
   1.270 +     * VALARM               0+
   1.271 +     * VTIMEZONE            0 or 1 MUST be present if any date/time refers to
   1.272 +     *                             a timezone
   1.273 +     * X-COMPONENT          0+
   1.274 +     * 
   1.275 +     * VEVENT               0
   1.276 +     * VFREEBUSY            0
   1.277 +     * VTODO                0
   1.278 +     * </pre>
   1.279 +     * 
   1.280 +     */
   1.281 +    private class AddValidator implements Validator {
   1.282 +        
   1.283 +		private static final long serialVersionUID = 1L;
   1.284 +        
   1.285 +        public void validate() throws ValidationException {
   1.286 +            PropertyValidator.getInstance().assertOne(Property.DESCRIPTION, getProperties());
   1.287 +            PropertyValidator.getInstance().assertOne(Property.DTSTAMP, getProperties());
   1.288 +            PropertyValidator.getInstance().assertOne(Property.DTSTART, getProperties());
   1.289 +            PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties());
   1.290 +            PropertyValidator.getInstance().assertOne(Property.SEQUENCE, getProperties());
   1.291 +            PropertyValidator.getInstance().assertOne(Property.UID, getProperties());
   1.292 +            
   1.293 +            PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties());
   1.294 +            PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties());
   1.295 +            PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties());
   1.296 +            PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties());
   1.297 +            PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED, getProperties());
   1.298 +            PropertyValidator.getInstance().assertOneOrLess(Property.STATUS, getProperties());
   1.299 +            PropertyValidator.getInstance().assertOneOrLess(Property.SUMMARY, getProperties());
   1.300 +            PropertyValidator.getInstance().assertOneOrLess(Property.URL, getProperties());
   1.301 +            
   1.302 +            PropertyValidator.getInstance().assertNone(Property.ATTENDEE, getProperties());
   1.303 +            PropertyValidator.getInstance().assertNone(Property.RECURRENCE_ID, getProperties());
   1.304 +        }
   1.305 +    }
   1.306 +    
   1.307 +    /**
   1.308 +     * <pre>
   1.309 +     * Component/Property   Presence
   1.310 +     * -------------------  ---------------------------------------------
   1.311 +     * METHOD               1       MUST be "CANCEL"
   1.312 +     * VJOURNAL             1+      All MUST have the same UID
   1.313 +     *     DTSTAMP          1
   1.314 +     *     ORGANIZER        1
   1.315 +     *     SEQUENCE         1
   1.316 +     *     UID              1       MUST be the UID of the original REQUEST
   1.317 +     * 
   1.318 +     *     ATTACH           0+
   1.319 +     *     ATTENDEE         0+
   1.320 +     *     CATEGORIES       0 or 1  This property MAY contain a list of values
   1.321 +     *     CLASS            0 or 1
   1.322 +     *     COMMENT          0 or 1
   1.323 +     *     CONTACT          0+
   1.324 +     *     CREATED          0 or 1
   1.325 +     *     DESCRIPTION      0 or 1
   1.326 +     *     DTSTART          0 or 1
   1.327 +     *     EXDATE           0+
   1.328 +     *     EXRULE           0+
   1.329 +     *     LAST-MODIFIED    0 or 1
   1.330 +     *     RDATE            0+
   1.331 +     *     RECURRENCE-ID    0 or 1  only if referring to an instance of a
   1.332 +     *                              recurring calendar component.  Otherwise
   1.333 +     *                              it MUST NOT be present.
   1.334 +     *     RELATED-TO       0+
   1.335 +     *     RRULE            0+
   1.336 +     *     STATUS           0 or 1  MAY be present, must be "CANCELLED" if
   1.337 +     *                              present
   1.338 +     *     SUMMARY          0 or 1
   1.339 +     *     URL              0 or 1
   1.340 +     *     X-PROPERTY       0+
   1.341 +     * 
   1.342 +     *     REQUEST-STATUS   0
   1.343 +     * 
   1.344 +     * VTIMEZONE            0+      MUST be present if any date/time refers to
   1.345 +     *                              a timezone
   1.346 +     * X-COMPONENT          0+
   1.347 +     * VALARM               0
   1.348 +     * VEVENT               0
   1.349 +     * VFREEBUSY            0
   1.350 +     * VTODO                0
   1.351 +     * </pre>
   1.352 +     * 
   1.353 +     */
   1.354 +    private class CancelValidator implements Validator {
   1.355 +        
   1.356 +		private static final long serialVersionUID = 1L;
   1.357 +
   1.358 +        public void validate() throws ValidationException {
   1.359 +            PropertyValidator.getInstance().assertOne(Property.DTSTAMP, getProperties());
   1.360 +            PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties());
   1.361 +            PropertyValidator.getInstance().assertOne(Property.SEQUENCE, getProperties());
   1.362 +            PropertyValidator.getInstance().assertOne(Property.UID, getProperties());
   1.363 +            
   1.364 +            PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties());
   1.365 +            PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties());
   1.366 +            PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties());
   1.367 +            PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties());
   1.368 +            PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties());
   1.369 +            PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties());
   1.370 +            PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED, getProperties());
   1.371 +            PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID, getProperties());
   1.372 +            PropertyValidator.getInstance().assertOneOrLess(Property.STATUS, getProperties());
   1.373 +            PropertyValidator.getInstance().assertOneOrLess(Property.SUMMARY, getProperties());
   1.374 +            PropertyValidator.getInstance().assertOneOrLess(Property.URL, getProperties());
   1.375 +            
   1.376 +            PropertyValidator.getInstance().assertNone(Property.REQUEST_STATUS, getProperties());
   1.377 +        }
   1.378 +    }
   1.379 +    
   1.380 +    /**
   1.381 +     * <pre>
   1.382 +     * Component/Property  Presence
   1.383 +     * ------------------- ----------------------------------------------
   1.384 +     * METHOD               1       MUST be "PUBLISH"
   1.385 +     * VJOURNAL             1+
   1.386 +     *     DESCRIPTION      1       Can be null.
   1.387 +     *     DTSTAMP          1
   1.388 +     *     DTSTART          1
   1.389 +     *     ORGANIZER        1
   1.390 +     *     UID              1
   1.391 +     * 
   1.392 +     *     ATTACH           0+
   1.393 +     *     CATEGORIES       0 or 1  This property MAY contain a list of values
   1.394 +     *     CLASS            0 or 1
   1.395 +     *     COMMENT          0 or 1
   1.396 +     *     CONTACT          0+
   1.397 +     *     CREATED          0 or 1
   1.398 +     *     EXDATE           0+
   1.399 +     *     EXRULE           0+
   1.400 +     *     LAST-MODIFIED    0 or 1
   1.401 +     *     RDATE            0+
   1.402 +     *     RECURRENCE-ID    0 or 1  MUST only if referring to an instance of a
   1.403 +     *                              recurring calendar component.  Otherwise
   1.404 +     *                              it MUST NOT be present.
   1.405 +     *     RELATED-TO       0+
   1.406 +     *     RRULE            0+
   1.407 +     *     SEQUENCE         0 or 1  MUST echo the original SEQUENCE number.
   1.408 +     *                              MUST be present if non-zero. MAY be
   1.409 +     *                              present if zero.
   1.410 +     *     STATUS           0 or 1  MAY be one of DRAFT/FINAL/CANCELLED
   1.411 +     *     SUMMARY          0 or 1  Can be null
   1.412 +     *     URL              0 or 1
   1.413 +     *     X-PROPERTY       0+
   1.414 +     * 
   1.415 +     *     ATTENDEE         0
   1.416 +     * 
   1.417 +     * VALARM               0+
   1.418 +     * VTIMEZONE            0+      MUST be present if any date/time refers to
   1.419 +     *                              a timezone
   1.420 +     * X-COMPONENT          0+
   1.421 +     * 
   1.422 +     * VEVENT               0
   1.423 +     * VFREEBUSY            0
   1.424 +     * VTODO                0
   1.425 +     * </pre>
   1.426 +     * 
   1.427 +     */
   1.428 +    private class PublishValidator implements Validator {
   1.429 +        
   1.430 +		private static final long serialVersionUID = 1L;
   1.431 +
   1.432 +        public void validate() throws ValidationException {
   1.433 +            PropertyValidator.getInstance().assertOne(Property.DESCRIPTION, getProperties());
   1.434 +            PropertyValidator.getInstance().assertOne(Property.DTSTAMP, getProperties());
   1.435 +            PropertyValidator.getInstance().assertOne(Property.DTSTART, getProperties());
   1.436 +            PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties());
   1.437 +            PropertyValidator.getInstance().assertOne(Property.UID, getProperties());
   1.438 +            
   1.439 +            PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties());
   1.440 +            PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties());
   1.441 +            PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties());
   1.442 +            PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties());
   1.443 +            PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED, getProperties());
   1.444 +            PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID, getProperties());
   1.445 +            PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties());
   1.446 +            PropertyValidator.getInstance().assertOneOrLess(Property.STATUS, getProperties());
   1.447 +            PropertyValidator.getInstance().assertOneOrLess(Property.SUMMARY, getProperties());
   1.448 +            PropertyValidator.getInstance().assertOneOrLess(Property.URL, getProperties());
   1.449 +            
   1.450 +            PropertyValidator.getInstance().assertNone(Property.ATTENDEE, getProperties());
   1.451 +        }
   1.452 +    }
   1.453 +    
   1.454 +    /**
   1.455 +     * @return the optional access classification property for a journal entry
   1.456 +     */
   1.457 +    public final Clazz getClassification() {
   1.458 +        return (Clazz) getProperty(Property.CLASS);
   1.459 +    }
   1.460 +
   1.461 +    /**
   1.462 +     * @return the optional creation-time property for a journal entry
   1.463 +     */
   1.464 +    public final Created getCreated() {
   1.465 +        return (Created) getProperty(Property.CREATED);
   1.466 +    }
   1.467 +
   1.468 +    /**
   1.469 +     * @return the optional description property for a journal entry
   1.470 +     */
   1.471 +    public final Description getDescription() {
   1.472 +        return (Description) getProperty(Property.DESCRIPTION);
   1.473 +    }
   1.474 +
   1.475 +    /**
   1.476 +     * Convenience method to pull the DTSTART out of the property list.
   1.477 +     * @return The DtStart object representation of the start Date
   1.478 +     */
   1.479 +    public final DtStart getStartDate() {
   1.480 +        return (DtStart) getProperty(Property.DTSTART);
   1.481 +    }
   1.482 +
   1.483 +    /**
   1.484 +     * @return the optional last-modified property for a journal entry
   1.485 +     */
   1.486 +    public final LastModified getLastModified() {
   1.487 +        return (LastModified) getProperty(Property.LAST_MODIFIED);
   1.488 +    }
   1.489 +
   1.490 +    /**
   1.491 +     * @return the optional organizer property for a journal entry
   1.492 +     */
   1.493 +    public final Organizer getOrganizer() {
   1.494 +        return (Organizer) getProperty(Property.ORGANIZER);
   1.495 +    }
   1.496 +
   1.497 +    /**
   1.498 +     * @return the optional date-stamp property
   1.499 +     */
   1.500 +    public final DtStamp getDateStamp() {
   1.501 +        return (DtStamp) getProperty(Property.DTSTAMP);
   1.502 +    }
   1.503 +
   1.504 +    /**
   1.505 +     * @return the optional sequence number property for a journal entry
   1.506 +     */
   1.507 +    public final Sequence getSequence() {
   1.508 +        return (Sequence) getProperty(Property.SEQUENCE);
   1.509 +    }
   1.510 +
   1.511 +    /**
   1.512 +     * @return the optional status property for a journal entry
   1.513 +     */
   1.514 +    public final Status getStatus() {
   1.515 +        return (Status) getProperty(Property.STATUS);
   1.516 +    }
   1.517 +
   1.518 +    /**
   1.519 +     * @return the optional summary property for a journal entry
   1.520 +     */
   1.521 +    public final Summary getSummary() {
   1.522 +        return (Summary) getProperty(Property.SUMMARY);
   1.523 +    }
   1.524 +
   1.525 +    /**
   1.526 +     * @return the optional URL property for a journal entry
   1.527 +     */
   1.528 +    public final Url getUrl() {
   1.529 +        return (Url) getProperty(Property.URL);
   1.530 +    }
   1.531 +
   1.532 +    /**
   1.533 +     * @return the optional recurrence identifier property for a journal entry
   1.534 +     */
   1.535 +    public final RecurrenceId getRecurrenceId() {
   1.536 +        return (RecurrenceId) getProperty(Property.RECURRENCE_ID);
   1.537 +    }
   1.538 +
   1.539 +    /**
   1.540 +     * Returns the UID property of this component if available.
   1.541 +     * @return a Uid instance, or null if no UID property exists
   1.542 +     */
   1.543 +    public final Uid getUid() {
   1.544 +        return (Uid) getProperty(Property.UID);
   1.545 +    }
   1.546 +}

mercurial