|
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.Escapable; |
|
35 import net.fortuna.ical4j.model.ParameterList; |
|
36 import net.fortuna.ical4j.model.Property; |
|
37 import net.fortuna.ical4j.model.PropertyFactoryImpl; |
|
38 import net.fortuna.ical4j.model.ValidationException; |
|
39 |
|
40 /** |
|
41 * $Id$ |
|
42 * |
|
43 * Created: [Apr 6, 2004] |
|
44 * |
|
45 * Defines a UID iCalendar component property. |
|
46 * |
|
47 * <pre> |
|
48 * 4.8.4.7 Unique Identifier |
|
49 * |
|
50 * Property Name: UID |
|
51 * |
|
52 * Purpose: This property defines the persistent, globally unique |
|
53 * identifier for the calendar component. |
|
54 * |
|
55 * Value Type: TEXT |
|
56 * |
|
57 * Property Parameters: Non-standard property parameters can be |
|
58 * specified on this property. |
|
59 * |
|
60 * Conformance: The property MUST be specified in the "VEVENT", "VTODO", |
|
61 * "VJOURNAL" or "VFREEBUSY" calendar components. |
|
62 * |
|
63 * Description: The UID itself MUST be a globally unique identifier. The |
|
64 * generator of the identifier MUST guarantee that the identifier is |
|
65 * unique. There are several algorithms that can be used to accomplish |
|
66 * this. The identifier is RECOMMENDED to be the identical syntax to the |
|
67 * [RFC 822] addr-spec. A good method to assure uniqueness is to put the |
|
68 * domain name or a domain literal IP address of the host on which the |
|
69 * identifier was created on the right hand side of the "@", and on the |
|
70 * left hand side, put a combination of the current calendar date and |
|
71 * time of day (i.e., formatted in as a DATE-TIME value) along with some |
|
72 * other currently unique (perhaps sequential) identifier available on |
|
73 * the system (for example, a process id number). Using a date/time |
|
74 * value on the left hand side and a domain name or domain literal on |
|
75 * the right hand side makes it possible to guarantee uniqueness since |
|
76 * no two hosts should be using the same domain name or IP address at |
|
77 * the same time. Though other algorithms will work, it is RECOMMENDED |
|
78 * that the right hand side contain some domain identifier (either of |
|
79 * the host itself or otherwise) such that the generator of the message |
|
80 * identifier can guarantee the uniqueness of the left hand side within |
|
81 * the scope of that domain. |
|
82 * |
|
83 * This is the method for correlating scheduling messages with the |
|
84 * referenced "VEVENT", "VTODO", or "VJOURNAL" calendar component. |
|
85 * |
|
86 * The full range of calendar components specified by a recurrence set |
|
87 * is referenced by referring to just the "UID" property value |
|
88 * corresponding to the calendar component. The "RECURRENCE-ID" property |
|
89 * allows the reference to an individual instance within the recurrence |
|
90 * set. |
|
91 * |
|
92 * This property is an important method for group scheduling |
|
93 * applications to match requests with later replies, modifications or |
|
94 * deletion requests. Calendaring and scheduling applications MUST |
|
95 * generate this property in "VEVENT", "VTODO" and "VJOURNAL" calendar |
|
96 * components to assure interoperability with other group scheduling |
|
97 * applications. This identifier is created by the calendar system that |
|
98 * generates an iCalendar object. |
|
99 * |
|
100 * Implementations MUST be able to receive and persist values of at |
|
101 * least 255 characters for this property. |
|
102 * |
|
103 * Format Definition: The property is defined by the following notation: |
|
104 * |
|
105 * uid = "UID" uidparam ":" text CRLF |
|
106 * |
|
107 * uidparam = *(";" xparam) |
|
108 * |
|
109 * Example: The following is an example of this property: |
|
110 * |
|
111 * UID:19960401T080045Z-4000F192713-0052@host1.com |
|
112 * </pre> |
|
113 * |
|
114 * @author Ben Fortuna |
|
115 */ |
|
116 public class Uid extends Property implements Escapable { |
|
117 |
|
118 private static final long serialVersionUID = -7139407612536588584L; |
|
119 |
|
120 private String value; |
|
121 |
|
122 /** |
|
123 * Default constructor. |
|
124 */ |
|
125 public Uid() { |
|
126 super(UID, PropertyFactoryImpl.getInstance()); |
|
127 } |
|
128 |
|
129 /** |
|
130 * @param aValue a value string for this component |
|
131 */ |
|
132 public Uid(final String aValue) { |
|
133 super(UID, PropertyFactoryImpl.getInstance()); |
|
134 setValue(aValue); |
|
135 } |
|
136 |
|
137 /** |
|
138 * @param aList a list of parameters for this component |
|
139 * @param aValue a value string for this component |
|
140 */ |
|
141 public Uid(final ParameterList aList, final String aValue) { |
|
142 super(UID, aList, PropertyFactoryImpl.getInstance()); |
|
143 setValue(aValue); |
|
144 } |
|
145 |
|
146 /** |
|
147 * {@inheritDoc} |
|
148 */ |
|
149 public final void setValue(final String aValue) { |
|
150 this.value = aValue; |
|
151 } |
|
152 |
|
153 /** |
|
154 * {@inheritDoc} |
|
155 */ |
|
156 public final String getValue() { |
|
157 return value; |
|
158 } |
|
159 |
|
160 /** |
|
161 * {@inheritDoc} |
|
162 */ |
|
163 public final void validate() throws ValidationException { |
|
164 // TODO: Auto-generated method stub |
|
165 } |
|
166 } |