1 /* 2 * Copyright (c) 2008 Rodrigo Ruiz 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 package org.apache.axis.message.addressing; 17 18 import javax.xml.namespace.QName; 19 20 import org.apache.axis.message.addressing.util.AddressingUtils; 21 import org.apache.axis.types.URI; 22 import org.apache.axis.types.URI.MalformedURIException; 23 24 /** 25 * Java content class for Relationship complex type. 26 * <p> 27 * The following schema fragment specifies the expected content contained within 28 * this java content object. (defined at 29 * http://schemas.xmlsoap.org/ws/2004/08/addressing line 84) 30 * <p> 31 * 32 * <pre> 33 * <complexType name="Relationship"> 34 * <simpleContent> 35 * <extension base="<http://www.w3.org/2001/XMLSchema>anyURI"> 36 * <attribute name="RelationshipType" 37 * type="{http://www.w3.org/2001/XMLSchema}QName" /> 38 * </extension> 39 * </simpleContent> 40 * </complexType> 41 * </pre> 42 * 43 * @author Davanum Srinivas 44 * @version $Revision: 14 $ 45 */ 46 public class Relationship { 47 /** 48 * Field type. 49 */ 50 private URI uri; 51 52 /** 53 * Field type. 54 */ 55 private QName type; 56 57 /** Relationship type as per W3C CR version. */ 58 private String typeIRI; 59 60 /** 61 * Constructor Relationship. 62 */ 63 public Relationship() { 64 } 65 66 /** 67 * Constructor Relationship. 68 * 69 * @param uri Relationship type 70 * @throws URI.MalformedURIException If the URI is not valid 71 */ 72 public Relationship(String uri) throws MalformedURIException { 73 this.uri = new URI(uri); 74 } 75 76 /** 77 * Constructor Relationship. 78 * 79 * @param uri Relationship URI 80 * @param type Relationship type 81 * @throws URI.MalformedURIException If any of the URIs is invalid 82 */ 83 public Relationship(String uri, String type) throws MalformedURIException { 84 this.typeIRI = type; 85 this.uri = new URI(uri); 86 } 87 88 /** 89 * Constructor Relationship. 90 * 91 * @param uri Relationship URI 92 * @param type Relationship type 93 */ 94 public Relationship(URI uri, QName type) { 95 this.uri = uri; 96 this.type = (type == null) ? AddressingUtils.getResponseRelationshipType() : type; 97 } 98 99 /** 100 * Method getType. 101 * 102 * @return The relationship type 103 */ 104 public QName getType() { 105 return this.type; 106 } 107 108 /** 109 * Gets the type IRI. 110 * 111 * @return The type IRI 112 */ 113 public String getTypeIRI() { 114 return this.typeIRI; 115 } 116 117 /** 118 * Method getURI. 119 * 120 * @return The URI 121 */ 122 public URI getURI() { 123 return this.uri; 124 } 125 126 /** 127 * Method set_type. 128 * 129 * @param type The relationship type 130 */ 131 public void setType(QName type) { 132 this.type = type; 133 } 134 135 /** 136 * Sets the type IRI. 137 * 138 * @param typeIRI The type IRI 139 */ 140 public void setTypeIRI(String typeIRI) { 141 this.typeIRI = typeIRI; 142 } 143 144 /** 145 * Method setURI. 146 * 147 * @param uri The URI 148 */ 149 public void setURI(URI uri) { 150 this.uri = uri; 151 } 152 }