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

changeset 0
fb9019fb1bf7
equal deleted inserted replaced
-1:000000000000 0:448a0f6d6756
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;
33
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;
38
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 &quot;VEVENT&quot;, &quot;VTODO&quot; or
60 * &quot;VJOURNAL&quot; 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 &quot;Organizer's&quot; CUA each time the &quot;Organizer&quot; makes a
65 * significant revision to the calendar component. When the &quot;Organizer&quot;
66 * makes changes to one of the following properties, the sequence number
67 * MUST be incremented:
68 *
69 * . &quot;DTSTART&quot;
70 *
71 * . &quot;DTEND&quot;
72 *
73 * . &quot;DUE&quot;
74 *
75 * . &quot;RDATE&quot;
76 *
77 * . &quot;RRULE&quot;
78 *
79 * . &quot;EXDATE&quot;
80 *
81 * . &quot;EXRULE&quot;
82 *
83 * . &quot;STATUS&quot;
84 *
85 * In addition, changes made by the &quot;Organizer&quot; to other properties can
86 * also force the sequence number to be incremented. The &quot;Organizer&quot; CUA
87 * MUST increment the sequence number when ever it makes changes to
88 * properties in the calendar component that the &quot;Organizer&quot; deems will
89 * jeopardize the validity of the participation status of the
90 * &quot;Attendees&quot;. 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 &quot;Attendees&quot;.
93 *
94 * The &quot;Organizer&quot; includes this property in an iCalendar object that it
95 * sends to an &quot;Attendee&quot; to specify the current version of the calendar
96 * component.
97 *
98 * The &quot;Attendee&quot; includes this property in an iCalendar object that it
99 * sends to the &quot;Organizer&quot; to specify the version of the calendar
100 * component that the &quot;Attendee&quot; is referring to.
101 *
102 * A change to the sequence number is not the mechanism that an
103 * &quot;Organizer&quot; uses to request a response from the &quot;Attendees&quot;. The
104 * &quot;RSVP&quot; parameter on the &quot;ATTENDEE&quot; property is used by the
105 * &quot;Organizer&quot; to indicate that a response from the &quot;Attendees&quot; is
106 * requested.
107 *
108 * Format Definition: This property is defined by the following
109 * notation:
110 *
111 * seq = &quot;SEQUENCE&quot; seqparam &quot;:&quot; integer CRLF
112 * ; Default is &quot;0&quot;
113 *
114 * seqparam = *(&quot;;&quot; xparam)
115 *
116 * Example: The following is an example of this property for a calendar
117 * component that was just created by the &quot;Organizer&quot;.
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 &quot;Organizer&quot;.
123 *
124 * SEQUENCE:2
125 * </pre>
126 *
127 * @author Ben Fortuna
128 */
129 public class Sequence extends Property {
130
131 private static final long serialVersionUID = -1606972893204822853L;
132
133 private int sequenceNo;
134
135 /**
136 * Default constructor.
137 */
138 public Sequence() {
139 super(SEQUENCE, PropertyFactoryImpl.getInstance());
140 sequenceNo = 0;
141 }
142
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 }
150
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 }
159
160 /**
161 * @param aSequenceNo a sequence number
162 */
163 public Sequence(final int aSequenceNo) {
164 super(SEQUENCE, PropertyFactoryImpl.getInstance());
165 sequenceNo = aSequenceNo;
166 }
167
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 }
176
177 /**
178 * @return Returns the sequenceNo.
179 */
180 public final int getSequenceNo() {
181 return sequenceNo;
182 }
183
184 /**
185 * {@inheritDoc}
186 */
187 public final void setValue(final String aValue) {
188 sequenceNo = Integer.parseInt(aValue);
189 }
190
191 /**
192 * {@inheritDoc}
193 */
194 public final String getValue() {
195 return String.valueOf(getSequenceNo());
196 }
197
198 /**
199 * {@inheritDoc}
200 */
201 public final void validate() throws ValidationException {
202 // TODO: Auto-generated method stub
203 }
204 }

mercurial