1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.saaj;
18
19 import java.util.Iterator;
20 import javax.xml.namespace.QName;
21 import javax.xml.soap.Detail;
22 import javax.xml.soap.DetailEntry;
23 import javax.xml.soap.SOAPException;
24 import javax.xml.soap.SOAPFaultElement;
25 import javax.xml.transform.Result;
26
27 import org.springframework.util.Assert;
28 import org.springframework.ws.soap.SoapFaultDetail;
29 import org.springframework.ws.soap.SoapFaultDetailElement;
30
31
32
33
34
35
36
37
38 class SaajSoapFaultDetail extends SaajSoapElement<SOAPFaultElement> implements SoapFaultDetail {
39
40 public SaajSoapFaultDetail(SOAPFaultElement faultElement) {
41 super(faultElement);
42 }
43
44 public Result getResult() {
45 return getImplementation().getResult(getSaajDetail());
46 }
47
48 public SoapFaultDetailElement addFaultDetailElement(QName name) {
49 try {
50 DetailEntry detailEntry = getImplementation().addDetailEntry(getSaajDetail(), name);
51 return new SaajSoapFaultDetailElement(detailEntry);
52 }
53 catch (SOAPException ex) {
54 throw new SaajSoapFaultException(ex);
55 }
56 }
57
58 public Iterator<SoapFaultDetailElement> getDetailEntries() {
59 Iterator<DetailEntry> iterator = getImplementation().getDetailEntries(getSaajDetail());
60 return new SaajSoapFaultDetailElementIterator(iterator);
61 }
62
63 protected Detail getSaajDetail() {
64 return (Detail) getSaajElement();
65 }
66
67 private static class SaajSoapFaultDetailElementIterator implements Iterator<SoapFaultDetailElement> {
68
69 private final Iterator<DetailEntry> iterator;
70
71 private SaajSoapFaultDetailElementIterator(Iterator<DetailEntry> iterator) {
72 Assert.notNull(iterator, "No iterator given");
73 this.iterator = iterator;
74 }
75
76 public boolean hasNext() {
77 return iterator.hasNext();
78 }
79
80 public SoapFaultDetailElement next() {
81 DetailEntry saajDetailEntry = iterator.next();
82 return new SaajSoapFaultDetailElement(saajDetailEntry);
83 }
84
85 public void remove() {
86 iterator.remove();
87 }
88 }
89
90
91 }