1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/net/fortuna/ical4j/model/property/Status.java Tue Feb 10 18:12:00 2015 +0100 1.3 @@ -0,0 +1,243 @@ 1.4 +/** 1.5 + * Copyright (c) 2012, Ben Fortuna 1.6 + * All rights reserved. 1.7 + * 1.8 + * Redistribution and use in source and binary forms, with or without 1.9 + * modification, are permitted provided that the following conditions 1.10 + * are met: 1.11 + * 1.12 + * o Redistributions of source code must retain the above copyright 1.13 + * notice, this list of conditions and the following disclaimer. 1.14 + * 1.15 + * o Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in the 1.17 + * documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * o Neither the name of Ben Fortuna nor the names of any other contributors 1.20 + * may be used to endorse or promote products derived from this software 1.21 + * without specific prior written permission. 1.22 + * 1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.25 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.26 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1.27 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1.28 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1.29 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1.30 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1.31 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1.32 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1.33 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.34 + */ 1.35 +package net.fortuna.ical4j.model.property; 1.36 + 1.37 +import net.fortuna.ical4j.model.ParameterList; 1.38 +import net.fortuna.ical4j.model.Property; 1.39 +import net.fortuna.ical4j.model.PropertyFactoryImpl; 1.40 +import net.fortuna.ical4j.model.ValidationException; 1.41 + 1.42 +/** 1.43 + * $Id$ 1.44 + * 1.45 + * Created: [Apr 6, 2004] 1.46 + * 1.47 + * Defines a STATUS iCalendar component property. 1.48 + * 1.49 + * <pre> 1.50 + * 4.8.1.11 Status 1.51 + * 1.52 + * Property Name: STATUS 1.53 + * 1.54 + * Purpose: This property defines the overall status or confirmation for 1.55 + * the calendar component. 1.56 + * 1.57 + * Value Type: TEXT 1.58 + * 1.59 + * Property Parameters: Non-standard property parameters can be 1.60 + * specified on this property. 1.61 + * 1.62 + * Conformance: This property can be specified in "VEVENT", "VTODO" or 1.63 + * "VJOURNAL" calendar components. 1.64 + * 1.65 + * Description: In a group scheduled calendar component, the property is 1.66 + * used by the "Organizer" to provide a confirmation of the event to the 1.67 + * "Attendees". For example in a "VEVENT" calendar component, the 1.68 + * "Organizer" can indicate that a meeting is tentative, confirmed or 1.69 + * cancelled. In a "VTODO" calendar component, the "Organizer" can 1.70 + * indicate that an action item needs action, is completed, is in 1.71 + * process or being worked on, or has been cancelled. In a "VJOURNAL" 1.72 + * calendar component, the "Organizer" can indicate that a journal entry 1.73 + * is draft, final or has been cancelled or removed. 1.74 + * 1.75 + * Format Definition: The property is defined by the following notation: 1.76 + * 1.77 + * status = "STATUS" statparam] ":" statvalue CRLF 1.78 + * 1.79 + * statparam = *(";" xparam) 1.80 + * 1.81 + * statvalue = "TENTATIVE" ;Indicates event is 1.82 + * ;tentative. 1.83 + * / "CONFIRMED" ;Indicates event is 1.84 + * ;definite. 1.85 + * / "CANCELLED" ;Indicates event was 1.86 + * ;cancelled. 1.87 + * ;Status values for a "VEVENT" 1.88 + * 1.89 + * statvalue =/ "NEEDS-ACTION" ;Indicates to-do needs action. 1.90 + * / "COMPLETED" ;Indicates to-do completed. 1.91 + * / "IN-PROCESS" ;Indicates to-do in process of 1.92 + * / "CANCELLED" ;Indicates to-do was cancelled. 1.93 + * ;Status values for "VTODO". 1.94 + * 1.95 + * statvalue =/ "DRAFT" ;Indicates journal is draft. 1.96 + * / "FINAL" ;Indicates journal is final. 1.97 + * / "CANCELLED" ;Indicates journal is removed. 1.98 + * ;Status values for "VJOURNAL". 1.99 + * 1.100 + * Example: The following is an example of this property for a "VEVENT" 1.101 + * calendar component: 1.102 + * 1.103 + * STATUS:TENTATIVE 1.104 + * 1.105 + * The following is an example of this property for a "VTODO" calendar 1.106 + * component: 1.107 + * 1.108 + * STATUS:NEEDS-ACTION 1.109 + * 1.110 + * The following is an example of this property for a "VJOURNAL" 1.111 + * calendar component: 1.112 + * 1.113 + * STATUS:DRAFT 1.114 + * </pre> 1.115 + * 1.116 + * @author Ben Fortuna 1.117 + */ 1.118 +public class Status extends Property { 1.119 + 1.120 + private static final long serialVersionUID = 7401102230299289898L; 1.121 + 1.122 + // Status values for a "VEVENT" 1.123 + /** 1.124 + * Tentative VEVENT status. 1.125 + */ 1.126 + public static final Status VEVENT_TENTATIVE = new ImmutableStatus( 1.127 + "TENTATIVE"); 1.128 + 1.129 + /** 1.130 + * Confirmed VEVENT status. 1.131 + */ 1.132 + public static final Status VEVENT_CONFIRMED = new ImmutableStatus( 1.133 + "CONFIRMED"); 1.134 + 1.135 + /** 1.136 + * Cancelled VEVENT status. 1.137 + */ 1.138 + public static final Status VEVENT_CANCELLED = new ImmutableStatus( 1.139 + "CANCELLED"); 1.140 + 1.141 + // Status values for "VTODO" 1.142 + /** 1.143 + * Tentative VTODO status. 1.144 + */ 1.145 + public static final Status VTODO_NEEDS_ACTION = new ImmutableStatus( 1.146 + "NEEDS-ACTION"); 1.147 + 1.148 + /** 1.149 + * Completed VTODO status. 1.150 + */ 1.151 + public static final Status VTODO_COMPLETED = new ImmutableStatus( 1.152 + "COMPLETED"); 1.153 + 1.154 + /** 1.155 + * In-process VTODO status. 1.156 + */ 1.157 + public static final Status VTODO_IN_PROCESS = new ImmutableStatus( 1.158 + "IN-PROCESS"); 1.159 + 1.160 + /** 1.161 + * Cancelled VTODO status. 1.162 + */ 1.163 + public static final Status VTODO_CANCELLED = new ImmutableStatus( 1.164 + "CANCELLED"); 1.165 + 1.166 + // Status values for "VJOURNAL" 1.167 + /** 1.168 + * Draft VJOURNAL status. 1.169 + */ 1.170 + public static final Status VJOURNAL_DRAFT = new ImmutableStatus("DRAFT"); 1.171 + 1.172 + /** 1.173 + * Final VJOURNAL status. 1.174 + */ 1.175 + public static final Status VJOURNAL_FINAL = new ImmutableStatus("FINAL"); 1.176 + 1.177 + /** 1.178 + * Cancelled VJOURNAL status. 1.179 + */ 1.180 + public static final Status VJOURNAL_CANCELLED = new ImmutableStatus( 1.181 + "CANCELLED"); 1.182 + 1.183 + /** 1.184 + * @author Ben Fortuna An immutable instance of Status. 1.185 + */ 1.186 + private static final class ImmutableStatus extends Status { 1.187 + 1.188 + private static final long serialVersionUID = 7771868877237685612L; 1.189 + 1.190 + private ImmutableStatus(final String value) { 1.191 + super(new ParameterList(true), value); 1.192 + } 1.193 + 1.194 + public void setValue(final String aValue) { 1.195 + throw new UnsupportedOperationException( 1.196 + "Cannot modify constant instances"); 1.197 + } 1.198 + } 1.199 + 1.200 + private String value; 1.201 + 1.202 + /** 1.203 + * Default constructor. 1.204 + */ 1.205 + public Status() { 1.206 + super(STATUS, PropertyFactoryImpl.getInstance()); 1.207 + } 1.208 + 1.209 + /** 1.210 + * @param aValue a value string for this component 1.211 + */ 1.212 + public Status(final String aValue) { 1.213 + super(STATUS, PropertyFactoryImpl.getInstance()); 1.214 + this.value = aValue; 1.215 + } 1.216 + 1.217 + /** 1.218 + * @param aList a list of parameters for this component 1.219 + * @param aValue a value string for this component 1.220 + */ 1.221 + public Status(final ParameterList aList, final String aValue) { 1.222 + super(STATUS, aList, PropertyFactoryImpl.getInstance()); 1.223 + this.value = aValue; 1.224 + } 1.225 + 1.226 + /** 1.227 + * {@inheritDoc} 1.228 + */ 1.229 + public void setValue(final String aValue) { 1.230 + this.value = aValue; 1.231 + } 1.232 + 1.233 + /** 1.234 + * {@inheritDoc} 1.235 + */ 1.236 + public final String getValue() { 1.237 + return value; 1.238 + } 1.239 + 1.240 + /** 1.241 + * {@inheritDoc} 1.242 + */ 1.243 + public final void validate() throws ValidationException { 1.244 + // TODO: Auto-generated method stub 1.245 + } 1.246 +}