1.1 --- a/src/net/fortuna/ical4j/model/property/FreeBusy.java Thu Feb 12 18:02:00 2015 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,206 +0,0 @@ 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 java.text.ParseException; 1.38 - 1.39 -import net.fortuna.ical4j.model.Parameter; 1.40 -import net.fortuna.ical4j.model.ParameterList; 1.41 -import net.fortuna.ical4j.model.PeriodList; 1.42 -import net.fortuna.ical4j.model.Property; 1.43 -import net.fortuna.ical4j.model.PropertyFactoryImpl; 1.44 -import net.fortuna.ical4j.model.ValidationException; 1.45 -import net.fortuna.ical4j.util.ParameterValidator; 1.46 - 1.47 -/** 1.48 - * $Id$ 1.49 - * 1.50 - * Created: [Apr 14, 2004] 1.51 - * 1.52 - * Defines a FREEBUSY iCalendar component property. 1.53 - * 1.54 - * <pre> 1.55 - * 4.8.2.6 Free/Busy Time 1.56 - * 1.57 - * Property Name: FREEBUSY 1.58 - * 1.59 - * Purpose: The property defines one or more free or busy time 1.60 - * intervals. 1.61 - * 1.62 - * Value Type: PERIOD. The date and time values MUST be in an UTC time 1.63 - * format. 1.64 - * 1.65 - * Property Parameters: Non-standard or free/busy time type property 1.66 - * parameters can be specified on this property. 1.67 - * 1.68 - * Conformance: The property can be specified in a "VFREEBUSY" calendar 1.69 - * component. 1.70 - * 1.71 - * Property Parameter: "FBTYPE" and non-standard parameters can be 1.72 - * specified on this property. 1.73 - * 1.74 - * Description: These time periods can be specified as either a start 1.75 - * and end date-time or a start date-time and duration. The date and 1.76 - * time MUST be a UTC time format. 1.77 - * 1.78 - * "FREEBUSY" properties within the "VFREEBUSY" calendar component 1.79 - * SHOULD be sorted in ascending order, based on start time and then end 1.80 - * time, with the earliest periods first. 1.81 - * 1.82 - * The "FREEBUSY" property can specify more than one value, separated by 1.83 - * the COMMA character (US-ASCII decimal 44). In such cases, the 1.84 - * "FREEBUSY" property values SHOULD all be of the same "FBTYPE" 1.85 - * property parameter type (e.g., all values of a particular "FBTYPE" 1.86 - * listed together in a single property). 1.87 - * 1.88 - * Format Definition: The property is defined by the following notation: 1.89 - * 1.90 - * freebusy = "FREEBUSY" fbparam ":" fbvalue 1.91 - * CRLF 1.92 - * 1.93 - * fbparam = *( 1.94 - * ; the following is optional, 1.95 - * ; but MUST NOT occur more than once 1.96 - * 1.97 - * (";" fbtypeparam) / 1.98 - * 1.99 - * ; the following is optional, 1.100 - * ; and MAY occur more than once 1.101 - * 1.102 - * (";" xparam) 1.103 - * 1.104 - * ) 1.105 - * 1.106 - * fbvalue = period *["," period] 1.107 - * ;Time value MUST be in the UTC time format. 1.108 - * </pre> 1.109 - * 1.110 - * @author Ben Fortuna 1.111 - */ 1.112 -public class FreeBusy extends Property { 1.113 - 1.114 - private static final long serialVersionUID = -6415954847619338567L; 1.115 - 1.116 - private PeriodList periods; 1.117 - 1.118 - /** 1.119 - * Default constructor. 1.120 - */ 1.121 - public FreeBusy() { 1.122 - super(FREEBUSY, PropertyFactoryImpl.getInstance()); 1.123 - periods = new PeriodList(); 1.124 - } 1.125 - 1.126 - /** 1.127 - * @param aValue a freebusy value 1.128 - * @throws ParseException where the specified string is not a valid freebusy value 1.129 - */ 1.130 - public FreeBusy(final String aValue) throws ParseException { 1.131 - super(FREEBUSY, PropertyFactoryImpl.getInstance()); 1.132 - setValue(aValue); 1.133 - } 1.134 - 1.135 - /** 1.136 - * @param aList a list of parameters for this component 1.137 - * @param aValue a value string for this component 1.138 - * @throws ParseException when the specified string is not a valid list of periods 1.139 - */ 1.140 - public FreeBusy(final ParameterList aList, final String aValue) 1.141 - throws ParseException { 1.142 - super(FREEBUSY, aList, PropertyFactoryImpl.getInstance()); 1.143 - setValue(aValue); 1.144 - } 1.145 - 1.146 - /** 1.147 - * @param pList a list of periods 1.148 - */ 1.149 - public FreeBusy(final PeriodList pList) { 1.150 - super(FREEBUSY, PropertyFactoryImpl.getInstance()); 1.151 - if (!pList.isUtc()) { 1.152 - throw new IllegalArgumentException("Periods must be in UTC format"); 1.153 - } 1.154 - periods = pList; 1.155 - } 1.156 - 1.157 - /** 1.158 - * @param aList a list of parameters for this component 1.159 - * @param pList a list of periods 1.160 - */ 1.161 - public FreeBusy(final ParameterList aList, final PeriodList pList) { 1.162 - super(FREEBUSY, aList, PropertyFactoryImpl.getInstance()); 1.163 - if (!pList.isUtc()) { 1.164 - throw new IllegalArgumentException("Periods must be in UTC format"); 1.165 - } 1.166 - periods = pList; 1.167 - } 1.168 - 1.169 - /** 1.170 - * {@inheritDoc} 1.171 - */ 1.172 - public final void validate() throws ValidationException { 1.173 - 1.174 - /* 1.175 - * ; the following is optional, ; but MUST NOT occur more than once (";" fbtypeparam) / 1.176 - */ 1.177 - ParameterValidator.getInstance().assertOneOrLess(Parameter.FBTYPE, 1.178 - getParameters()); 1.179 - 1.180 - /* 1.181 - * ; the following is optional, ; and MAY occur more than once (";" xparam) 1.182 - */ 1.183 - 1.184 - if (!periods.isUtc()) { 1.185 - throw new ValidationException("Periods must be in UTC format"); 1.186 - } 1.187 - } 1.188 - 1.189 - /** 1.190 - * @return Returns the periods. 1.191 - */ 1.192 - public final PeriodList getPeriods() { 1.193 - return periods; 1.194 - } 1.195 - 1.196 - /** 1.197 - * {@inheritDoc} 1.198 - */ 1.199 - public final void setValue(final String aValue) throws ParseException { 1.200 - periods = new PeriodList(aValue); 1.201 - } 1.202 - 1.203 - /** 1.204 - * {@inheritDoc} 1.205 - */ 1.206 - public final String getValue() { 1.207 - return getPeriods().toString(); 1.208 - } 1.209 -}