|
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 TRANSP iCalendar component property. |
|
45 * |
|
46 * <pre> |
|
47 * 4.8.2.7 Time Transparency |
|
48 * |
|
49 * Property Name: TRANSP |
|
50 * |
|
51 * Purpose: This property defines whether an event is transparent or not |
|
52 * to busy time searches. |
|
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 once in a "VEVENT" |
|
60 * calendar component. |
|
61 * |
|
62 * Description: Time Transparency is the characteristic of an event that |
|
63 * determines whether it appears to consume time on a calendar. Events |
|
64 * that consume actual time for the individual or resource associated |
|
65 * with the calendar SHOULD be recorded as OPAQUE, allowing them to be |
|
66 * detected by free-busy time searches. Other events, which do not take |
|
67 * up the individual's (or resource's) time SHOULD be recorded as |
|
68 * TRANSPARENT, making them invisible to free-busy time searches. |
|
69 * |
|
70 * Format Definition: The property is specified by the following |
|
71 * notation: |
|
72 * |
|
73 * transp = "TRANSP" tranparam ":" transvalue CRLF |
|
74 * |
|
75 * tranparam = *(";" xparam) |
|
76 * |
|
77 * transvalue = "OPAQUE" ;Blocks or opaque on busy time searches. |
|
78 * / "TRANSPARENT" ;Transparent on busy time searches. |
|
79 * ;Default value is OPAQUE |
|
80 * |
|
81 * Example: The following is an example of this property for an event |
|
82 * that is transparent or does not block on free/busy time searches: |
|
83 * |
|
84 * TRANSP:TRANSPARENT |
|
85 * |
|
86 * The following is an example of this property for an event that is |
|
87 * opaque or blocks on free/busy time searches: |
|
88 * |
|
89 * TRANSP:OPAQUE |
|
90 * </pre> |
|
91 * |
|
92 * @author Ben Fortuna |
|
93 */ |
|
94 public class Transp extends Property { |
|
95 |
|
96 private static final long serialVersionUID = 3801479657311785518L; |
|
97 |
|
98 /** |
|
99 * Opaque. |
|
100 */ |
|
101 public static final Transp OPAQUE = new ImmutableTransp("OPAQUE"); |
|
102 |
|
103 /** |
|
104 * Transparent. |
|
105 */ |
|
106 public static final Transp TRANSPARENT = new ImmutableTransp("TRANSPARENT"); |
|
107 |
|
108 /** |
|
109 * @author Ben Fortuna An immutable instance of Transp. |
|
110 */ |
|
111 private static final class ImmutableTransp extends Transp { |
|
112 |
|
113 private static final long serialVersionUID = -6595830107310111996L; |
|
114 |
|
115 private ImmutableTransp(final String value) { |
|
116 super(new ParameterList(true), value); |
|
117 } |
|
118 |
|
119 public void setValue(final String aValue) { |
|
120 throw new UnsupportedOperationException( |
|
121 "Cannot modify constant instances"); |
|
122 } |
|
123 } |
|
124 |
|
125 private String value; |
|
126 |
|
127 /** |
|
128 * Default constructor. |
|
129 */ |
|
130 public Transp() { |
|
131 super(TRANSP, PropertyFactoryImpl.getInstance()); |
|
132 } |
|
133 |
|
134 /** |
|
135 * @param aValue a value string for this component |
|
136 */ |
|
137 public Transp(final String aValue) { |
|
138 super(TRANSP, PropertyFactoryImpl.getInstance()); |
|
139 this.value = aValue; |
|
140 } |
|
141 |
|
142 /** |
|
143 * @param aList a list of parameters for this component |
|
144 * @param aValue a value string for this component |
|
145 */ |
|
146 public Transp(final ParameterList aList, final String aValue) { |
|
147 super(TRANSP, aList, PropertyFactoryImpl.getInstance()); |
|
148 this.value = aValue; |
|
149 } |
|
150 |
|
151 /** |
|
152 * {@inheritDoc} |
|
153 */ |
|
154 public void setValue(final String aValue) { |
|
155 this.value = aValue; |
|
156 } |
|
157 |
|
158 /** |
|
159 * {@inheritDoc} |
|
160 */ |
|
161 public final String getValue() { |
|
162 return value; |
|
163 } |
|
164 |
|
165 /** |
|
166 * {@inheritDoc} |
|
167 */ |
|
168 public final void validate() throws ValidationException { |
|
169 // TODO: Auto-generated method stub |
|
170 } |
|
171 } |