1 | package gov.hhs.fha.nhinc.subscription.repository.data;
|
---|
2 |
|
---|
3 | import java.io.Serializable;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Data class for a single reference parameter
|
---|
7 | *
|
---|
8 | * @author Neil Webb
|
---|
9 | */
|
---|
10 | public class ReferenceParameter implements Serializable
|
---|
11 | {
|
---|
12 | private static final long serialVersionUID = -5508110987527377957L;
|
---|
13 | private String namespace;
|
---|
14 | private String namespacePrefix;
|
---|
15 | private String elementName;
|
---|
16 | private String value;
|
---|
17 |
|
---|
18 | public String getElementName()
|
---|
19 | {
|
---|
20 | return elementName;
|
---|
21 | }
|
---|
22 |
|
---|
23 | public void setElementName(String elementName)
|
---|
24 | {
|
---|
25 | this.elementName = elementName;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public String getNamespace()
|
---|
29 | {
|
---|
30 | return namespace;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public void setNamespace(String namespace)
|
---|
34 | {
|
---|
35 | this.namespace = namespace;
|
---|
36 | }
|
---|
37 |
|
---|
38 | public String getNamespacePrefix()
|
---|
39 | {
|
---|
40 | return namespacePrefix;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public void setNamespacePrefix(String namespacePrefix)
|
---|
44 | {
|
---|
45 | this.namespacePrefix = namespacePrefix;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public String getValue()
|
---|
49 | {
|
---|
50 | return value;
|
---|
51 | }
|
---|
52 |
|
---|
53 | public void setValue(String value)
|
---|
54 | {
|
---|
55 | this.value = value;
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Override
|
---|
59 | public boolean equals(Object obj)
|
---|
60 | {
|
---|
61 | if (obj == null)
|
---|
62 | {
|
---|
63 | return false;
|
---|
64 | }
|
---|
65 | if (getClass() != obj.getClass())
|
---|
66 | {
|
---|
67 | return false;
|
---|
68 | }
|
---|
69 | final ReferenceParameter other = (ReferenceParameter) obj;
|
---|
70 | if (this.namespace != other.namespace && (this.namespace == null || !this.namespace.equals(other.namespace)))
|
---|
71 | {
|
---|
72 | System.out.println("Reference parameter namespace did not equal");
|
---|
73 | System.out.println("This reference parameter namespace: " + this.namespace);
|
---|
74 | System.out.println("Other reference parameter namespace: " + other.namespace);
|
---|
75 | return false;
|
---|
76 | }
|
---|
77 | // Namespace prefix is not guaranteed to be the same
|
---|
78 | // if (this.namespacePrefix != other.namespacePrefix && (this.namespacePrefix == null || !this.namespacePrefix.equals(other.namespacePrefix)))
|
---|
79 | // {
|
---|
80 | // return false;
|
---|
81 | // }
|
---|
82 | if (this.elementName != other.elementName && (this.elementName == null || !this.elementName.equals(other.elementName)))
|
---|
83 | {
|
---|
84 | System.out.println("Reference parameter element name did not equal");
|
---|
85 | System.out.println("This reference parameter element name: " + this.elementName);
|
---|
86 | System.out.println("Other reference parameter element name: " + other.elementName);
|
---|
87 | return false;
|
---|
88 | }
|
---|
89 | if (this.value != other.value && (this.value == null || !this.value.equals(other.value)))
|
---|
90 | {
|
---|
91 | System.out.println("Reference parameter value did not equal");
|
---|
92 | System.out.println("This reference parameter value: " + this.value);
|
---|
93 | System.out.println("Other reference parameter value: " + other.value);
|
---|
94 | return false;
|
---|
95 | }
|
---|
96 | return true;
|
---|
97 | }
|
---|
98 |
|
---|
99 | @Override
|
---|
100 | public int hashCode()
|
---|
101 | {
|
---|
102 | int hash = 7;
|
---|
103 | hash = 17 * hash + (this.namespace != null ? this.namespace.hashCode() : 0);
|
---|
104 | hash = 17 * hash + (this.namespacePrefix != null ? this.namespacePrefix.hashCode() : 0);
|
---|
105 | hash = 17 * hash + (this.elementName != null ? this.elementName.hashCode() : 0);
|
---|
106 | hash = 17 * hash + (this.value != null ? this.value.hashCode() : 0);
|
---|
107 | return hash;
|
---|
108 | }
|
---|
109 | }
|
---|