1 16 package org.apache.axis2.saaj; 17 18 import org.apache.axis2.om.OMAbstractFactory; 19 import org.apache.axis2.om.OMElement; 20 import org.apache.axis2.om.OMFactory; 21 import org.apache.axis2.om.OMNamespace; 22 23 import javax.xml.soap.Detail ; 24 import javax.xml.soap.DetailEntry ; 25 import javax.xml.soap.Name ; 26 import javax.xml.soap.SOAPException ; 27 import java.util.ArrayList ; 28 import java.util.Iterator ; 29 30 36 public class DetailImpl extends SOAPFaultElementImpl implements Detail { 37 38 41 OMElement detail; 42 43 49 public DetailImpl(javax.xml.namespace.QName detailName, OMElement parent){ 50 OMFactory omFactory = OMAbstractFactory.getOMFactory(); 51 detail = omFactory.createOMElement(detailName, parent); 52 } 53 54 57 58 66 public DetailEntry addDetailEntry(Name name) throws SOAPException { 67 68 String localName = name.getLocalName(); 72 OMFactory omFactory = OMAbstractFactory.getOMFactory(); 73 OMNamespace ns = omFactory.createOMNamespace(name.getURI(), name.getPrefix()); 74 OMElement detailEntry = omFactory.createOMElement(localName, ns); 75 detail.addChild(detailEntry); 76 return (new DetailEntryImpl(detailEntry)); 77 } 78 79 85 protected DetailEntry addDetailEntry(org.apache.axis2.om.OMNode detailEntry){ 86 detail.addChild(detailEntry); 87 return (new DetailEntryImpl((OMElement)detailEntry)); 88 } 89 90 96 public Iterator getDetailEntries() { 97 Iterator detailEntryIter = detail.getChildren(); 100 ArrayList aList = new ArrayList (); 101 while(detailEntryIter.hasNext()){ 102 Object o = detailEntryIter.next(); 103 if(o instanceof org.apache.axis2.om.OMElement){ 104 OMElement omDetailEntry = (OMElement)o; 105 DetailEntry detailEntry = new DetailEntryImpl(omDetailEntry); 106 aList.add(detailEntry); 107 } 108 } 109 return aList.iterator(); 110 } 111 112 } 113 | Popular Tags |