|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
RelatesTo.java | 62.5% | 87.5% | 80% | 81.1% |
|
1 |
/*
|
|
2 |
* Copyright 1999-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package org.apache.axis.message.addressing;
|
|
19 |
|
|
20 |
import org.apache.axis.message.SOAPHeaderElement;
|
|
21 |
import org.apache.axis.message.addressing.util.TextExtractor;
|
|
22 |
import org.apache.axis.message.addressing.util.AddressingUtils;
|
|
23 |
import org.apache.axis.types.URI;
|
|
24 |
|
|
25 |
import javax.xml.namespace.QName;
|
|
26 |
import javax.xml.soap.Name;
|
|
27 |
import javax.xml.soap.SOAPElement;
|
|
28 |
import javax.xml.soap.SOAPEnvelope;
|
|
29 |
import javax.xml.soap.SOAPHeader;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Java content class for RelatesTo element declaration.
|
|
33 |
* <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 77)
|
|
34 |
* <p>
|
|
35 |
* <pre>
|
|
36 |
* <element name="RelatesTo" type="{http://schemas.xmlsoap.org/ws/2004/08/addressing}Relationship"/>
|
|
37 |
* </pre>
|
|
38 |
*
|
|
39 |
* @author Davanum Srinivas (dims@yahoo.com)
|
|
40 |
*/
|
|
41 |
public class RelatesTo extends Relationship { |
|
42 |
|
|
43 |
/**
|
|
44 |
* Constructor RelatesTo
|
|
45 |
*
|
|
46 |
* @param uri
|
|
47 |
* @param type
|
|
48 |
* @throws URI.MalformedURIException
|
|
49 |
*/
|
|
50 | 3 |
public RelatesTo(String uri, String type)
|
51 |
throws URI.MalformedURIException {
|
|
52 | 3 |
super(uri, type);
|
53 |
} |
|
54 |
|
|
55 |
/**
|
|
56 |
* Constructor RelatesTo
|
|
57 |
*
|
|
58 |
* @param uri
|
|
59 |
* @param type
|
|
60 |
*/
|
|
61 | 0 |
public RelatesTo(URI uri, QName type) {
|
62 | 0 |
super(uri, type);
|
63 |
} |
|
64 |
|
|
65 |
/**
|
|
66 |
* Constructor RelatesTo
|
|
67 |
*
|
|
68 |
* @param uri
|
|
69 |
* @param type
|
|
70 |
*/
|
|
71 | 4 |
public RelatesTo(String uri, QName type)
|
72 |
throws URI.MalformedURIException {
|
|
73 | 4 |
super(new URI(uri), type); |
74 |
} |
|
75 |
|
|
76 |
/**
|
|
77 |
* Constructor RelatesTo
|
|
78 |
*
|
|
79 |
* @param el
|
|
80 |
* @throws Exception
|
|
81 |
*/
|
|
82 | 15 |
public RelatesTo(SOAPElement el)
|
83 |
throws Exception {
|
|
84 | 15 |
super();
|
85 | 15 |
setURI(new URI(TextExtractor.getText(el)));
|
86 | 15 |
String value = el.getAttribute(Constants.RELATIONSHIP_TYPE); |
87 | 15 |
if (value != null && value.length() > 0) { |
88 | 7 |
int pos = value.indexOf(':');
|
89 | 7 |
if (pos == -1) {
|
90 | 0 |
setType(new QName(value));
|
91 |
} else {
|
|
92 | 7 |
String namespace = |
93 |
el.getNamespaceURI(value.substring(0, pos)); |
|
94 | 7 |
setType(new QName(namespace, value.substring(pos+1)));
|
95 |
} |
|
96 |
} else {
|
|
97 | 8 |
setType(Constants.QNAME_RESPONSE); |
98 |
} |
|
99 |
} |
|
100 |
|
|
101 | 7 |
protected SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env,
|
102 |
String actorURI) |
|
103 |
throws Exception {
|
|
104 | 7 |
Name nm = env.createName(Constants.RELATES_TO, |
105 |
Constants.NS_PREFIX_ADDRESSING, |
|
106 |
Constants.NS_URI_ADDRESSING_DEFAULT); |
|
107 | 7 |
SOAPHeader header = env.getHeader(); |
108 | 7 |
if (header == null) { |
109 | 0 |
header = env.addHeader(); |
110 |
} |
|
111 |
|
|
112 | 7 |
SOAPHeaderElement headerElement = |
113 |
(SOAPHeaderElement)header.addHeaderElement(nm); |
|
114 | 7 |
headerElement.setActor(actorURI); |
115 |
|
|
116 | 7 |
QName type = getType(); |
117 |
|
|
118 | 7 |
if (type != null) { |
119 | 7 |
headerElement.addAttribute("", Constants.RELATIONSHIP_TYPE, type);
|
120 |
} |
|
121 |
|
|
122 | 7 |
headerElement.addTextNode(getURI().toString()); |
123 |
|
|
124 | 7 |
return headerElement;
|
125 |
} |
|
126 |
|
|
127 |
} |
|
128 |
|
|