src/net/fortuna/ical4j/model/property/RecurrenceId.java

branch
ICAL4J_EMBED_1
changeset 15
cc93757aeca3
parent 14
5ae3e5665a0b
child 18
6dcaece8ec41
     1.1 --- a/src/net/fortuna/ical4j/model/property/RecurrenceId.java	Thu Feb 12 18:02:00 2015 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,221 +0,0 @@
     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.property;
    1.36 -
    1.37 -import java.text.ParseException;
    1.38 -
    1.39 -import net.fortuna.ical4j.model.Date;
    1.40 -import net.fortuna.ical4j.model.DateTime;
    1.41 -import net.fortuna.ical4j.model.Parameter;
    1.42 -import net.fortuna.ical4j.model.ParameterList;
    1.43 -import net.fortuna.ical4j.model.PropertyFactoryImpl;
    1.44 -import net.fortuna.ical4j.model.TimeZone;
    1.45 -import net.fortuna.ical4j.model.ValidationException;
    1.46 -import net.fortuna.ical4j.util.ParameterValidator;
    1.47 -
    1.48 -/**
    1.49 - * $Id$
    1.50 - * 
    1.51 - * Created: [Apr 6, 2004]
    1.52 - *
    1.53 - * Defines a RECURRENCE-ID iCalendar component property.
    1.54 - * 
    1.55 - * <pre>
    1.56 - *     4.8.4.4 Recurrence ID
    1.57 - *     
    1.58 - *        Property Name: RECURRENCE-ID
    1.59 - *     
    1.60 - *        Purpose: This property is used in conjunction with the &quot;UID&quot; and
    1.61 - *        &quot;SEQUENCE&quot; property to identify a specific instance of a recurring
    1.62 - *        &quot;VEVENT&quot;, &quot;VTODO&quot; or &quot;VJOURNAL&quot; calendar component. The property
    1.63 - *        value is the effective value of the &quot;DTSTART&quot; property of the
    1.64 - *        recurrence instance.
    1.65 - *     
    1.66 - *        Value Type: The default value type for this property is DATE-TIME.
    1.67 - *        The time format can be any of the valid forms defined for a DATE-TIME
    1.68 - *        value type. See DATE-TIME value type definition for specific
    1.69 - *        interpretations of the various forms. The value type can be set to
    1.70 - *        DATE.
    1.71 - *     
    1.72 - *        Property Parameters: Non-standard property, value data type, time
    1.73 - *        zone identifier and recurrence identifier range parameters can be
    1.74 - *        specified on this property.
    1.75 - *     
    1.76 - *        Conformance: This property can be specified in an iCalendar object
    1.77 - *        containing a recurring calendar component.
    1.78 - *     
    1.79 - *        Description: The full range of calendar components specified by a
    1.80 - *        recurrence set is referenced by referring to just the &quot;UID&quot; property
    1.81 - *        value corresponding to the calendar component. The &quot;RECURRENCE-ID&quot;
    1.82 - *        property allows the reference to an individual instance within the
    1.83 - *        recurrence set.
    1.84 - *     
    1.85 - *        If the value of the &quot;DTSTART&quot; property is a DATE type value, then the
    1.86 - *        value MUST be the calendar date for the recurrence instance.
    1.87 - *     
    1.88 - *        The date/time value is set to the time when the original recurrence
    1.89 - *        instance would occur; meaning that if the intent is to change a
    1.90 - *        Friday meeting to Thursday, the date/time is still set to the
    1.91 - *        original Friday meeting.
    1.92 - *     
    1.93 - *        The &quot;RECURRENCE-ID&quot; property is used in conjunction with the &quot;UID&quot;
    1.94 - *        and &quot;SEQUENCE&quot; property to identify a particular instance of a
    1.95 - *        recurring event, to-do or journal. For a given pair of &quot;UID&quot; and
    1.96 - *        &quot;SEQUENCE&quot; property values, the &quot;RECURRENCE-ID&quot; value for a
    1.97 - *        recurrence instance is fixed. When the definition of the recurrence
    1.98 - *        set for a calendar component changes, and hence the &quot;SEQUENCE&quot;
    1.99 - *        property value changes, the &quot;RECURRENCE-ID&quot; for a given recurrence
   1.100 - *        instance might also change.The &quot;RANGE&quot; parameter is used to specify
   1.101 - *        the effective range of recurrence instances from the instance
   1.102 - *        specified by the &quot;RECURRENCE-ID&quot; property value. The default value
   1.103 - *        for the range parameter is the single recurrence instance only. The
   1.104 - *        value can also be &quot;THISANDPRIOR&quot; to indicate a range defined by the
   1.105 - *        given recurrence instance and all prior instances or the value can be
   1.106 - *        &quot;THISANDFUTURE&quot; to indicate a range defined by the given recurrence
   1.107 - *        instance and all subsequent instances.
   1.108 - *     
   1.109 - *        Format Definition: The property is defined by the following notation:
   1.110 - *     
   1.111 - *          recurid    = &quot;RECURRENCE-ID&quot; ridparam &quot;:&quot; ridval CRLF
   1.112 - *     
   1.113 - *          ridparam   = *(
   1.114 - *     
   1.115 - *                     ; the following are optional,
   1.116 - *                     ; but MUST NOT occur more than once
   1.117 - *     
   1.118 - *                     (&quot;;&quot; &quot;VALUE&quot; &quot;=&quot; (&quot;DATE-TIME&quot; / &quot;DATE)) /
   1.119 - *                     (&quot;;&quot; tzidparam) / (&quot;;&quot; rangeparam) /
   1.120 - *     
   1.121 - *                     ; the following is optional,
   1.122 - *                     ; and MAY occur more than once
   1.123 - *     
   1.124 - *                     (&quot;;&quot; xparam)
   1.125 - *     
   1.126 - *                     )
   1.127 - *     
   1.128 - *          ridval     = date-time / date
   1.129 - *          ;Value MUST match value type
   1.130 - * </pre>
   1.131 - * 
   1.132 - * @author Ben Fortuna
   1.133 - */
   1.134 -public class RecurrenceId extends DateProperty {
   1.135 -
   1.136 -    private static final long serialVersionUID = 4456883817126011006L;
   1.137 -
   1.138 -    /**
   1.139 -     * Default constructor.
   1.140 -     */
   1.141 -    public RecurrenceId() {
   1.142 -        super(RECURRENCE_ID, PropertyFactoryImpl.getInstance());
   1.143 -        setDate(new DateTime());
   1.144 -    }
   1.145 -
   1.146 -    /**
   1.147 -     * Creates a new RECURRENCE_ID property initialised with the specified timezone.
   1.148 -     * @param timezone initial timezone
   1.149 -     */
   1.150 -    public RecurrenceId(TimeZone timezone) {
   1.151 -        super(RECURRENCE_ID, timezone, PropertyFactoryImpl.getInstance());
   1.152 -    }
   1.153 -
   1.154 -    /**
   1.155 -     * Creates a new instance initialised with the parsed value.
   1.156 -     * @param value the RECURRENCE_ID value string to parse
   1.157 -     * @throws ParseException where the specified string is not a valid RECURRENCE_ID value representation
   1.158 -     */
   1.159 -    public RecurrenceId(final String value) throws ParseException {
   1.160 -        super(RECURRENCE_ID, PropertyFactoryImpl.getInstance());
   1.161 -        setValue(value);
   1.162 -    }
   1.163 -
   1.164 -    /**
   1.165 -     * Creates a new RECURRENCE_ID property initialised with the specified timezone and value.
   1.166 -     * @param value a string representation of a RECURRENCE_ID value
   1.167 -     * @param timezone initial timezone
   1.168 -     * @throws ParseException where the specified value is not a valid string
   1.169 -     * representation
   1.170 -     */
   1.171 -    public RecurrenceId(String value, TimeZone timezone) throws ParseException {
   1.172 -        super(RECURRENCE_ID, timezone, PropertyFactoryImpl.getInstance());
   1.173 -        setValue(value);
   1.174 -    }
   1.175 -
   1.176 -    /**
   1.177 -     * @param aList a list of parameters for this component
   1.178 -     * @param aValue a value string for this component
   1.179 -     * @throws ParseException where the specified value string is not a valid date-time/date representation
   1.180 -     */
   1.181 -    public RecurrenceId(final ParameterList aList, final String aValue)
   1.182 -            throws ParseException {
   1.183 -        super(RECURRENCE_ID, aList, PropertyFactoryImpl.getInstance());
   1.184 -        setValue(aValue);
   1.185 -    }
   1.186 -
   1.187 -    /**
   1.188 -     * Constructor. Date or Date-Time format is determined based on the presence of a VALUE parameter.
   1.189 -     * @param aDate a date representation of a date or date-time
   1.190 -     */
   1.191 -    public RecurrenceId(final Date aDate) {
   1.192 -        super(RECURRENCE_ID, PropertyFactoryImpl.getInstance());
   1.193 -        setDate(aDate);
   1.194 -    }
   1.195 -
   1.196 -    /**
   1.197 -     * Constructor. Date or Date-Time format is determined based on the presence of a VALUE parameter.
   1.198 -     * @param aList a list of parameters for this component
   1.199 -     * @param aDate a date representation of a date or date-time
   1.200 -     */
   1.201 -    public RecurrenceId(final ParameterList aList, final Date aDate) {
   1.202 -        super(RECURRENCE_ID, aList, PropertyFactoryImpl.getInstance());
   1.203 -        setDate(aDate);
   1.204 -    }
   1.205 -
   1.206 -    /**
   1.207 -     * {@inheritDoc}
   1.208 -     */
   1.209 -    public final void validate() throws ValidationException {
   1.210 -        super.validate();
   1.211 -
   1.212 -        /*
   1.213 -         * ; the following are optional, ; but MUST NOT occur more than once (";" "VALUE" "=" ("DATE-TIME" / "DATE)) /
   1.214 -         * (";" tzidparam) / (";" rangeparam) /
   1.215 -         */
   1.216 -
   1.217 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.RANGE,
   1.218 -                getParameters());
   1.219 -
   1.220 -        /*
   1.221 -         * ; the following is optional, ; and MAY occur more than once (";" xparam)
   1.222 -         */
   1.223 -    }
   1.224 -}

mercurial