001 package ezvcard.types; 002 003 import java.util.List; 004 005 import ezvcard.VCardSubTypes; 006 import ezvcard.VCardVersion; 007 008 /* 009 Copyright (c) 2012, 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 The views and conclusions contained in the software and documentation are those 033 of the authors and should not be interpreted as representing official policies, 034 either expressed or implied, of the FreeBSD Project. 035 */ 036 037 /** 038 * A URL to use for sending a scheduling request to the person's calendar. 039 * 040 * <pre> 041 * VCard vcard = new VCard(); 042 * CalendarRequestUriType caladruri = new CalendarRequestUriType("mailto:janedoe@ibm.com"); 043 * caladruri.setPref(1); 044 * vcard.addCalendarRequestUri(caladruri); 045 * caladruri = new CalendarRequestUriType("http://www.ibm.com/janedoe/calendar"); 046 * caladruri.setPref(2); 047 * vcard.addCalendarRequestUri(caladruri); 048 * </pre> 049 * 050 * <p> 051 * vCard property name: CALADRURI 052 * </p> 053 * <p> 054 * vCard versions: 4.0 055 * </p> 056 * @author Michael Angstadt 057 */ 058 public class CalendarRequestUriType extends UriType { 059 public static final String NAME = "CALADRURI"; 060 061 public CalendarRequestUriType() { 062 super(NAME); 063 } 064 065 /** 066 * @param uri the calendar request URI 067 */ 068 public CalendarRequestUriType(String uri) { 069 super(NAME, uri); 070 } 071 072 /** 073 * Gets the MEDIATYPE parameter. 074 * <p> 075 * vCard versions: 4.0 076 * </p> 077 * @return the media type or null if not set 078 */ 079 public String getMediaType() { 080 return subTypes.getMediaType(); 081 } 082 083 /** 084 * Sets the MEDIATYPE parameter. 085 * <p> 086 * vCard versions: 4.0 087 * </p> 088 * @param mediaType the media type or null to remove 089 */ 090 public void setMediaType(String mediaType) { 091 subTypes.setMediaType(mediaType); 092 } 093 094 /** 095 * Gets all PID parameter values. 096 * <p> 097 * vCard versions: 4.0 098 * </p> 099 * @return the PID values or empty set if there are none 100 * @see VCardSubTypes#getPids 101 */ 102 public List<Integer[]> getPids() { 103 return subTypes.getPids(); 104 } 105 106 /** 107 * Adds a PID value. 108 * <p> 109 * vCard versions: 4.0 110 * </p> 111 * @param localId the local ID 112 * @param clientPidMapRef the ID used to reference the property's globally 113 * unique identifier in the CLIENTPIDMAP property. 114 * @see VCardSubTypes#addPid(int, int) 115 */ 116 public void addPid(int localId, int clientPidMapRef) { 117 subTypes.addPid(localId, clientPidMapRef); 118 } 119 120 /** 121 * Removes all PID values. 122 * <p> 123 * vCard versions: 4.0 124 * </p> 125 * @see VCardSubTypes#removePids 126 */ 127 public void removePids() { 128 subTypes.removePids(); 129 } 130 131 /** 132 * Gets the preference value. 133 * <p> 134 * vCard versions: 4.0 135 * </p> 136 * @return the preference value or null if it doesn't exist 137 * @see VCardSubTypes#getPref 138 */ 139 public Integer getPref() { 140 return subTypes.getPref(); 141 } 142 143 /** 144 * Sets the preference value. 145 * <p> 146 * vCard versions: 4.0 147 * </p> 148 * @param pref the preference value or null to remove 149 * @see VCardSubTypes#setPref 150 */ 151 public void setPref(Integer pref) { 152 subTypes.setPref(pref); 153 } 154 155 /** 156 * Gets the ALTID. 157 * <p> 158 * vCard versions: 4.0 159 * </p> 160 * @return the ALTID or null if it doesn't exist 161 * @see VCardSubTypes#getAltId 162 */ 163 public String getAltId() { 164 return subTypes.getAltId(); 165 } 166 167 /** 168 * Sets the ALTID. 169 * <p> 170 * vCard versions: 4.0 171 * </p> 172 * @param altId the ALTID or null to remove 173 * @see VCardSubTypes#setAltId 174 */ 175 public void setAltId(String altId) { 176 subTypes.setAltId(altId); 177 } 178 179 /** 180 * Gets the TYPE parameter. 181 * <p> 182 * vCard versions: 4.0 183 * </p> 184 * @return the TYPE value (typically, this will be either "work" or "home") 185 * or null if it doesn't exist 186 */ 187 public String getType() { 188 return subTypes.getType(); 189 } 190 191 /** 192 * Sets the TYPE parameter. 193 * <p> 194 * vCard versions: 4.0 195 * </p> 196 * @param type the TYPE value (this should be either "work" or "home") or 197 * null to remove 198 */ 199 public void setType(String type) { 200 subTypes.setType(type); 201 } 202 203 @Override 204 public VCardVersion[] getSupportedVersions() { 205 return new VCardVersion[] { VCardVersion.V4_0 }; 206 } 207 }