001    package ezvcard.types;
002    
003    import java.util.List;
004    
005    import ezvcard.VCardSubTypes;
006    
007    /*
008     Copyright (c) 2012, Michael Angstadt
009     All rights reserved.
010    
011     Redistribution and use in source and binary forms, with or without
012     modification, are permitted provided that the following conditions are met: 
013    
014     1. Redistributions of source code must retain the above copyright notice, this
015     list of conditions and the following disclaimer. 
016     2. Redistributions in binary form must reproduce the above copyright notice,
017     this list of conditions and the following disclaimer in the documentation
018     and/or other materials provided with the distribution. 
019    
020     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
021     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
022     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
023     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
024     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
025     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
026     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
027     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
029     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030    
031     The views and conclusions contained in the software and documentation are those
032     of the authors and should not be interpreted as representing official policies, 
033     either expressed or implied, of the FreeBSD Project.
034     */
035    
036    /**
037     * The person's position or job in his or her organization.
038     * 
039     * <pre>
040     * VCard vcard = new VCard();
041     * TitleType title = new TitleType(&quot;Research Scientist&quot;);
042     * vcard.addTitle(title);
043     * </pre>
044     * 
045     * <p>
046     * vCard property name: TITLE
047     * </p>
048     * <p>
049     * vCard versions: 2.1, 3.0, 4.0
050     * </p>
051     * 
052     * @author Michael Angstadt
053     */
054    public class TitleType extends TextType {
055            public static final String NAME = "TITLE";
056    
057            public TitleType() {
058                    this(null);
059            }
060    
061            /**
062             * @param title the title (e.g. "Team Lead")
063             */
064            public TitleType(String title) {
065                    super(NAME, title);
066            }
067    
068            /**
069             * Gets the language that the address is written in.
070             * @return the language or null if not set
071             * @see VCardSubTypes#getLanguage
072             */
073            public String getLanguage() {
074                    return subTypes.getLanguage();
075            }
076    
077            /**
078             * Sets the language that the address is written in.
079             * @param language the language or null to remove
080             * @see VCardSubTypes#setLanguage
081             */
082            public void setLanguage(String language) {
083                    subTypes.setLanguage(language);
084            }
085    
086            /**
087             * Gets the TYPE parameter.
088             * <p>
089             * vCard versions: 4.0
090             * </p>
091             * @return the TYPE value (typically, this will be either "work" or "home")
092             * or null if it doesn't exist
093             */
094            public String getType() {
095                    return subTypes.getType();
096            }
097    
098            /**
099             * Sets the TYPE parameter.
100             * <p>
101             * vCard versions: 4.0
102             * </p>
103             * @param type the TYPE value (this should be either "work" or "home") or
104             * null to remove
105             */
106            public void setType(String type) {
107                    subTypes.setType(type);
108            }
109    
110            /**
111             * Gets all PID parameter values.
112             * <p>
113             * vCard versions: 4.0
114             * </p>
115             * @return the PID values or empty set if there are none
116             * @see VCardSubTypes#getPids
117             */
118            public List<Integer[]> getPids() {
119                    return subTypes.getPids();
120            }
121    
122            /**
123             * Adds a PID value.
124             * <p>
125             * vCard versions: 4.0
126             * </p>
127             * @param localId the local ID
128             * @param clientPidMapRef the ID used to reference the property's globally
129             * unique identifier in the CLIENTPIDMAP property.
130             * @see VCardSubTypes#addPid(int, int)
131             */
132            public void addPid(int localId, int clientPidMapRef) {
133                    subTypes.addPid(localId, clientPidMapRef);
134            }
135    
136            /**
137             * Removes all PID values.
138             * <p>
139             * vCard versions: 4.0
140             * </p>
141             * @see VCardSubTypes#removePids
142             */
143            public void removePids() {
144                    subTypes.removePids();
145            }
146    
147            /**
148             * Gets the preference value.
149             * <p>
150             * vCard versions: 4.0
151             * </p>
152             * @return the preference value or null if it doesn't exist
153             * @see VCardSubTypes#getPref
154             */
155            public Integer getPref() {
156                    return subTypes.getPref();
157            }
158    
159            /**
160             * Sets the preference value.
161             * <p>
162             * vCard versions: 4.0
163             * </p>
164             * @param pref the preference value or null to remove
165             * @see VCardSubTypes#setPref
166             */
167            public void setPref(Integer pref) {
168                    subTypes.setPref(pref);
169            }
170    
171            /**
172             * Gets the ALTID.
173             * <p>
174             * vCard versions: 4.0
175             * </p>
176             * @return the ALTID or null if it doesn't exist
177             * @see VCardSubTypes#getAltId
178             */
179            public String getAltId() {
180                    return subTypes.getAltId();
181            }
182    
183            /**
184             * Sets the ALTID.
185             * <p>
186             * vCard versions: 4.0
187             * </p>
188             * @param altId the ALTID or null to remove
189             * @see VCardSubTypes#setAltId
190             */
191            public void setAltId(String altId) {
192                    subTypes.setAltId(altId);
193            }
194    }