001 package ezvcard.property;
002
003 import java.util.EnumSet;
004 import java.util.List;
005 import java.util.Set;
006
007 import ezvcard.VCardVersion;
008
009 /*
010 Copyright (c) 2013, 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 * A URL to use for sending a scheduling request to the person's calendar.
040 *
041 * <p>
042 * <b>Code sample</b>
043 * </p>
044 *
045 * <pre class="brush:java">
046 * VCard vcard = new VCard();
047 * CalendarRequestUri caladruri = new CalendarRequestUri("mailto:janedoe@ibm.com");
048 * caladruri.setPref(1);
049 * vcard.addCalendarRequestUri(caladruri);
050 * caladruri = new CalendarRequestUri("http://www.ibm.com/janedoe/calendar");
051 * caladruri.setPref(2);
052 * vcard.addCalendarRequestUri(caladruri);
053 * </pre>
054 *
055 * <p>
056 * <b>Property name:</b> {@code CALADRURI}
057 * </p>
058 * <p>
059 * <b>Supported versions:</b> {@code 4.0}
060 * </p>
061 * @author Michael Angstadt
062 */
063 public class CalendarRequestUri extends UriProperty implements HasAltId {
064 /**
065 * Creates a calendar request URI property.
066 * @param uri the calendar request URI
067 */
068 public CalendarRequestUri(String uri) {
069 super(uri);
070 }
071
072 @Override
073 public Set<VCardVersion> _supportedVersions() {
074 return EnumSet.of(VCardVersion.V4_0);
075 }
076
077 /**
078 * Gets the MEDIATYPE parameter.
079 * <p>
080 * <b>Supported versions:</b> {@code 4.0}
081 * </p>
082 * @return the media type or null if not set
083 */
084 public String getMediaType() {
085 return parameters.getMediaType();
086 }
087
088 /**
089 * Sets the MEDIATYPE parameter.
090 * <p>
091 * <b>Supported versions:</b> {@code 4.0}
092 * </p>
093 * @param mediaType the media type or null to remove
094 */
095 public void setMediaType(String mediaType) {
096 parameters.setMediaType(mediaType);
097 }
098
099 @Override
100 public List<Integer[]> getPids() {
101 return super.getPids();
102 }
103
104 @Override
105 public void addPid(int localId, int clientPidMapRef) {
106 super.addPid(localId, clientPidMapRef);
107 }
108
109 @Override
110 public void removePids() {
111 super.removePids();
112 }
113
114 @Override
115 public Integer getPref() {
116 return super.getPref();
117 }
118
119 @Override
120 public void setPref(Integer pref) {
121 super.setPref(pref);
122 }
123
124 //@Override
125 public String getAltId() {
126 return parameters.getAltId();
127 }
128
129 //@Override
130 public void setAltId(String altId) {
131 parameters.setAltId(altId);
132 }
133
134 /**
135 * Gets the TYPE parameter.
136 * <p>
137 * <b>Supported versions:</b> {@code 4.0}
138 * </p>
139 * @return the TYPE value (typically, this will be either "work" or "home")
140 * or null if it doesn't exist
141 */
142 public String getType() {
143 return parameters.getType();
144 }
145
146 /**
147 * Sets the TYPE parameter.
148 * <p>
149 * <b>Supported versions:</b> {@code 4.0}
150 * </p>
151 * @param type the TYPE value (this should be either "work" or "home") or
152 * null to remove
153 */
154 public void setType(String type) {
155 parameters.setType(type);
156 }
157 }