• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-core / 13005024634

28 Jan 2025 06:41AM UTC coverage: 64.839% (-0.04%) from 64.876%
13005024634

push

github

web-flow
Trunk 5922: Switching from Hibernate Mappings to Annotations for DrugReferenceMap Domain (#4878)

* TRUNK-5922 Switching from Hibernate Mappings to Annotations for DrugReferenceMap Domain.

* TRUNK-5922 Switching from Hibernate Mappings to Annotations for DrugReferenceMap Domain.

* TRUNK-5922 Switching from Hibernate Mappings to Annotations for DrugReferenceMap Domain.

23158 of 35716 relevant lines covered (64.84%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.45
/api/src/main/java/org/openmrs/DrugReferenceMap.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs;
11

12
import javax.persistence.Column;
13
import javax.persistence.Entity;
14
import javax.persistence.GeneratedValue;
15
import javax.persistence.GenerationType;
16
import javax.persistence.Id;
17
import javax.persistence.JoinColumn;
18
import javax.persistence.ManyToOne;
19
import javax.persistence.Table;
20
import java.io.Serializable;
21
import java.util.Date;
22

23
import org.hibernate.annotations.Cascade;
24
import org.hibernate.annotations.Parameter;
25
import org.hibernate.annotations.GenericGenerator;
26
import org.hibernate.envers.Audited;
27
import org.hibernate.search.annotations.ContainedIn;
28
import org.hibernate.search.annotations.DocumentId;
29
import org.hibernate.search.annotations.IndexedEmbedded;
30
import org.hibernate.annotations.CascadeType;
31

32
/**
33
 * The DrugReferenceMap map object represents a mapping between a drug and alternative drug
34
 * terminologies.
35
 *
36
 * @since 1.10
37
 */
38
@Entity
39
@Table(name="drug_reference_map")
40
@Audited
41
public class DrugReferenceMap extends BaseOpenmrsObject implements Auditable, Serializable {
42

43
        public static final long serialVersionUID = 1L;
44

45
        @Id
46
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "drug_reference_map_id_seq")
47
        @GenericGenerator(
48
                name = "drug_reference_map_id_seq",
49
                strategy = "native",
50
                parameters = @Parameter(name = "sequence", value = "drug_reference_map_drug_reference_map_id_seq")
51
        )
52
        @DocumentId
53
        @Column(name = "drug_reference_map_id")
54
        private Integer drugReferenceMapId;
55

56
        @ManyToOne
57
        @JoinColumn(name = "drug_id", nullable = false)
58
        @ContainedIn
59
        private Drug drug;
60

61
        @ManyToOne
62
        @JoinColumn(name = "term_id", nullable = false)
63
        @Cascade(CascadeType.SAVE_UPDATE)
64
        @IndexedEmbedded(includeEmbeddedObjectId = true)
65
        private ConceptReferenceTerm conceptReferenceTerm;
66

67
        @ManyToOne
68
        @JoinColumn(name = "concept_map_type", nullable = false)
69
        private ConceptMapType conceptMapType;
70

71
        @ManyToOne
72
        @JoinColumn(name = "creator", nullable = false)
73
        private User creator;
74

75
        @Column(name = "date_created", nullable = false, length = 19)
76
        private Date dateCreated;
77

78
        @ManyToOne
79
        @JoinColumn(name = "changed_by")
80
        private User changedBy;
81

82
        @Column(name = "date_changed", length = 19)
83
        private Date dateChanged;
84

85
        /** default constructor */
86
        public DrugReferenceMap() {
1✔
87
        }
1✔
88

89
        /**
90
         * @param term
91
         * @param conceptMapType
92
         */
93
        public DrugReferenceMap(ConceptReferenceTerm term, ConceptMapType conceptMapType) {
1✔
94
                this.conceptReferenceTerm = term;
1✔
95
                this.conceptMapType = conceptMapType;
1✔
96
        }
1✔
97

98
        /**
99
         * @return Returns the drugReferenceMapId.
100
         */
101
        public Integer getDrugReferenceMapId() {
102
                return drugReferenceMapId;
×
103
        }
104

105
        /**
106
         * @param drugReferenceMapId The drugReferenceMapId to set.
107
         */
108
        public void setDrugReferenceMapId(Integer drugReferenceMapId) {
109
                this.drugReferenceMapId = drugReferenceMapId;
×
110
        }
×
111

112
        /**
113
         * @return Returns the drug.
114
         */
115
        public Drug getDrug() {
116
                return drug;
1✔
117
        }
118

119
        /**
120
         * @param drug The drug to set.
121
         */
122
        public void setDrug(Drug drug) {
123
                this.drug = drug;
1✔
124
        }
1✔
125

126
        /**
127
         * @return Returns the conceptReferenceTerm.
128
         */
129
        public ConceptReferenceTerm getConceptReferenceTerm() {
130
                return conceptReferenceTerm;
1✔
131
        }
132

133
        /**
134
         * @param conceptReferenceTerm The conceptReferenceTerm to set.
135
         */
136
        public void setConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm) {
137
                this.conceptReferenceTerm = conceptReferenceTerm;
1✔
138
        }
1✔
139

140
        /**
141
         * @return Returns the conceptMapType.
142
         */
143
        public ConceptMapType getConceptMapType() {
144
                return conceptMapType;
1✔
145
        }
146

147
        /**
148
         * @param conceptMapType The conceptMapType to set.
149
         */
150
        public void setConceptMapType(ConceptMapType conceptMapType) {
151
                this.conceptMapType = conceptMapType;
1✔
152
        }
1✔
153

154
        /**
155
         * @return id - The unique Identifier for the object
156
         */
157
        @Override
158
        public Integer getId() {
159
                return getDrugReferenceMapId();
×
160
        }
161

162
        /**
163
         * @param id - The unique Identifier for the object
164
         */
165
        @Override
166
        public void setId(Integer id) {
167
                setDrugReferenceMapId(id);
×
168
        }
×
169

170
        /**
171
         * @return User - the user who created the object
172
         */
173
        @Override
174
        public User getCreator() {
175
                return this.creator;
×
176
        }
177

178
        /**
179
         * @param creator - the user who created the object
180
         */
181
        @Override
182
        public void setCreator(User creator) {
183
                this.creator = creator;
×
184
        }
×
185

186
        /**
187
         * @return Date - the date the object was created
188
         */
189
        @Override
190
        public Date getDateCreated() {
191
                return dateCreated;
×
192
        }
193

194
        /**
195
         * @param dateCreated - the date the object was created
196
         */
197
        @Override
198
        public void setDateCreated(Date dateCreated) {
199
                this.dateCreated = dateCreated;
×
200
        }
×
201

202
        /**
203
         * @return User - the user who last changed the object
204
         */
205
        @Override
206
        public User getChangedBy() {
207
                return this.changedBy;
×
208
        }
209

210
        /**
211
         * @param changedBy - the user who last changed the object
212
         */
213
        @Override
214
        public void setChangedBy(User changedBy) {
215
                this.changedBy = changedBy;
×
216
        }
×
217

218
        /**
219
         * @return Date - the date the object was last changed
220
         */
221
        @Override
222
        public Date getDateChanged() {
223
                return this.dateChanged;
×
224
        }
225

226
        /**
227
         * @param dateChanged - the date the object was last changed
228
         */
229
        @Override
230
        public void setDateChanged(Date dateChanged) {
231
                this.dateChanged = dateChanged;
×
232
        }
×
233
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc