src/net/fortuna/ical4j/model/property/Created.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.text.ParseException;
    36 import net.fortuna.ical4j.model.DateTime;
    37 import net.fortuna.ical4j.model.ParameterList;
    38 import net.fortuna.ical4j.model.PropertyFactoryImpl;
    40 /**
    41  * $Id$
    42  * 
    43  * Created: [Apr 6, 2004]
    44  *
    45  * Defines a CREATED iCalendar component property.
    46  * 
    47  * <pre>
    48  *     4.8.7.1 Date/Time Created
    49  *     
    50  *        Property Name: CREATED
    51  *     
    52  *        Purpose: This property specifies the date and time that the calendar
    53  *        information was created by the calendar user agent in the calendar
    54  *        store.
    55  *     
    56  *             Note: This is analogous to the creation date and time for a file
    57  *             in the file system.
    58  *     
    59  *        Value Type: DATE-TIME
    60  *     
    61  *        Property Parameters: Non-standard property parameters can be
    62  *        specified on this property.
    63  *     
    64  *        Conformance: The property can be specified once in &quot;VEVENT&quot;, &quot;VTODO&quot;
    65  *        or &quot;VJOURNAL&quot; calendar components.
    66  *     
    67  *        Description: The date and time is a UTC value.
    68  *     
    69  *        Format Definition: The property is defined by the following notation:
    70  *     
    71  *          created    = &quot;CREATED&quot; creaparam &quot;:&quot; date-time CRLF
    72  *     
    73  *          creaparam  = *(&quot;;&quot; xparam)
    74  * </pre>
    75  * 
    76  * @author Ben Fortuna
    77  */
    78 public class Created extends UtcProperty {
    80     private static final long serialVersionUID = -8658935097721652961L;
    82     /**
    83      * Default constructor.
    84      */
    85     public Created() {
    86         super(CREATED, PropertyFactoryImpl.getInstance());
    87     }
    89     /**
    90      * @param aValue a value string for this component
    91      * @throws ParseException where the specified value string is not a valid date-time/date representation
    92      */
    93     public Created(final String aValue) throws ParseException {
    94         super(CREATED, PropertyFactoryImpl.getInstance());
    95         setValue(aValue);
    96     }
    98     /**
    99      * @param aList a list of parameters for this component
   100      * @param aValue a value string for this component
   101      * @throws ParseException where the specified value string is not a valid date-time/date representation
   102      */
   103     public Created(final ParameterList aList, final String aValue)
   104             throws ParseException {
   105         super(CREATED, aList, PropertyFactoryImpl.getInstance());
   106         setValue(aValue);
   107     }
   109     /**
   110      * @param aDate a date
   111      */
   112     public Created(final DateTime aDate) {
   113         super(CREATED, PropertyFactoryImpl.getInstance());
   114         // time must be in UTC..
   115         aDate.setUtc(true);
   116         setDate(aDate);
   117     }
   119     /**
   120      * @param aList a list of parameters for this component
   121      * @param aDate a date
   122      */
   123     public Created(final ParameterList aList, final DateTime aDate) {
   124         super(CREATED, aList, PropertyFactoryImpl.getInstance());
   125         // time must be in UTC..
   126         aDate.setUtc(true);
   127         setDate(aDate);
   128     }
   129 }

mercurial