src/net/fortuna/ical4j/model/property/Completed.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 COMPLETED iCalendar component property.
    46  * 
    47  * <pre>
    48  *     4.8.2.1 Date/Time Completed
    49  *     
    50  *        Property Name: COMPLETED
    51  *     
    52  *        Purpose: This property defines the date and time that a to-do was
    53  *        actually completed.
    54  *     
    55  *        Value Type: DATE-TIME
    56  *     
    57  *        Property Parameters: Non-standard property parameters can be
    58  *        specified on this property.
    59  *     
    60  *        Conformance: The property can be specified in a &quot;VTODO&quot; calendar
    61  *        component.
    62  *     
    63  *        Description: The date and time MUST be in a UTC format.
    64  *     
    65  *        Format Definition: The property is defined by the following notation:
    66  *     
    67  *          completed  = &quot;COMPLETED&quot; compparam &quot;:&quot; date-time CRLF
    68  *     
    69  *          compparam  = *(&quot;;&quot; xparam)
    70  * </pre>
    71  * 
    72  * @author Ben Fortuna
    73  */
    74 public class Completed extends UtcProperty {
    76     private static final long serialVersionUID = 6824213281785639181L;
    78     /**
    79      * Default constructor.
    80      */
    81     public Completed() {
    82         super(COMPLETED, PropertyFactoryImpl.getInstance());
    83     }
    85     /**
    86      * @param aValue a value string for this component
    87      * @throws ParseException when the specified string is not a valid date-time represenation
    88      */
    89     public Completed(final String aValue) throws ParseException {
    90         super(COMPLETED, PropertyFactoryImpl.getInstance());
    91         setValue(aValue);
    92     }
    94     /**
    95      * @param aList a list of parameters for this component
    96      * @param aValue a value string for this component
    97      * @throws ParseException when the specified string is not a valid date-time represenation
    98      */
    99     public Completed(final ParameterList aList, final String aValue)
   100             throws ParseException {
   101         super(COMPLETED, aList, PropertyFactoryImpl.getInstance());
   102         setValue(aValue);
   103     }
   105     /**
   106      * @param aDate a date
   107      */
   108     public Completed(final DateTime aDate) {
   109         super(COMPLETED, PropertyFactoryImpl.getInstance());
   110         // time must be in UTC..
   111         aDate.setUtc(true);
   112         setDate(aDate);
   113     }
   115     /**
   116      * @param aList a list of parameters for this component
   117      * @param aDate a date
   118      */
   119     public Completed(final ParameterList aList, final DateTime aDate) {
   120         super(COMPLETED, aList, PropertyFactoryImpl.getInstance());
   121         // time must be in UTC..
   122         aDate.setUtc(true);
   123         setDate(aDate);
   124     }
   125 }

mercurial