001 package biweekly.property; 002 003 import java.util.List; 004 005 import biweekly.component.VAlarm; 006 import biweekly.parameter.CalendarUserType; 007 import biweekly.parameter.ParticipationStatus; 008 import biweekly.parameter.Role; 009 010 /* 011 Copyright (c) 2013, Michael Angstadt 012 All rights reserved. 013 014 Redistribution and use in source and binary forms, with or without 015 modification, are permitted provided that the following conditions are met: 016 017 1. Redistributions of source code must retain the above copyright notice, this 018 list of conditions and the following disclaimer. 019 2. Redistributions in binary form must reproduce the above copyright notice, 020 this list of conditions and the following disclaimer in the documentation 021 and/or other materials provided with the distribution. 022 023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 024 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 025 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 026 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 027 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 028 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 029 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 030 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 031 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 032 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 033 */ 034 035 /** 036 * <p> 037 * Defines an attendee (such as a person attending an event). This property has 038 * different meanings depending on the component that it belongs to: 039 * <ul> 040 * <li>{@link VAlarm} (EMAIL action) - an email address that is to receive the 041 * alarm</li> 042 * <li>all others - an attendee</li> 043 * </ul> 044 * </p> 045 * 046 * <p> 047 * <b>Examples:</b> 048 * 049 * <pre> 050 * Attendee attendee = Attendee.email("johndoe@example.com") 051 * </pre> 052 * 053 * </p> 054 * @author Michael Angstadt 055 * @see <a href="http://tools.ietf.org/html/rfc5545#page-107">RFC 5545 056 * p.107-9</a> 057 */ 058 public class Attendee extends TextProperty { 059 /** 060 * Creates an attendee property. 061 * @param uri a URI representing the attendee (typically, an email address, 062 * e.g. "mailto:johndoe@example.com") 063 */ 064 public Attendee(String uri) { 065 super(uri); 066 } 067 068 /** 069 * Creates an attendee property using an email address as its value. 070 * @param email the email address (e.g. "johndoe@example.com") 071 * @return the property 072 */ 073 public static Attendee email(String email) { 074 return new Attendee("mailto:" + email); 075 } 076 077 /** 078 * Gets the type of user the attendee is (for example, an "individual" or a 079 * "room"). 080 * @return the calendar user type or null if not set 081 * @see <a href="http://tools.ietf.org/html/rfc5545#page-16">RFC 5545 082 * p.16</a> 083 */ 084 public CalendarUserType getCalendarUserType() { 085 return parameters.getCalendarUserType(); 086 } 087 088 /** 089 * Sets the type of user the attendee is (for example, an "individual" or a 090 * "room"). 091 * @param cutype the calendar user type or null to remove 092 * @see <a href="http://tools.ietf.org/html/rfc5545#page-16">RFC 5545 093 * p.16</a> 094 */ 095 public void setCalendarUserType(CalendarUserType cutype) { 096 parameters.setCalendarUserType(cutype); 097 } 098 099 /** 100 * Gets the groups that the attendee is a member of. 101 * @return the group URIs (typically, these are email address URIs, e.g. 102 * "mailto:mailinglist@example.com") 103 * @see <a href="http://tools.ietf.org/html/rfc5545#page-21">RFC 5545 104 * p.21-2</a> 105 */ 106 public List<String> getMembers() { 107 return parameters.getMembers(); 108 } 109 110 /** 111 * Adds a group that the attendee is a member of. 112 * @param uri the group URI (typically, an email address URI, e.g. 113 * "mailto:mailinglist@example.com") 114 * @see <a href="http://tools.ietf.org/html/rfc5545#page-21">RFC 5545 115 * p.21-2</a> 116 */ 117 public void addMember(String uri) { 118 parameters.addMember(uri); 119 } 120 121 /** 122 * Gets the attendee's role (for example, "chair" or 123 * "required participant"). 124 * @return the role or null if not set 125 * @see <a href="http://tools.ietf.org/html/rfc5545#page-25">RFC 5545 126 * p.25-6</a> 127 */ 128 public Role getRole() { 129 return parameters.getRole(); 130 } 131 132 /** 133 * Sets the attendee's role (for example, "chair" or 134 * "required participant"). 135 * @param role the role or null to remove 136 * @see <a href="http://tools.ietf.org/html/rfc5545#page-25">RFC 5545 137 * p.25-6</a> 138 */ 139 public void setRole(Role role) { 140 parameters.setRole(role); 141 } 142 143 /** 144 * Gets the attendee's level of participation. 145 * @return the participation status or null if not set 146 * @see <a href="http://tools.ietf.org/html/rfc5545#page-22">RFC 5545 147 * p.22-3</a> 148 */ 149 public ParticipationStatus getParticipationStatus() { 150 return parameters.getParticipationStatus(); 151 } 152 153 /** 154 * Sets the attendee's level of participation. 155 * @param status the participation status or null to remove 156 * @see <a href="http://tools.ietf.org/html/rfc5545#page-22">RFC 5545 157 * p.22-3</a> 158 */ 159 public void setParticipationStatus(ParticipationStatus status) { 160 parameters.setParticipationStatus(status); 161 } 162 163 /** 164 * Gets whether the organizer requests a response from the attendee. 165 * @return true if an RSVP is requested, false if not, null if not set 166 * @see <a href="http://tools.ietf.org/html/rfc5545#page-26">RFC 5545 167 * p.26-7</a> 168 */ 169 public Boolean getRsvp() { 170 return parameters.getRsvp(); 171 } 172 173 /** 174 * Sets whether the organizer requests a response from the attendee. 175 * @param rsvp true if an RSVP has been requested, false if not, null to 176 * remove 177 * @see <a href="http://tools.ietf.org/html/rfc5545#page-26">RFC 5545 178 * p.26-7</a> 179 */ 180 public void setRsvp(Boolean rsvp) { 181 parameters.setRsvp(rsvp); 182 } 183 184 /** 185 * Gets the people who have delegated their responsibility to the attendee. 186 * @return the delegators (typically email URIs, e.g. 187 * "mailto:janedoe@example.com") 188 * @see <a href="http://tools.ietf.org/html/rfc5545#page-17">RFC 5545 189 * p.17</a> 190 */ 191 public List<String> getDelegatedFrom() { 192 return parameters.getDelegatedFrom(); 193 } 194 195 /** 196 * Adds a person who has delegated his or her responsibility to the 197 * attendee. 198 * @param uri the delegator (typically an email URI, e.g. 199 * "mailto:janedoe@example.com") 200 * @see <a href="http://tools.ietf.org/html/rfc5545#page-17">RFC 5545 201 * p.17</a> 202 */ 203 public void addDelegatedFrom(String uri) { 204 parameters.addDelegatedFrom(uri); 205 } 206 207 /** 208 * Gets the people to which the attendee has delegated his or her 209 * responsibility. 210 * @return the delegatees (typically email URIs, e.g. 211 * "mailto:janedoe@example.com") 212 * @see <a href="http://tools.ietf.org/html/rfc5545#page-17">RFC 5545 213 * p.17-8</a> 214 */ 215 public List<String> getDelegatedTo() { 216 return parameters.getDelegatedTo(); 217 } 218 219 /** 220 * Adds a person to which the attendee has delegated his or her 221 * responsibility. 222 * @param uri the delegatee (typically an email URI, e.g. 223 * "mailto:janedoe@example.com") 224 * @see <a href="http://tools.ietf.org/html/rfc5545#page-17">RFC 5545 225 * p.17-8</a> 226 */ 227 public void addDelegatedTo(String uri) { 228 parameters.addDelegatedTo(uri); 229 } 230 231 @Override 232 public String getSentBy() { 233 return super.getSentBy(); 234 } 235 236 @Override 237 public void setSentBy(String uri) { 238 super.setSentBy(uri); 239 } 240 241 @Override 242 public String getCommonName() { 243 return super.getCommonName(); 244 } 245 246 @Override 247 public void setCommonName(String commonName) { 248 super.setCommonName(commonName); 249 } 250 251 @Override 252 public String getDirectoryEntry() { 253 return super.getDirectoryEntry(); 254 } 255 256 @Override 257 public void setDirectoryEntry(String uri) { 258 super.setDirectoryEntry(uri); 259 } 260 261 /** 262 * Gets the language that the common name parameter is written in. 263 */ 264 @Override 265 public String getLanguage() { 266 return super.getLanguage(); 267 } 268 269 /** 270 * Sets the language that the common name parameter is written in. 271 */ 272 @Override 273 public void setLanguage(String language) { 274 super.setLanguage(language); 275 } 276 277 }