View Javadoc
1   /*
2    * Copyright 2017 the original author or authors.
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.openehealth.ipf.commons.ihe.xds.core.metadata.jaxbadapters;
17  
18  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Address;
19  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable;
20  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Name;
21  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp;
22  
23  import javax.xml.bind.annotation.XmlAccessType;
24  import javax.xml.bind.annotation.XmlAccessorType;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlType;
27  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
28  import java.util.ArrayList;
29  import java.util.HashMap;
30  import java.util.List;
31  import java.util.Map;
32  
33  /**
34   * @author Dmytro Rud
35   */
36  @XmlAccessorType(XmlAccessType.FIELD)
37  @XmlType(name = "PatientInfo")
38  public class PatientInfoXml {
39  
40      @XmlElement(name = "id")
41      private List<Identifiable> ids;
42  
43      @XmlElement(name = "name")
44      private List<Name> names;
45  
46      @XmlElement(name = "birthTime")
47      private Timestamp dateOfBirth;
48  
49      @XmlElement(name = "gender")
50      private String gender;
51  
52      @XmlElement(name = "address")
53      private List<Address> addresses;
54  
55      @XmlJavaTypeAdapter(StringMapAdapter.class)
56      @XmlElement(name = "other", type = StringMap.class)
57      private Map<String, List<String>> other;
58  
59      public List<Identifiable> getIds() {
60          if (ids == null) {
61              ids = new ArrayList<>();
62          }
63          return ids;
64      }
65  
66      public void setIds(List<Identifiable> ids) {
67          this.ids = ids;
68      }
69  
70      public List<Name> getNames() {
71          if (names == null) {
72              names = new ArrayList<>();
73          }
74          return names;
75      }
76  
77      public void setNames(List<Name> names) {
78          this.names = names;
79      }
80  
81      public Timestamp getDateOfBirth() {
82          return dateOfBirth;
83      }
84  
85      public void setDateOfBirth(Timestamp dateOfBirth) {
86          this.dateOfBirth = dateOfBirth;
87      }
88  
89      public String getGender() {
90          return gender;
91      }
92  
93      public void setGender(String gender) {
94          this.gender = gender;
95      }
96  
97      public List<Address> getAddresses() {
98          if (addresses == null) {
99              addresses = new ArrayList<>();
100         }
101         return addresses;
102     }
103 
104     public void setAddresses(List<Address> addresses) {
105         this.addresses = addresses;
106     }
107 
108     public Map<String, List<String>> getOther() {
109         if (other == null) {
110             other = new HashMap<>();
111         }
112         return other;
113     }
114 
115     public void setOther(Map<String, List<String>> other) {
116         this.other = other;
117     }
118 }