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

Tue, 10 Feb 2015 18:12:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 10 Feb 2015 18:12:00 +0100
changeset 0
fb9019fb1bf7
permissions
-rw-r--r--

Import initial revisions of existing project AndroidCaldavSyncAdapater,
forked from upstream repository at 27e8a0f8495c92e0780d450bdf0c7cec77a03a55.

     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;
    34 import java.net.URI;
    35 import java.net.URISyntaxException;
    37 import net.fortuna.ical4j.model.ParameterList;
    38 import net.fortuna.ical4j.model.Property;
    39 import net.fortuna.ical4j.model.PropertyFactoryImpl;
    40 import net.fortuna.ical4j.model.ValidationException;
    41 import net.fortuna.ical4j.util.Strings;
    42 import net.fortuna.ical4j.util.Uris;
    44 /**
    45  * $Id$
    46  * 
    47  * Created: [Apr 6, 2004]
    48  *
    49  * Defines a TZURL iCalendar component property.
    50  * 
    51  * <pre>
    52  *     4.8.3.5 Time Zone URL
    53  *     
    54  *        Property Name: TZURL
    55  *     
    56  *        Purpose: The TZURL provides a means for a VTIMEZONE component to
    57  *        point to a network location that can be used to retrieve an up-to-
    58  *        date version of itself.
    59  *     
    60  *        Value Type: URI
    61  *     
    62  *        Property Parameters: Non-standard property parameters can be
    63  *        specified on this property.
    64  *     
    65  *        Conformance: This property can be specified in a &quot;VTIMEZONE&quot; calendar
    66  *        component.
    67  *     
    68  *        Description: The TZURL provides a means for a VTIMEZONE component to
    69  *        point to a network location that can be used to retrieve an up-to-
    70  *        date version of itself. This provides a hook to handle changes
    71  *        government bodies impose upon time zone definitions. Retrieval of
    72  *        this resource results in an iCalendar object containing a single
    73  *        VTIMEZONE component and a METHOD property set to PUBLISH.
    74  *     
    75  *        Format Definition: The property is defined by the following notation:
    76  *     
    77  *          tzurl      = &quot;TZURL&quot; tzurlparam &quot;:&quot; uri CRLF
    78  *     
    79  *          tzurlparam = *(&quot;;&quot; xparam)
    80  *     
    81  *        Example: The following is an example of this property:
    82  *     
    83  *          TZURL:http://timezones.r.us.net/tz/US-California-Los_Angeles
    84  * </pre>
    85  * 
    86  * @author Ben Fortuna
    87  */
    88 public class TzUrl extends Property {
    90     private static final long serialVersionUID = 9106100107954797406L;
    92     private URI uri;
    94     /**
    95      * Default constructor.
    96      */
    97     public TzUrl() {
    98         super(TZURL, PropertyFactoryImpl.getInstance());
    99     }
   101     /**
   102      * @param aList a list of parameters for this component
   103      * @param aValue a value string for this component
   104      * @throws URISyntaxException where the specified value string is not a valid uri
   105      */
   106     public TzUrl(final ParameterList aList, final String aValue)
   107             throws URISyntaxException {
   108         super(TZURL, aList, PropertyFactoryImpl.getInstance());
   109         setValue(aValue);
   110     }
   112     /**
   113      * @param aUri a URI
   114      */
   115     public TzUrl(final URI aUri) {
   116         super(TZURL, PropertyFactoryImpl.getInstance());
   117         uri = aUri;
   118     }
   120     /**
   121      * @param aList a list of parameters for this component
   122      * @param aUri a URI
   123      */
   124     public TzUrl(final ParameterList aList, final URI aUri) {
   125         super(TZURL, aList, PropertyFactoryImpl.getInstance());
   126         uri = aUri;
   127     }
   129     /**
   130      * @return Returns the uri.
   131      */
   132     public final URI getUri() {
   133         return uri;
   134     }
   136     /**
   137      * {@inheritDoc}
   138      */
   139     public final void setValue(final String aValue) throws URISyntaxException {
   140         uri = Uris.create(aValue);
   141     }
   143     /**
   144      * {@inheritDoc}
   145      */
   146     public final String getValue() {
   147         return Uris.decode(Strings.valueOf(getUri()));
   148     }
   150     /**
   151      * @param uri The uri to set.
   152      */
   153     public final void setUri(final URI uri) {
   154         this.uri = uri;
   155     }
   157     /**
   158      * {@inheritDoc}
   159      */
   160     public final void validate() throws ValidationException {
   161         // TODO: Auto-generated method stub
   162     }
   163 }

mercurial