001    package ezvcard.property;
002    
003    import java.util.List;
004    
005    import ezvcard.parameter.VCardParameters;
006    
007    /*
008     Copyright (c) 2013, 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     * A list of organizations the person belongs to. The list is ordered. It starts
038     * with the broadest organization and ends with the most specific.
039     * 
040     * <p>
041     * <b>Code sample</b>
042     * </p>
043     * 
044     * <pre class="brush:java">
045     * VCard vcard = new VCard();
046     * Organization org = new Organization();
047     * org.addValue(&quot;Google&quot;);
048     * org.addValue(&quot;GMail Team&quot;);
049     * org.addValue(&quot;Spam Detection Team&quot;);
050     * vcard.setOrganizations(org);
051     * </pre>
052     * 
053     * <p>
054     * <b>Property name:</b> {@code ORG}
055     * </p>
056     * <p>
057     * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0}
058     * </p>
059     * @author Michael Angstadt
060     */
061    public class Organization extends TextListProperty implements HasAltId {
062            @Override
063            public String getLanguage() {
064                    return super.getLanguage();
065            }
066    
067            @Override
068            public void setLanguage(String language) {
069                    super.setLanguage(language);
070            }
071    
072            /**
073             * Gets the TYPE parameter.
074             * <p>
075             * <b>Supported versions:</b> {@code 4.0}
076             * </p>
077             * @return the TYPE value (typically, this will be either "work" or "home")
078             * or null if it doesn't exist
079             */
080            public String getType() {
081                    return parameters.getType();
082            }
083    
084            /**
085             * Sets the TYPE parameter.
086             * <p>
087             * <b>Supported versions:</b> {@code 4.0}
088             * </p>
089             * @param type the TYPE value (this should be either "work" or "home") or
090             * null to remove
091             */
092            public void setType(String type) {
093                    parameters.setType(type);
094            }
095    
096            @Override
097            public List<Integer[]> getPids() {
098                    return super.getPids();
099            }
100    
101            @Override
102            public void addPid(int localId, int clientPidMapRef) {
103                    super.addPid(localId, clientPidMapRef);
104            }
105    
106            @Override
107            public void removePids() {
108                    super.removePids();
109            }
110    
111            @Override
112            public Integer getPref() {
113                    return super.getPref();
114            }
115    
116            @Override
117            public void setPref(Integer pref) {
118                    super.setPref(pref);
119            }
120    
121            //@Override
122            public String getAltId() {
123                    return parameters.getAltId();
124            }
125    
126            //@Override
127            public void setAltId(String altId) {
128                    parameters.setAltId(altId);
129            }
130    
131            /**
132             * Gets the string(s) that define how to sort the vCard.
133             * <p>
134             * 2.1 and 3.0 vCards should use the {@link SortString SORT-STRING}
135             * property instead.
136             * </p>
137             * <p>
138             * <b>Supported versions:</b> {@code 4.0}
139             * </p>
140             * @return the sort string(s) or empty list if there are none
141             * @see VCardParameters#getSortAs
142             */
143            public List<String> getSortAs() {
144                    return parameters.getSortAs();
145            }
146    
147            /**
148             * Sets the string(s) that define how to sort the vCard. These strings
149             * correspond to the values that are in this property.
150             * <p>
151             * 2.1 and 3.0 vCards should use the {@link SortString SORT-STRING}
152             * property instead.
153             * </p>
154             * <p>
155             * <b>Supported versions:</b> {@code 4.0}
156             * </p>
157             * @param names the names or empty parameter list to remove
158             * @see VCardParameters#setSortAs
159             */
160            public void setSortAs(String... names) {
161                    parameters.setSortAs(names);
162            }
163    }