001package biweekly.property;
002
003import biweekly.component.VEvent;
004import biweekly.component.VFreeBusy;
005import biweekly.component.VJournal;
006import biweekly.component.VTodo;
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 * This property has different meanings depending on the component it belongs
036 * to:
037 * <ul>
038 * <li>{@link VEvent} - The organizer of the event.</li>
039 * <li>{@link VTodo} - The creator of the to-do task.</li>
040 * <li>{@link VJournal} - The owner of the journal entry.</li>
041 * <li>{@link VFreeBusy} - The person requesting the free/busy time.</li>
042 * </ul>
043 * </p>
044 * <p>
045 * <b>Code sample:</b>
046 * 
047 * <pre class="brush:java">
048 * VEvent event = new VEvent();
049 * 
050 * Organizer organizer = Organizer.email(&quot;johndoe@example.com&quot;);
051 * organizer.setCommonName(&quot;John Doe&quot;);
052 * event.setOrganizer(organizer);
053 * </pre>
054 * 
055 * </p>
056 * @author Michael Angstadt
057 * @see <a href="http://tools.ietf.org/html/rfc5545#page-111">RFC 5545
058 * p.111-2</a>
059 * @see <a href="http://tools.ietf.org/html/rfc2445#page-106">RFC 2445
060 * p.106-7</a>
061 */
062public class Organizer extends ICalProperty {
063        private String uri, email, name;
064
065        /**
066         * Creates an organizer property
067         * @param name the organizer's name (e.g. "John Doe")
068         * @param email the organizer's email address (e.g. "jdoe@example.com")
069         */
070        public Organizer(String name, String email) {
071                this.name = name;
072                this.email = email;
073        }
074
075        /**
076         * Gets the organizer's email
077         * @return the email (e.g. "jdoe@company.com")
078         */
079        public String getEmail() {
080                return email;
081        }
082
083        /**
084         * Sets the organizer's email
085         * @param email the email (e.g. "jdoe@company.com")
086         */
087        public void setEmail(String email) {
088                this.email = email;
089        }
090
091        /**
092         * Gets a URI representing the organizer.
093         * @return the URI (e.g. "mailto:jdoe@company.com")
094         */
095        public String getUri() {
096                return uri;
097        }
098
099        /**
100         * Sets a URI representing the organizer.
101         * @param uri the URI (e.g. "mailto:jdoe@company.com")
102         */
103        public void setUri(String uri) {
104                this.uri = uri;
105        }
106
107        @Override
108        public String getSentBy() {
109                return super.getSentBy();
110        }
111
112        @Override
113        public void setSentBy(String sentBy) {
114                super.setSentBy(sentBy);
115        }
116
117        @Override
118        public String getCommonName() {
119                return name;
120        }
121
122        @Override
123        public void setCommonName(String commonName) {
124                this.name = commonName;
125        }
126
127        @Override
128        public String getDirectoryEntry() {
129                return super.getDirectoryEntry();
130        }
131
132        @Override
133        public void setDirectoryEntry(String directoryEntry) {
134                super.setDirectoryEntry(directoryEntry);
135        }
136
137        /**
138         * Gets the language that the common name parameter is written in.
139         */
140        @Override
141        public String getLanguage() {
142                return super.getLanguage();
143        }
144
145        /**
146         * Sets the language that the common name parameter is written in.
147         */
148        @Override
149        public void setLanguage(String language) {
150                super.setLanguage(language);
151        }
152}