001package ezvcard.property; 002 003import java.util.List; 004 005import ezvcard.SupportedVersions; 006import ezvcard.VCardVersion; 007import ezvcard.parameter.Pid; 008 009/* 010 Copyright (c) 2012-2023, Michael Angstadt 011 All rights reserved. 012 013 Redistribution and use in source and binary forms, with or without 014 modification, are permitted provided that the following conditions are met: 015 016 1. Redistributions of source code must retain the above copyright notice, this 017 list of conditions and the following disclaimer. 018 2. Redistributions in binary form must reproduce the above copyright notice, 019 this list of conditions and the following disclaimer in the documentation 020 and/or other materials provided with the distribution. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 025 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 026 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 027 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 028 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 029 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 031 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 032 033 The views and conclusions contained in the software and documentation are those 034 of the authors and should not be interpreted as representing official policies, 035 either expressed or implied, of the FreeBSD Project. 036 */ 037 038/** 039 * <p> 040 * Defines a URL that points to the person's calendar. 041 * </p> 042 * 043 * <p> 044 * <b>Code sample</b> 045 * </p> 046 * 047 * <pre class="brush:java"> 048 * VCard vcard = new VCard(); 049 * 050 * CalendarUri caluri = new CalendarUri("http://www.ibm.com/janedoe/calendar"); 051 * vcard.addCalendarUri(caluri); 052 * </pre> 053 * 054 * <p> 055 * <b>Property name:</b> {@code CALURI} 056 * </p> 057 * <p> 058 * <b>Supported versions:</b> {@code 4.0} 059 * </p> 060 * @author Michael Angstadt 061 * @see <a href="http://tools.ietf.org/html/rfc6350#page-50">RFC 6350 p.50</a> 062 */ 063@SupportedVersions(VCardVersion.V4_0) 064public class CalendarUri extends UriProperty implements HasAltId { 065 /** 066 * Creates a calendar URI property. 067 * @param uri the calendar URI 068 */ 069 public CalendarUri(String uri) { 070 super(uri); 071 } 072 073 /** 074 * Copy constructor. 075 * @param original the property to make a copy of 076 */ 077 public CalendarUri(CalendarUri original) { 078 super(original); 079 } 080 081 /** 082 * Gets the MEDIATYPE parameter. 083 * <p> 084 * <b>Supported versions:</b> {@code 4.0} 085 * </p> 086 * @return the media type or null if not set 087 */ 088 public String getMediaType() { 089 return parameters.getMediaType(); 090 } 091 092 /** 093 * Sets the MEDIATYPE parameter. 094 * <p> 095 * <b>Supported versions:</b> {@code 4.0} 096 * </p> 097 * @param mediaType the media type or null to remove 098 */ 099 public void setMediaType(String mediaType) { 100 parameters.setMediaType(mediaType); 101 } 102 103 @Override 104 public List<Pid> getPids() { 105 return super.getPids(); 106 } 107 108 @Override 109 public Integer getPref() { 110 return super.getPref(); 111 } 112 113 @Override 114 public void setPref(Integer pref) { 115 super.setPref(pref); 116 } 117 118 //@Override 119 public String getAltId() { 120 return parameters.getAltId(); 121 } 122 123 //@Override 124 public void setAltId(String altId) { 125 parameters.setAltId(altId); 126 } 127 128 /** 129 * Gets the TYPE parameter. 130 * <p> 131 * <b>Supported versions:</b> {@code 4.0} 132 * </p> 133 * @return the TYPE value (typically, this will be either "work" or "home") 134 * or null if it doesn't exist 135 */ 136 public String getType() { 137 return parameters.getType(); 138 } 139 140 /** 141 * Sets the TYPE parameter. 142 * <p> 143 * <b>Supported versions:</b> {@code 4.0} 144 * </p> 145 * @param type the TYPE value (this should be either "work" or "home") or 146 * null to remove 147 */ 148 public void setType(String type) { 149 parameters.setType(type); 150 } 151 152 @Override 153 public CalendarUri copy() { 154 return new CalendarUri(this); 155 } 156}