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 * Pursuant to title 15 Untied States Code Section 105, works of NIST 7 * employees are not subject to copyright protection in the United States 8 * and are considered to be in the public domain. As a result, a formal 9 * license is not needed to use the software. 10 * 11 * This software is provided by NIST as a service and is expressly 12 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 15 * AND DATA ACCURACY. NIST does not warrant or make any representations 16 * regarding the use of the software or the results thereof, including but 17 * not limited to the correctness, accuracy, reliability or usefulness of 18 * the software. 19 * 20 * Permission to use this software is contingent upon your acceptance 21 * of the terms of this agreement 22 * 23 * . 24 * 25 */ 26 /******************************************************************************* 27 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * 28 *******************************************************************************/ 29 package gov.nist.javax.sip.header; 30 31 import java.util.*; 32 import java.text.ParseException; 33 import javax.sip.header.*; 34 35 /** 36 * List of AllowEvents headers. 37 * The sip message can have multiple AllowEvents headers which are strung 38 * together in a list. 39 * 40 * @author M. Ranganathan <br/> 41 * @author Olivier Deruelle <br/> 42 * 43 * 44 * @version 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:57:26 $ 45 * @since 1.1 46 * 47 */ 48 public class AllowEventsList extends SIPHeaderList<AllowEvents> { 49 50 private static final long serialVersionUID = -684763195336212992L; 51 clone()52 public Object clone() { 53 AllowEventsList retval = new AllowEventsList(); 54 retval.clonehlist(this.hlist); 55 return retval; 56 } 57 58 59 /** default constructor 60 */ AllowEventsList()61 public AllowEventsList() { 62 super(AllowEvents.class, AllowEventsHeader.NAME); 63 } 64 65 /** 66 * Gets an Iterator of all the methods of the AllowEventsHeader. Returns an empty 67 * 68 * Iterator if no methods are defined in this AllowEvents Header. 69 * 70 * 71 * 72 * @return Iterator of String objects each identifing the methods of 73 * 74 * AllowEventsHeader. 75 * 76 * 77 */ getMethods()78 public ListIterator<String> getMethods() { 79 ListIterator<AllowEvents> li = super.hlist.listIterator(); 80 LinkedList<String> ll = new LinkedList<String> (); 81 while (li.hasNext()) { 82 AllowEvents allowEvents = (AllowEvents) li.next(); 83 ll.add(allowEvents.getEventType()); 84 } 85 return ll.listIterator(); 86 } 87 88 /** 89 * Sets the methods supported defined by this AllowEventsHeader. 90 * 91 * 92 * 93 * @param methods - the Iterator of Strings defining the methods supported 94 * 95 * in this AllowEventsHeader 96 * 97 * @throws ParseException which signals that an error has been reached 98 * 99 * unexpectedly while parsing the Strings defining the methods supported. 100 * 101 * 102 */ setMethods(List<String> methods)103 public void setMethods(List<String> methods) throws ParseException { 104 ListIterator<String> it = methods.listIterator(); 105 while (it.hasNext()) { 106 AllowEvents allowEvents = new AllowEvents(); 107 allowEvents.setEventType((String) it.next()); 108 this.add(allowEvents); 109 } 110 } 111 } 112