Tue, 10 Feb 2015 18:12:00 +0100
Import initial revisions of existing project AndroidCaldavSyncAdapater,
forked from upstream repository at 27e8a0f8495c92e0780d450bdf0c7cec77a03a55.
1 /**
2 * Copyright (c) 2012, Ben Fortuna
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * o Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * o Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * o Neither the name of Ben Fortuna nor the names of any other contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 package net.fortuna.ical4j.model.property;
34 import net.fortuna.ical4j.model.ParameterList;
35 import net.fortuna.ical4j.model.Property;
36 import net.fortuna.ical4j.model.PropertyFactoryImpl;
37 import net.fortuna.ical4j.model.ValidationException;
39 /**
40 * $Id$
41 *
42 * Created: [Apr 6, 2004]
43 *
44 * Defines a SEQUENCE iCalendar component property.
45 *
46 * <pre>
47 * 4.8.7.4 Sequence Number
48 *
49 * Property Name: SEQUENCE
50 *
51 * Purpose: This property defines the revision sequence number of the
52 * calendar component within a sequence of revisions.
53 *
54 * Value Type: integer
55 *
56 * Property Parameters: Non-standard property parameters can be
57 * specified on this property.
58 *
59 * Conformance: The property can be specified in "VEVENT", "VTODO" or
60 * "VJOURNAL" calendar component.
61 *
62 * Description: When a calendar component is created, its sequence
63 * number is zero (US-ASCII decimal 48). It is monotonically incremented
64 * by the "Organizer's" CUA each time the "Organizer" makes a
65 * significant revision to the calendar component. When the "Organizer"
66 * makes changes to one of the following properties, the sequence number
67 * MUST be incremented:
68 *
69 * . "DTSTART"
70 *
71 * . "DTEND"
72 *
73 * . "DUE"
74 *
75 * . "RDATE"
76 *
77 * . "RRULE"
78 *
79 * . "EXDATE"
80 *
81 * . "EXRULE"
82 *
83 * . "STATUS"
84 *
85 * In addition, changes made by the "Organizer" to other properties can
86 * also force the sequence number to be incremented. The "Organizer" CUA
87 * MUST increment the sequence number when ever it makes changes to
88 * properties in the calendar component that the "Organizer" deems will
89 * jeopardize the validity of the participation status of the
90 * "Attendees". For example, changing the location of a meeting from one
91 * locale to another distant locale could effectively impact the
92 * participation status of the "Attendees".
93 *
94 * The "Organizer" includes this property in an iCalendar object that it
95 * sends to an "Attendee" to specify the current version of the calendar
96 * component.
97 *
98 * The "Attendee" includes this property in an iCalendar object that it
99 * sends to the "Organizer" to specify the version of the calendar
100 * component that the "Attendee" is referring to.
101 *
102 * A change to the sequence number is not the mechanism that an
103 * "Organizer" uses to request a response from the "Attendees". The
104 * "RSVP" parameter on the "ATTENDEE" property is used by the
105 * "Organizer" to indicate that a response from the "Attendees" is
106 * requested.
107 *
108 * Format Definition: This property is defined by the following
109 * notation:
110 *
111 * seq = "SEQUENCE" seqparam ":" integer CRLF
112 * ; Default is "0"
113 *
114 * seqparam = *(";" xparam)
115 *
116 * Example: The following is an example of this property for a calendar
117 * component that was just created by the "Organizer".
118 *
119 * SEQUENCE:0
120 *
121 * The following is an example of this property for a calendar component
122 * that has been revised two different times by the "Organizer".
123 *
124 * SEQUENCE:2
125 * </pre>
126 *
127 * @author Ben Fortuna
128 */
129 public class Sequence extends Property {
131 private static final long serialVersionUID = -1606972893204822853L;
133 private int sequenceNo;
135 /**
136 * Default constructor.
137 */
138 public Sequence() {
139 super(SEQUENCE, PropertyFactoryImpl.getInstance());
140 sequenceNo = 0;
141 }
143 /**
144 * @param aValue a value string for this component
145 */
146 public Sequence(final String aValue) {
147 super(SEQUENCE, PropertyFactoryImpl.getInstance());
148 setValue(aValue);
149 }
151 /**
152 * @param aList a list of parameters for this component
153 * @param aValue a value string for this component
154 */
155 public Sequence(final ParameterList aList, final String aValue) {
156 super(SEQUENCE, aList, PropertyFactoryImpl.getInstance());
157 setValue(aValue);
158 }
160 /**
161 * @param aSequenceNo a sequence number
162 */
163 public Sequence(final int aSequenceNo) {
164 super(SEQUENCE, PropertyFactoryImpl.getInstance());
165 sequenceNo = aSequenceNo;
166 }
168 /**
169 * @param aList a list of parameters for this component
170 * @param aSequenceNo a sequence number
171 */
172 public Sequence(final ParameterList aList, final int aSequenceNo) {
173 super(SEQUENCE, aList, PropertyFactoryImpl.getInstance());
174 sequenceNo = aSequenceNo;
175 }
177 /**
178 * @return Returns the sequenceNo.
179 */
180 public final int getSequenceNo() {
181 return sequenceNo;
182 }
184 /**
185 * {@inheritDoc}
186 */
187 public final void setValue(final String aValue) {
188 sequenceNo = Integer.parseInt(aValue);
189 }
191 /**
192 * {@inheritDoc}
193 */
194 public final String getValue() {
195 return String.valueOf(getSequenceNo());
196 }
198 /**
199 * {@inheritDoc}
200 */
201 public final void validate() throws ValidationException {
202 // TODO: Auto-generated method stub
203 }
204 }