001package ezvcard.property; 002 003import java.util.List; 004 005import ezvcard.parameter.Pid; 006 007/* 008 Copyright (c) 2012-2023, 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 * <p> 038 * Defines a URL that can be used to retrieve the most up-to-date version of the 039 * vCard. 040 * </p> 041 * 042 * <p> 043 * <b>Code sample</b> 044 * </p> 045 * 046 * <pre class="brush:java"> 047 * VCard vcard = new VCard(); 048 * 049 * Source source = new Source("http://www.company.com/employees/doe_john.vcf"); 050 * vcard.addSource(source); 051 * </pre> 052 * 053 * <p> 054 * <b>Property name:</b> {@code SOURCE} 055 * </p> 056 * <p> 057 * <b>Supported versions:</b> {@code 3.0, 4.0} 058 * </p> 059 * @author Michael Angstadt 060 * @see <a href="http://tools.ietf.org/html/rfc6350#page-24">RFC 6350 p.24</a> 061 * @see <a href="http://tools.ietf.org/html/rfc2426#page-5">RFC 2426 p.5</a> 062 */ 063public class Source extends UriProperty implements HasAltId { 064 /** 065 * Creates a source property. 066 * @param url the URL 067 */ 068 public Source(String url) { 069 super(url); 070 } 071 072 /** 073 * Copy constructor. 074 * @param original the property to make a copy of 075 */ 076 public Source(Source original) { 077 super(original); 078 } 079 080 @Override 081 public List<Pid> getPids() { 082 return super.getPids(); 083 } 084 085 @Override 086 public Integer getPref() { 087 return super.getPref(); 088 } 089 090 @Override 091 public void setPref(Integer pref) { 092 super.setPref(pref); 093 } 094 095 //@Override 096 public String getAltId() { 097 return parameters.getAltId(); 098 } 099 100 //@Override 101 public void setAltId(String altId) { 102 parameters.setAltId(altId); 103 } 104 105 @Override 106 public Source copy() { 107 return new Source(this); 108 } 109}