1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * Class LogicalIdentifierType.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:22 $
28 */
29 public class LogicalIdentifierType extends org.astrogrid.registry.beans.resource.IdentifierType
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * a name refering to the characteristic that relates resources
40 * having this logical identifier.
41 *
42 */
43 private java.lang.String _role;
44
45
46
47
48
49
50 public LogicalIdentifierType() {
51 super();
52 }
53
54
55
56
57
58
59 /***
60 * Note: hashCode() has not been overriden
61 *
62 * @param obj
63 */
64 public boolean equals(java.lang.Object obj)
65 {
66 if ( this == obj )
67 return true;
68
69 if (super.equals(obj)==false)
70 return false;
71
72 if (obj instanceof LogicalIdentifierType) {
73
74 LogicalIdentifierType temp = (LogicalIdentifierType)obj;
75 if (this._role != null) {
76 if (temp._role == null) return false;
77 else if (!(this._role.equals(temp._role)))
78 return false;
79 }
80 else if (temp._role != null)
81 return false;
82 return true;
83 }
84 return false;
85 }
86
87 /***
88 * Returns the value of field 'role'. The field 'role' has the
89 * following description: a name refering to the characteristic
90 * that relates resources
91 * having this logical identifier.
92 *
93 *
94 * @return the value of field 'role'.
95 */
96 public java.lang.String getRole()
97 {
98 return this._role;
99 }
100
101 /***
102 * Method isValid
103 */
104 public boolean isValid()
105 {
106 try {
107 validate();
108 }
109 catch (org.exolab.castor.xml.ValidationException vex) {
110 return false;
111 }
112 return true;
113 }
114
115 /***
116 * Method marshal
117 *
118 * @param out
119 */
120 public void marshal(java.io.Writer out)
121 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
122 {
123
124 Marshaller.marshal(this, out);
125 }
126
127 /***
128 * Method marshal
129 *
130 * @param handler
131 */
132 public void marshal(org.xml.sax.ContentHandler handler)
133 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
134 {
135
136 Marshaller.marshal(this, handler);
137 }
138
139 /***
140 * Sets the value of field 'role'. The field 'role' has the
141 * following description: a name refering to the characteristic
142 * that relates resources
143 * having this logical identifier.
144 *
145 *
146 * @param role the value of field 'role'.
147 */
148 public void setRole(java.lang.String role)
149 {
150 this._role = role;
151 }
152
153 /***
154 * Method unmarshalLogicalIdentifierType
155 *
156 * @param reader
157 */
158 public static org.astrogrid.registry.beans.resource.LogicalIdentifierType unmarshalLogicalIdentifierType(java.io.Reader reader)
159 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
160 {
161 return (org.astrogrid.registry.beans.resource.LogicalIdentifierType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.LogicalIdentifierType.class, reader);
162 }
163
164 /***
165 * Method validate
166 */
167 public void validate()
168 throws org.exolab.castor.xml.ValidationException
169 {
170 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
171 validator.validate(this);
172 }
173
174 }