|
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 METHOD iCalendar property. |
|
45 * @author benf |
|
46 */ |
|
47 public class Method extends Property { |
|
48 |
|
49 private static final long serialVersionUID = 7220956532685378719L; |
|
50 |
|
51 /** |
|
52 * Used to publish a calendar entry to one or more Calendar Users. There is no interactivity between the publisher |
|
53 * and any other calendar user. An example might include a baseball team publishing its schedule to the public. [RFC |
|
54 * 2446] |
|
55 */ |
|
56 public static final Method PUBLISH = new ImmutableMethod("PUBLISH"); |
|
57 |
|
58 /** |
|
59 * Used to schedule a calendar entry with other Calendar Users. Requests are interactive in that they require the |
|
60 * receiver to respond using the Reply methods. Meeting Requests, Busy Time requests and the assignment of VTODOs to |
|
61 * other Calendar Users are all examples. Requests are also used by the "Organizer" to update the status of a |
|
62 * calendar entry. [RFC 2446] |
|
63 */ |
|
64 public static final Method REQUEST = new ImmutableMethod("REQUEST"); |
|
65 |
|
66 /** |
|
67 * A Reply is used in response to a Request to convey "Attendee" status to the "Organizer". Replies are commonly |
|
68 * used to respond to meeting and task requests. [RFC2446] |
|
69 */ |
|
70 public static final Method REPLY = new ImmutableMethod("REPLY"); |
|
71 |
|
72 /** |
|
73 * Add one or more instances to an existing VEVENT, VTODO, or VJOURNAL. [RFC 2446] |
|
74 */ |
|
75 public static final Method ADD = new ImmutableMethod("ADD"); |
|
76 |
|
77 /** |
|
78 * Cancel one or more instances of an existing VEVENT, VTODO, or VJOURNAL. [RFC 2446] |
|
79 */ |
|
80 public static final Method CANCEL = new ImmutableMethod("CANCEL"); |
|
81 |
|
82 /** |
|
83 * The Refresh method is used by an "Attendee" to request the latest version of a calendar entry. [RFC 2446] |
|
84 */ |
|
85 public static final Method REFRESH = new ImmutableMethod("REFRESH"); |
|
86 |
|
87 /** |
|
88 * The Counter method is used by an "Attendee" to negotiate a change in the calendar entry. Examples include the |
|
89 * request to change a proposed Event time or change the due date for a VTODO. [RFC 2446] |
|
90 */ |
|
91 public static final Method COUNTER = new ImmutableMethod("COUNTER"); |
|
92 |
|
93 /** |
|
94 * Used by the "Organizer" to decline the proposed counter-proprosal. [RFC 2446] |
|
95 */ |
|
96 public static final Method DECLINE_COUNTER = new ImmutableMethod( |
|
97 "DECLINE-COUNTER"); |
|
98 |
|
99 /** |
|
100 * @author Ben Fortuna An immutable instance of Method. |
|
101 */ |
|
102 private static final class ImmutableMethod extends Method { |
|
103 |
|
104 private static final long serialVersionUID = 5332607957381969713L; |
|
105 |
|
106 private ImmutableMethod(final String value) { |
|
107 super(new ParameterList(true), value); |
|
108 } |
|
109 |
|
110 public void setValue(final String aValue) { |
|
111 throw new UnsupportedOperationException( |
|
112 "Cannot modify constant instances"); |
|
113 } |
|
114 } |
|
115 |
|
116 private String value; |
|
117 |
|
118 /** |
|
119 * Default constructor. |
|
120 */ |
|
121 public Method() { |
|
122 super(METHOD, PropertyFactoryImpl.getInstance()); |
|
123 } |
|
124 |
|
125 /** |
|
126 * @param aValue a value string for this component |
|
127 */ |
|
128 public Method(final String aValue) { |
|
129 super(METHOD, PropertyFactoryImpl.getInstance()); |
|
130 this.value = aValue; |
|
131 } |
|
132 |
|
133 /** |
|
134 * @param aList a list of parameters for this component |
|
135 * @param aValue a value string for this component |
|
136 */ |
|
137 public Method(final ParameterList aList, final String aValue) { |
|
138 super(METHOD, aList, PropertyFactoryImpl.getInstance()); |
|
139 this.value = aValue; |
|
140 } |
|
141 |
|
142 /** |
|
143 * {@inheritDoc} |
|
144 */ |
|
145 public void setValue(final String aValue) { |
|
146 this.value = aValue; |
|
147 } |
|
148 |
|
149 /** |
|
150 * {@inheritDoc} |
|
151 */ |
|
152 public final String getValue() { |
|
153 return value; |
|
154 } |
|
155 |
|
156 /** |
|
157 * {@inheritDoc} |
|
158 */ |
|
159 public final void validate() throws ValidationException { |
|
160 // TODO: Auto-generated method stub |
|
161 } |
|
162 } |