Home | History | Annotate | Download | only in extensions
      1 package gov.nist.javax.sip.header.extensions;
      2 
      3 import gov.nist.javax.sip.header.ParametersHeader;
      4 
      5 import java.text.ParseException;
      6 import java.util.Iterator;
      7 
      8 import javax.sip.header.ExtensionHeader;
      9 
     10 public class References extends ParametersHeader  implements ReferencesHeader,ExtensionHeader  {
     11 
     12     private static final long serialVersionUID = 8536961681006637622L;
     13 
     14 
     15     private String callId;
     16 
     17     public References() {
     18         super(ReferencesHeader.NAME);
     19     }
     20 
     21 
     22 
     23 
     24     public String getCallId() {
     25        return callId;
     26     }
     27 
     28 
     29 
     30     public String getRel() {
     31         return this.getParameter(REL);
     32     }
     33 
     34 
     35 
     36 
     37     public void setCallId(String callId) {
     38         this.callId = callId;
     39     }
     40 
     41 
     42     public void setRel(String rel) throws ParseException{
     43       if ( rel != null ) {
     44           this.setParameter(REL,rel);
     45       }
     46     }
     47 
     48 
     49     public String getParameter(String name) {
     50         return super.getParameter(name);
     51     }
     52 
     53 
     54     public Iterator getParameterNames() {
     55         return super.getParameterNames();
     56     }
     57 
     58 
     59     public void removeParameter(String name) {
     60        super.removeParameter(name);
     61     }
     62 
     63 
     64     public void setParameter(String name, String value) throws ParseException {
     65        super.setParameter(name,value);
     66     }
     67 
     68 
     69     public String getName() {
     70         return ReferencesHeader.NAME;
     71     }
     72 
     73 
     74     protected String encodeBody() {
     75         if ( super.parameters.isEmpty()) {
     76             return callId ;
     77         } else {
     78             return callId + ";" + super.parameters.encode();
     79         }
     80     }
     81 
     82 
     83     public void setValue(String value) throws ParseException {
     84         throw new UnsupportedOperationException("operation not supported");
     85     }
     86 
     87 }
     88