001package biweekly.property; 002 003import java.util.Date; 004 005import biweekly.parameter.Range; 006import biweekly.util.ICalDate; 007 008/* 009 Copyright (c) 2013-2015, Michael Angstadt 010 All rights reserved. 011 012 Redistribution and use in source and binary forms, with or without 013 modification, are permitted provided that the following conditions are met: 014 015 1. Redistributions of source code must retain the above copyright notice, this 016 list of conditions and the following disclaimer. 017 2. Redistributions in binary form must reproduce the above copyright notice, 018 this list of conditions and the following disclaimer in the documentation 019 and/or other materials provided with the distribution. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 024 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 025 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 026 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 027 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 028 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 030 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 031 */ 032 033/** 034 * <p> 035 * Records the original value of the {@link DateStart} property if a recurrence 036 * instance has been modified. It is used in conjunction with the {@link Uid} 037 * and {@link Sequence} properties to uniquely identify a recurrence instance. 038 * </p> 039 * <p> 040 * <b>Code sample:</b> 041 * 042 * <pre class="brush:java"> 043 * VEvent event = new VEvent(); 044 * 045 * //date-time value 046 * Date datetime = ... 047 * RecurrenceId recurrenceId = new RecurrenceId(datetime); 048 * event.setRecurrenceId(recurrenceId); 049 * 050 * //date value 051 * Date date = ... 052 * RecurrenceId recurrenceId = new RecurrenceId(date, false); 053 * event.setRecurrenceId(recurrenceId); 054 * </pre> 055 * 056 * </p> 057 * @author Michael Angstadt 058 * @see <a href="http://tools.ietf.org/html/rfc5545#page-112">RFC 5545 059 * p.112-4</a> 060 * @see <a href="http://tools.ietf.org/html/rfc2445#page-107">RFC 2445 061 * p.107-9</a> 062 */ 063public class RecurrenceId extends DateOrDateTimeProperty { 064 /** 065 * Creates a recurrence ID property. 066 * @param originalStartDate the original start date 067 */ 068 public RecurrenceId(ICalDate originalStartDate) { 069 super(originalStartDate); 070 } 071 072 /** 073 * Creates a recurrence ID property. 074 * @param originalStartDate the original start date 075 */ 076 public RecurrenceId(Date originalStartDate) { 077 super(originalStartDate); 078 } 079 080 /** 081 * Creates a recurrence ID property. 082 * @param originalStartDate the original start date 083 * @param hasTime true to include the time component of the date, false not 084 * to 085 */ 086 public RecurrenceId(Date originalStartDate, boolean hasTime) { 087 super(originalStartDate, hasTime); 088 } 089 090 /** 091 * Gets the effective range of recurrence instances from the instance 092 * specified by this property. 093 * @return the range or null if not set 094 * @see <a href="http://tools.ietf.org/html/rfc5545#page-23">RFC 5545 095 * p.23-4</a> 096 */ 097 public Range getRange() { 098 return parameters.getRange(); 099 } 100 101 /** 102 * Sets the effective range of recurrence instances from the instance 103 * specified by this property. 104 * @param range the range or null to remove 105 * @see <a href="http://tools.ietf.org/html/rfc5545#page-23">RFC 5545 106 * p.23-4</a> 107 */ 108 public void setRange(Range range) { 109 parameters.setRange(range); 110 } 111}