Home | History | Annotate | Download | only in ims
      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 INOVAO - 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.PAssertedIdentityHeader;
     39 
     40 import gov.nist.javax.sip.header.AddressParametersHeader;
     41 
     42 
     43 /**
     44  * P-Asserted-Identity SIP Private Header.
     45  *
     46  * @author ALEXANDRE MIGUEL SILVA SANTOS - N 10045401
     47  */
     48 
     49 public class PAssertedIdentity
     50     extends AddressParametersHeader
     51     implements PAssertedIdentityHeader, SIPHeaderNamesIms, ExtensionHeader {
     52 
     53 
     54 
     55     /**
     56      * constructor
     57      * @param address address to set
     58      */
     59     public PAssertedIdentity(AddressImpl address) {
     60         super(NAME);
     61         this.address = address;
     62     }
     63 
     64     /**
     65      * default constructor
     66      */
     67     public PAssertedIdentity()
     68     {
     69         super(NAME);
     70     }
     71 
     72     /** Encode into canonical form.
     73      *@return String containing the canonicaly encoded header.
     74      */
     75     public String encodeBody() {
     76         StringBuffer retval = new StringBuffer();
     77         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
     78             retval.append(LESS_THAN);
     79         }
     80         retval.append(address.encode());
     81         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
     82             retval.append(GREATER_THAN);
     83         }
     84 
     85 
     86         if (!parameters.isEmpty())
     87             retval.append(COMMA + this.parameters.encode());
     88         return retval.toString();
     89     }
     90 
     91 
     92     public Object clone() {
     93         PAssertedIdentity retval = (PAssertedIdentity) super.clone();
     94         return retval;
     95     }
     96 
     97 
     98     public void setValue(String value) throws ParseException {
     99         throw new ParseException(value,0);
    100 
    101     }
    102 
    103 
    104 }
    105