|
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 LAST-MODIFIED iCalendar component property. |
|
46 * |
|
47 * <pre> |
|
48 * 4.8.7.3 Last Modified |
|
49 * |
|
50 * Property Name: LAST-MODIFIED |
|
51 * |
|
52 * Purpose: The property specifies the date and time that the |
|
53 * information associated with the calendar component was last revised |
|
54 * in the calendar store. |
|
55 * |
|
56 * Note: This is analogous to the modification date and time for a |
|
57 * file in the file system. |
|
58 * |
|
59 * Value Type: DATE-TIME |
|
60 * |
|
61 * Property Parameters: Non-standard property parameters can be |
|
62 * specified on this property. |
|
63 * |
|
64 * Conformance: This property can be specified in the "EVENT", "VTODO", |
|
65 * "VJOURNAL" or "VTIMEZONE" calendar components. |
|
66 * |
|
67 * Description: The property value MUST be specified in the UTC time |
|
68 * format. |
|
69 * |
|
70 * Format Definition: The property is defined by the following notation: |
|
71 * |
|
72 * last-mod = "LAST-MODIFIED" lstparam ":" date-time CRLF |
|
73 * |
|
74 * lstparam = *(";" xparam) |
|
75 * </pre> |
|
76 * |
|
77 * @author benf |
|
78 */ |
|
79 public class LastModified extends UtcProperty { |
|
80 |
|
81 private static final long serialVersionUID = 5288572652052836062L; |
|
82 |
|
83 /** |
|
84 * Default constructor. |
|
85 */ |
|
86 public LastModified() { |
|
87 super(LAST_MODIFIED, PropertyFactoryImpl.getInstance()); |
|
88 } |
|
89 |
|
90 /** |
|
91 * @param aValue a date-time value |
|
92 * @throws ParseException where the specified string is not a valid date-time |
|
93 */ |
|
94 public LastModified(final String aValue) throws ParseException { |
|
95 this(new ParameterList(), aValue); |
|
96 } |
|
97 |
|
98 /** |
|
99 * @param aList a list of parameters for this component |
|
100 * @param aValue a value string for this component |
|
101 * @throws ParseException where the specified value string is not a valid date-time/date representation |
|
102 */ |
|
103 public LastModified(final ParameterList aList, final String aValue) |
|
104 throws ParseException { |
|
105 super(LAST_MODIFIED, aList, PropertyFactoryImpl.getInstance()); |
|
106 setValue(aValue); |
|
107 } |
|
108 |
|
109 /** |
|
110 * @param aDate a date representation of a date-time value |
|
111 */ |
|
112 public LastModified(final DateTime aDate) { |
|
113 super(LAST_MODIFIED, PropertyFactoryImpl.getInstance()); |
|
114 // time must be in UTC.. |
|
115 aDate.setUtc(true); |
|
116 setDate(aDate); |
|
117 } |
|
118 |
|
119 /** |
|
120 * @param aList a list of parameters for this component |
|
121 * @param aDate a date representation of a date-time value |
|
122 */ |
|
123 public LastModified(final ParameterList aList, final DateTime aDate) { |
|
124 super(LAST_MODIFIED, aList, PropertyFactoryImpl.getInstance()); |
|
125 // time must be in UTC.. |
|
126 aDate.setUtc(true); |
|
127 setDate(aDate); |
|
128 } |
|
129 } |