|
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 STATUS iCalendar component property. |
|
45 * |
|
46 * <pre> |
|
47 * 4.8.1.11 Status |
|
48 * |
|
49 * Property Name: STATUS |
|
50 * |
|
51 * Purpose: This property defines the overall status or confirmation for |
|
52 * the calendar component. |
|
53 * |
|
54 * Value Type: TEXT |
|
55 * |
|
56 * Property Parameters: Non-standard property parameters can be |
|
57 * specified on this property. |
|
58 * |
|
59 * Conformance: This property can be specified in "VEVENT", "VTODO" or |
|
60 * "VJOURNAL" calendar components. |
|
61 * |
|
62 * Description: In a group scheduled calendar component, the property is |
|
63 * used by the "Organizer" to provide a confirmation of the event to the |
|
64 * "Attendees". For example in a "VEVENT" calendar component, the |
|
65 * "Organizer" can indicate that a meeting is tentative, confirmed or |
|
66 * cancelled. In a "VTODO" calendar component, the "Organizer" can |
|
67 * indicate that an action item needs action, is completed, is in |
|
68 * process or being worked on, or has been cancelled. In a "VJOURNAL" |
|
69 * calendar component, the "Organizer" can indicate that a journal entry |
|
70 * is draft, final or has been cancelled or removed. |
|
71 * |
|
72 * Format Definition: The property is defined by the following notation: |
|
73 * |
|
74 * status = "STATUS" statparam] ":" statvalue CRLF |
|
75 * |
|
76 * statparam = *(";" xparam) |
|
77 * |
|
78 * statvalue = "TENTATIVE" ;Indicates event is |
|
79 * ;tentative. |
|
80 * / "CONFIRMED" ;Indicates event is |
|
81 * ;definite. |
|
82 * / "CANCELLED" ;Indicates event was |
|
83 * ;cancelled. |
|
84 * ;Status values for a "VEVENT" |
|
85 * |
|
86 * statvalue =/ "NEEDS-ACTION" ;Indicates to-do needs action. |
|
87 * / "COMPLETED" ;Indicates to-do completed. |
|
88 * / "IN-PROCESS" ;Indicates to-do in process of |
|
89 * / "CANCELLED" ;Indicates to-do was cancelled. |
|
90 * ;Status values for "VTODO". |
|
91 * |
|
92 * statvalue =/ "DRAFT" ;Indicates journal is draft. |
|
93 * / "FINAL" ;Indicates journal is final. |
|
94 * / "CANCELLED" ;Indicates journal is removed. |
|
95 * ;Status values for "VJOURNAL". |
|
96 * |
|
97 * Example: The following is an example of this property for a "VEVENT" |
|
98 * calendar component: |
|
99 * |
|
100 * STATUS:TENTATIVE |
|
101 * |
|
102 * The following is an example of this property for a "VTODO" calendar |
|
103 * component: |
|
104 * |
|
105 * STATUS:NEEDS-ACTION |
|
106 * |
|
107 * The following is an example of this property for a "VJOURNAL" |
|
108 * calendar component: |
|
109 * |
|
110 * STATUS:DRAFT |
|
111 * </pre> |
|
112 * |
|
113 * @author Ben Fortuna |
|
114 */ |
|
115 public class Status extends Property { |
|
116 |
|
117 private static final long serialVersionUID = 7401102230299289898L; |
|
118 |
|
119 // Status values for a "VEVENT" |
|
120 /** |
|
121 * Tentative VEVENT status. |
|
122 */ |
|
123 public static final Status VEVENT_TENTATIVE = new ImmutableStatus( |
|
124 "TENTATIVE"); |
|
125 |
|
126 /** |
|
127 * Confirmed VEVENT status. |
|
128 */ |
|
129 public static final Status VEVENT_CONFIRMED = new ImmutableStatus( |
|
130 "CONFIRMED"); |
|
131 |
|
132 /** |
|
133 * Cancelled VEVENT status. |
|
134 */ |
|
135 public static final Status VEVENT_CANCELLED = new ImmutableStatus( |
|
136 "CANCELLED"); |
|
137 |
|
138 // Status values for "VTODO" |
|
139 /** |
|
140 * Tentative VTODO status. |
|
141 */ |
|
142 public static final Status VTODO_NEEDS_ACTION = new ImmutableStatus( |
|
143 "NEEDS-ACTION"); |
|
144 |
|
145 /** |
|
146 * Completed VTODO status. |
|
147 */ |
|
148 public static final Status VTODO_COMPLETED = new ImmutableStatus( |
|
149 "COMPLETED"); |
|
150 |
|
151 /** |
|
152 * In-process VTODO status. |
|
153 */ |
|
154 public static final Status VTODO_IN_PROCESS = new ImmutableStatus( |
|
155 "IN-PROCESS"); |
|
156 |
|
157 /** |
|
158 * Cancelled VTODO status. |
|
159 */ |
|
160 public static final Status VTODO_CANCELLED = new ImmutableStatus( |
|
161 "CANCELLED"); |
|
162 |
|
163 // Status values for "VJOURNAL" |
|
164 /** |
|
165 * Draft VJOURNAL status. |
|
166 */ |
|
167 public static final Status VJOURNAL_DRAFT = new ImmutableStatus("DRAFT"); |
|
168 |
|
169 /** |
|
170 * Final VJOURNAL status. |
|
171 */ |
|
172 public static final Status VJOURNAL_FINAL = new ImmutableStatus("FINAL"); |
|
173 |
|
174 /** |
|
175 * Cancelled VJOURNAL status. |
|
176 */ |
|
177 public static final Status VJOURNAL_CANCELLED = new ImmutableStatus( |
|
178 "CANCELLED"); |
|
179 |
|
180 /** |
|
181 * @author Ben Fortuna An immutable instance of Status. |
|
182 */ |
|
183 private static final class ImmutableStatus extends Status { |
|
184 |
|
185 private static final long serialVersionUID = 7771868877237685612L; |
|
186 |
|
187 private ImmutableStatus(final String value) { |
|
188 super(new ParameterList(true), value); |
|
189 } |
|
190 |
|
191 public void setValue(final String aValue) { |
|
192 throw new UnsupportedOperationException( |
|
193 "Cannot modify constant instances"); |
|
194 } |
|
195 } |
|
196 |
|
197 private String value; |
|
198 |
|
199 /** |
|
200 * Default constructor. |
|
201 */ |
|
202 public Status() { |
|
203 super(STATUS, PropertyFactoryImpl.getInstance()); |
|
204 } |
|
205 |
|
206 /** |
|
207 * @param aValue a value string for this component |
|
208 */ |
|
209 public Status(final String aValue) { |
|
210 super(STATUS, PropertyFactoryImpl.getInstance()); |
|
211 this.value = aValue; |
|
212 } |
|
213 |
|
214 /** |
|
215 * @param aList a list of parameters for this component |
|
216 * @param aValue a value string for this component |
|
217 */ |
|
218 public Status(final ParameterList aList, final String aValue) { |
|
219 super(STATUS, aList, PropertyFactoryImpl.getInstance()); |
|
220 this.value = aValue; |
|
221 } |
|
222 |
|
223 /** |
|
224 * {@inheritDoc} |
|
225 */ |
|
226 public void setValue(final String aValue) { |
|
227 this.value = aValue; |
|
228 } |
|
229 |
|
230 /** |
|
231 * {@inheritDoc} |
|
232 */ |
|
233 public final String getValue() { |
|
234 return value; |
|
235 } |
|
236 |
|
237 /** |
|
238 * {@inheritDoc} |
|
239 */ |
|
240 public final void validate() throws ValidationException { |
|
241 // TODO: Auto-generated method stub |
|
242 } |
|
243 } |