1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17
18 import ca.uhn.hl7v2.model.v25.datatype.HD;
19 import org.openehealth.ipf.commons.ihe.xds.core.metadata.Hl7v2Based.Holder;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlAttribute;
24 import javax.xml.bind.annotation.XmlType;
25 import java.util.Objects;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
44 @XmlType(name = "AssigningAuthority", propOrder = {"universalId", "universalIdType"})
45 public class AssigningAuthority extends Hl7v2Based<Holder<HD>> {
46 private static final long serialVersionUID = 5350057820250191032L;
47
48 public AssigningAuthority() {
49 super(new Holder<>(new HD(MESSAGE)));
50 }
51
52
53 public AssigningAuthority(Holder<HD> hdHolder) {
54 super(hdHolder);
55 }
56
57
58 public AssigningAuthority(HD hd) {
59 super(new Holder<>(hd));
60 }
61
62
63
64
65
66
67
68
69 public AssigningAuthority(String universalId, String universalIdType) {
70 this();
71 setUniversalId(universalId);
72 setUniversalIdType(universalIdType);
73 }
74
75
76
77
78
79
80 public AssigningAuthority(String universalId) {
81 this();
82 setUniversalId(universalId);
83 setUniversalIdType("ISO");
84 }
85
86
87
88
89 @XmlAttribute
90 public String getUniversalId() {
91 return getHapiObject().getInternal().getHd2_UniversalID().getValue();
92 }
93
94
95
96
97
98 public void setUniversalId(String universalId) {
99 setValue(getHapiObject().getInternal().getHd2_UniversalID(), universalId);
100 }
101
102
103
104
105 @XmlAttribute
106 public String getUniversalIdType() {
107 return getHapiObject().getInternal().getHd3_UniversalIDType().getValue();
108 }
109
110
111
112
113
114 public void setUniversalIdType(String universalIdType) {
115 setValue(getHapiObject().getInternal().getHd3_UniversalIDType(), universalIdType);
116 }
117
118
119 @Override
120 public boolean equals(Object o) {
121 if (this == o) return true;
122 if (o == null || getClass() != o.getClass()) return false;
123 AssigningAuthority that = (AssigningAuthority) o;
124 return Objects.equals(getUniversalId(), that.getUniversalId()) &&
125 Objects.equals(getUniversalIdType(), that.getUniversalIdType());
126 }
127
128 @Override
129 public int hashCode() {
130 return Objects.hash(getUniversalId(), getUniversalIdType());
131 }
132
133 @Override
134 public String toString() {
135 return "AssigningAuthority(" +
136 "universalId=" + getUniversalId() +
137 ", universalIdType=" + getUniversalIdType() +
138 ')';
139 }
140 }