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

branch
ICAL4J_EMBED_1
changeset 15
cc93757aeca3
parent 14
5ae3e5665a0b
child 18
6dcaece8ec41
     1.1 --- a/src/net/fortuna/ical4j/model/property/Organizer.java	Thu Feb 12 18:02:00 2015 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,238 +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.net.URI;
    1.38 -import java.net.URISyntaxException;
    1.39 -
    1.40 -import net.fortuna.ical4j.model.Parameter;
    1.41 -import net.fortuna.ical4j.model.ParameterList;
    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 -import net.fortuna.ical4j.util.Strings;
    1.47 -import net.fortuna.ical4j.util.Uris;
    1.48 -
    1.49 -/**
    1.50 - * $Id$
    1.51 - * 
    1.52 - * Created: [Apr 6, 2004]
    1.53 - *
    1.54 - * Defines an ORGANIZER iCalendar component property.
    1.55 - * 
    1.56 - * <pre>
    1.57 - *     4.8.4.3 Organizer
    1.58 - *     
    1.59 - *        Property Name: ORGANIZER
    1.60 - *     
    1.61 - *        Purpose: The property defines the organizer for a calendar component.
    1.62 - *     
    1.63 - *        Value Type: CAL-ADDRESS
    1.64 - *     
    1.65 - *        Property Parameters: Non-standard, language, common name, directory
    1.66 - *        entry reference, sent by property parameters can be specified on this
    1.67 - *        property.
    1.68 - *     
    1.69 - *        Conformance: This property MUST be specified in an iCalendar object
    1.70 - *        that specifies a group scheduled calendar entity. This property MUST
    1.71 - *        be specified in an iCalendar object that specifies the publication of
    1.72 - *        a calendar user's busy time. This property MUST NOT be specified in
    1.73 - *        an iCalendar object that specifies only a time zone definition or
    1.74 - *        that defines calendar entities that are not group scheduled entities,
    1.75 - *        but are entities only on a single user's calendar.
    1.76 - *     
    1.77 - *        Description: The property is specified within the &quot;VEVENT&quot;, &quot;VTODO&quot;,
    1.78 - *        &quot;VJOURNAL calendar components to specify the organizer of a group
    1.79 - *        scheduled calendar entity. The property is specified within the
    1.80 - *        &quot;VFREEBUSY&quot; calendar component to specify the calendar user
    1.81 - *        requesting the free or busy time. When publishing a &quot;VFREEBUSY&quot;
    1.82 - *        calendar component, the property is used to specify the calendar that
    1.83 - *        the published busy time came from.
    1.84 - *     
    1.85 - *        The property has the property parameters CN, for specifying the
    1.86 - *        common or display name associated with the &quot;Organizer&quot;, DIR, for
    1.87 - *        specifying a pointer to the directory information associated with the
    1.88 - *        &quot;Organizer&quot;, SENT-BY, for specifying another calendar user that is
    1.89 - *        acting on behalf of the &quot;Organizer&quot;. The non-standard parameters may
    1.90 - *        also be specified on this property. If the LANGUAGE property
    1.91 - *        parameter is specified, the identified language applies to the CN
    1.92 - *        parameter value.
    1.93 - *     
    1.94 - *        Format Definition: The property is defined by the following notation:
    1.95 - *     
    1.96 - *          organizer  = &quot;ORGANIZER&quot; orgparam &quot;:&quot;
    1.97 - *                       cal-address CRLF
    1.98 - *     
    1.99 - *          orgparam   = *(
   1.100 - *     
   1.101 - *                     ; the following are optional,
   1.102 - *                     ; but MUST NOT occur more than once
   1.103 - *     
   1.104 - *                     (&quot;;&quot; cnparam) / (&quot;;&quot; dirparam) / (&quot;;&quot; sentbyparam) /
   1.105 - *                     (&quot;;&quot; languageparam) /
   1.106 - *     
   1.107 - *                     ; the following is optional,
   1.108 - *                     ; and MAY occur more than once
   1.109 - *     
   1.110 - *                     (&quot;;&quot; xparam)
   1.111 - *     
   1.112 - *                     )
   1.113 - *     
   1.114 - *        Example: The following is an example of this property:
   1.115 - *     
   1.116 - *          ORGANIZER;CN=John Smith:MAILTO:jsmith@host1.com
   1.117 - *     
   1.118 - *        The following is an example of this property with a pointer to the
   1.119 - *        directory information associated with the organizer:
   1.120 - *     
   1.121 - *          ORGANIZER;CN=JohnSmith;DIR=&quot;ldap://host.com:6666/o=3DDC%20Associ
   1.122 - *           ates,c=3DUS??(cn=3DJohn%20Smith)&quot;:MAILTO:jsmith@host1.com
   1.123 - *     
   1.124 - *        The following is an example of this property used by another calendar
   1.125 - *        user who is acting on behalf of the organizer, with responses
   1.126 - *        intended to be sent back to the organizer, not the other calendar
   1.127 - *        user:
   1.128 - *     
   1.129 - *          ORGANIZER;SENT-BY=&quot;MAILTO:jane_doe@host.com&quot;:
   1.130 - *           MAILTO:jsmith@host1.com
   1.131 - * </pre>
   1.132 - * 
   1.133 - * @author Ben Fortuna
   1.134 - */
   1.135 -public class Organizer extends Property {
   1.136 -
   1.137 -    private static final long serialVersionUID = -5216965653165090725L;
   1.138 -
   1.139 -    private URI calAddress;
   1.140 -
   1.141 -    /**
   1.142 -     * Default constructor.
   1.143 -     */
   1.144 -    public Organizer() {
   1.145 -        super(ORGANIZER, PropertyFactoryImpl.getInstance());
   1.146 -    }
   1.147 -
   1.148 -    /**
   1.149 -     * Constructs a new instance with the specified value.
   1.150 -     * @param value an organizer URI
   1.151 -     * @throws URISyntaxException where the specified value is not a valid URI
   1.152 -     */
   1.153 -    public Organizer(String value) throws URISyntaxException {
   1.154 -        super(ORGANIZER, PropertyFactoryImpl.getInstance());
   1.155 -        setValue(value);
   1.156 -    }
   1.157 -    
   1.158 -    /**
   1.159 -     * @param aList a list of parameters for this component
   1.160 -     * @param aValue a value string for this component
   1.161 -     * @throws URISyntaxException where the specified value string is not a valid uri
   1.162 -     */
   1.163 -    public Organizer(final ParameterList aList, final String aValue)
   1.164 -            throws URISyntaxException {
   1.165 -        super(ORGANIZER, aList, PropertyFactoryImpl.getInstance());
   1.166 -        setValue(aValue);
   1.167 -    }
   1.168 -
   1.169 -    /**
   1.170 -     * @param aUri a URI representation of a calendar address
   1.171 -     */
   1.172 -    public Organizer(final URI aUri) {
   1.173 -        super(ORGANIZER, PropertyFactoryImpl.getInstance());
   1.174 -        calAddress = aUri;
   1.175 -    }
   1.176 -
   1.177 -    /**
   1.178 -     * @param aList a list of parameters for this component
   1.179 -     * @param aUri a URI representation of a calendar address
   1.180 -     */
   1.181 -    public Organizer(final ParameterList aList, final URI aUri) {
   1.182 -        super(ORGANIZER, aList, PropertyFactoryImpl.getInstance());
   1.183 -        calAddress = aUri;
   1.184 -    }
   1.185 -
   1.186 -    /**
   1.187 -     * {@inheritDoc}
   1.188 -     */
   1.189 -    public final void validate() throws ValidationException {
   1.190 -
   1.191 -        /*
   1.192 -         * ; the following are optional, ; but MUST NOT occur more than once (";" cnparam) / (";" dirparam) / (";"
   1.193 -         * sentbyparam) / (";" languageparam) /
   1.194 -         */
   1.195 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.CN,
   1.196 -                getParameters());
   1.197 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.DIR,
   1.198 -                getParameters());
   1.199 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.SENT_BY,
   1.200 -                getParameters());
   1.201 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE,
   1.202 -                getParameters());
   1.203 -
   1.204 -        /* schedulestatus added for CalDAV scheduling
   1.205 -         */
   1.206 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.SCHEDULE_STATUS,
   1.207 -                                                         getParameters());
   1.208 -
   1.209 -        /*
   1.210 -         * ; the following is optional, ; and MAY occur more than once (";" xparam)
   1.211 -         */
   1.212 -    }
   1.213 -
   1.214 -    /**
   1.215 -     * @return Returns the calAddress.
   1.216 -     */
   1.217 -    public final URI getCalAddress() {
   1.218 -        return calAddress;
   1.219 -    }
   1.220 -
   1.221 -    /**
   1.222 -     * {@inheritDoc}
   1.223 -     */
   1.224 -    public final void setValue(final String aValue) throws URISyntaxException {
   1.225 -        calAddress = Uris.create(aValue);
   1.226 -    }
   1.227 -
   1.228 -    /**
   1.229 -     * {@inheritDoc}
   1.230 -     */
   1.231 -    public final String getValue() {
   1.232 -        return Uris.decode(Strings.valueOf(getCalAddress()));
   1.233 -    }
   1.234 -
   1.235 -    /**
   1.236 -     * @param calAddress The calAddress to set.
   1.237 -     */
   1.238 -    public final void setCalAddress(final URI calAddress) {
   1.239 -        this.calAddress = calAddress;
   1.240 -    }
   1.241 -}

mercurial