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

changeset 0
fb9019fb1bf7
equal deleted inserted replaced
-1:000000000000 0:c093c7c42a76
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 java.text.ParseException;
35
36 import net.fortuna.ical4j.model.DateTime;
37 import net.fortuna.ical4j.model.ParameterList;
38 import net.fortuna.ical4j.model.PropertyFactoryImpl;
39
40 /**
41 * $Id$
42 *
43 * Created: [Apr 6, 2004]
44 *
45 * Defines a DTSTAMP iCalendar component property.
46 *
47 * <pre>
48 * 4.8.7.2 Date/Time Stamp
49 *
50 * Property Name: DTSTAMP
51 *
52 * Purpose: The property indicates the date/time that the instance of
53 * the iCalendar object was created.
54 *
55 * Value Type: DATE-TIME
56 *
57 * Property Parameters: Non-standard property parameters can be
58 * specified on this property.
59 *
60 * Conformance: This property MUST be included in the &quot;VEVENT&quot;, &quot;VTODO&quot;,
61 * &quot;VJOURNAL&quot; or &quot;VFREEBUSY&quot; calendar components.
62 *
63 * Description: The value MUST be specified in the UTC time format.
64 *
65 * This property is also useful to protocols such as [IMIP] that have
66 * inherent latency issues with the delivery of content. This property
67 * will assist in the proper sequencing of messages containing iCalendar
68 * objects.
69 *
70 * This property is different than the &quot;CREATED&quot; and &quot;LAST-MODIFIED&quot;
71 * properties. These two properties are used to specify when the
72 * particular calendar data in the calendar store was created and last
73 * modified. This is different than when the iCalendar object
74 * representation of the calendar service information was created or
75 * last modified.
76 *
77 * Format Definition: The property is defined by the following notation:
78 *
79 * dtstamp = &quot;DTSTAMP&quot; stmparam &quot;:&quot; date-time CRLF
80 *
81 * stmparam = *(&quot;;&quot; xparam)
82 * </pre>
83 *
84 * @author Ben Fortuna
85 */
86 public class DtStamp extends UtcProperty {
87
88 private static final long serialVersionUID = 7581197869433744070L;
89
90 /**
91 * Default constructor. Initialises the dateTime value to the time of instantiation.
92 */
93 public DtStamp() {
94 super(DTSTAMP, PropertyFactoryImpl.getInstance());
95 }
96
97 /**
98 * @param aValue a string representation of a DTSTAMP value
99 * @throws ParseException if the specified value is not a valid representation
100 */
101 public DtStamp(final String aValue) throws ParseException {
102 this(new ParameterList(), aValue);
103 }
104
105 /**
106 * @param aList a list of parameters for this component
107 * @param aValue a value string for this component
108 * @throws ParseException where the specified value string is not a valid date-time/date representation
109 */
110 public DtStamp(final ParameterList aList, final String aValue)
111 throws ParseException {
112 super(DTSTAMP, aList, PropertyFactoryImpl.getInstance());
113 setValue(aValue);
114 }
115
116 /**
117 * @param aDate a date representing a date-time
118 */
119 public DtStamp(final DateTime aDate) {
120 super(DTSTAMP, PropertyFactoryImpl.getInstance());
121 // time must be in UTC..
122 aDate.setUtc(true);
123 setDate(aDate);
124 }
125
126 /**
127 * @param aList a list of parameters for this component
128 * @param aDate a date representing a date-time
129 */
130 public DtStamp(final ParameterList aList, final DateTime aDate) {
131 super(DTSTAMP, aList, PropertyFactoryImpl.getInstance());
132 // time must be in UTC..
133 aDate.setUtc(true);
134 setDate(aDate);
135 }
136 }

mercurial