1 /* 2 * Conditions Of Use 3 * 4 * This software was developed by employees of the National Institute of 5 * Standards and Technology (NIST), an agency of the Federal Government 6 * and others. 7 * Pursuant to title 15 Untied States Code Section 105, works of NIST 8 * employees are not subject to copyright protection in the United States 9 * and are considered to be in the public domain. As a result, a formal 10 * license is not needed to use the software. 11 * 12 * This software is provided by NIST as a service and is expressly 13 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 14 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 16 * AND DATA ACCURACY. NIST does not warrant or make any representations 17 * regarding the use of the software or the results thereof, including but 18 * not limited to the correctness, accuracy, reliability or usefulness of 19 * the software. 20 * 21 * Permission to use this software is contingent upon your acceptance 22 * of the terms of this agreement 23 * 24 * . 25 * 26 */ 27 /******************************************* 28 * PRODUCT OF PT INOVACAO - EST DEPARTMENT * 29 *******************************************/ 30 31 package gov.nist.javax.sip.header.ims; 32 33 import java.text.ParseException; 34 35 import javax.sip.header.ExtensionHeader; 36 37 import gov.nist.javax.sip.address.AddressImpl; 38 import gov.nist.javax.sip.header.ims.PCalledPartyIDHeader; 39 40 /** 41 * P-Called-Party-ID SIP Private Header. 42 * 43 * @author ALEXANDRE MIGUEL SILVA SANTOS - N 10045401 44 */ 45 46 public class PCalledPartyID 47 extends gov.nist.javax.sip.header.AddressParametersHeader 48 implements PCalledPartyIDHeader, SIPHeaderNamesIms , ExtensionHeader{ 49 50 /** 51 * constructor 52 * @param address address to set 53 */ 54 public PCalledPartyID(AddressImpl address) { 55 super(NAME); 56 this.address = address; 57 } 58 59 /** 60 * default constructor 61 */ 62 public PCalledPartyID() { 63 super(CALLED_PARTY_ID); 64 65 } 66 67 /** Encode into canonical form. 68 *@return String containing the canonicaly encoded header. 69 */ 70 public String encodeBody() { 71 StringBuffer retval = new StringBuffer(); 72 if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) { 73 retval.append(LESS_THAN); 74 } 75 retval.append(address.encode()); 76 if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) { 77 retval.append(GREATER_THAN); 78 } 79 80 if (!parameters.isEmpty()) 81 retval.append(SEMICOLON + this.parameters.encode()); 82 return retval.toString(); 83 } 84 85 public void setValue(String value) throws ParseException { 86 // not implemented. 87 throw new ParseException(value,0); 88 89 } 90 91 } 92