001 package ezvcard.types; 002 003 import ezvcard.VCardSubTypes; 004 import ezvcard.VCardVersion; 005 006 /* 007 Copyright (c) 2012, Michael Angstadt 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without 011 modification, are permitted provided that the following conditions are met: 012 013 1. Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 2. Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 023 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 030 The views and conclusions contained in the software and documentation are those 031 of the authors and should not be interpreted as representing official policies, 032 either expressed or implied, of the FreeBSD Project. 033 */ 034 035 /** 036 * Defines a URI representing the person's work place, which can be used to 037 * lookup information on the person's co-workers. 038 * 039 * <pre> 040 * VCard vcard = new VCard(); 041 * OrgDirectoryType orgDirectory = new OrgDirectoryType("http://www.company.com/staff"); 042 * vcard.addOrgDirectory(orgDirectory); 043 * </pre> 044 * 045 * <p> 046 * vCard property name: ORG-DIRECTORY 047 * </p> 048 * <p> 049 * vCard versions: 4.0 050 * </p> 051 * @author Michael Angstadt 052 * @see <a href="http://tools.ietf.org/html/rfc6715">RFC 6715</a> 053 */ 054 public class OrgDirectoryType extends UriType { 055 public static final String NAME = "ORG-DIRECTORY"; 056 057 public OrgDirectoryType() { 058 this(null); 059 } 060 061 /** 062 * @param uri the URI 063 */ 064 public OrgDirectoryType(String uri) { 065 super(NAME, uri); 066 } 067 068 @Override 069 public VCardVersion[] getSupportedVersions() { 070 return new VCardVersion[] { VCardVersion.V4_0 }; 071 } 072 073 /** 074 * Gets the INDEX parameter. 075 * @return the INDEX or null if not set 076 * @see VCardSubTypes#getIndex 077 */ 078 public Integer getIndex() { 079 return subTypes.getIndex(); 080 } 081 082 /** 083 * Sets the INDEX parameter. 084 * @param index the INDEX or null to remove 085 * @see VCardSubTypes#setIndex 086 */ 087 public void setIndex(Integer index) { 088 subTypes.setIndex(index); 089 } 090 091 /** 092 * Gets the TYPE parameter. 093 * @return the TYPE value (typically, this will be either "work" or "home") 094 * or null if it doesn't exist 095 */ 096 public String getType() { 097 return subTypes.getType(); 098 } 099 100 /** 101 * Sets the TYPE parameter. 102 * @param type the TYPE value (this should be either "work" or "home") or 103 * null to remove 104 */ 105 public void setType(String type) { 106 subTypes.setType(type); 107 } 108 109 /** 110 * Gets the LANGUAGE parameter. 111 * @return the language or null if not set 112 * @see VCardSubTypes#getLanguage 113 */ 114 public String getLanguage() { 115 return subTypes.getLanguage(); 116 } 117 118 /** 119 * Sets the LANGUAGE parameter. 120 * @param language the language or null to remove 121 * @see VCardSubTypes#setLanguage 122 */ 123 public void setLanguage(String language) { 124 subTypes.setLanguage(language); 125 } 126 127 /** 128 * Gets the preference value. 129 * <p> 130 * vCard versions: 4.0 131 * </p> 132 * @return the preference value or null if it doesn't exist 133 * @see VCardSubTypes#getPref 134 */ 135 public Integer getPref() { 136 return subTypes.getPref(); 137 } 138 139 /** 140 * Sets the preference value. 141 * <p> 142 * vCard versions: 4.0 143 * </p> 144 * @param pref the preference value or null to remove 145 * @see VCardSubTypes#setPref 146 */ 147 public void setPref(Integer pref) { 148 subTypes.setPref(pref); 149 } 150 151 /** 152 * Gets the ALTID. 153 * <p> 154 * vCard versions: 4.0 155 * </p> 156 * @return the ALTID or null if it doesn't exist 157 * @see VCardSubTypes#getAltId 158 */ 159 public String getAltId() { 160 return subTypes.getAltId(); 161 } 162 163 /** 164 * Sets the ALTID. 165 * <p> 166 * vCard versions: 4.0 167 * </p> 168 * @param altId the ALTID or null to remove 169 * @see VCardSubTypes#setAltId 170 */ 171 public void setAltId(String altId) { 172 subTypes.setAltId(altId); 173 } 174 }