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

openmrs / openmrs-core / 31844190078

14 Aug 2026 09:44PM UTC coverage: 66.488% (+0.02%) from 66.466%
31844190078

push

github

ibacher
TRUNK-6717: Replace reflective BeanUtils property access with direct PersonName getters (#6431)

11 of 11 new or added lines in 1 file covered. (100.0%)

5 existing lines in 3 files now uncovered.

24806 of 37309 relevant lines covered (66.49%)

0.66 hits per line

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

42.55
/api/src/main/java/org/openmrs/ConceptAnswer.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 org.hibernate.annotations.BatchSize;
13
import org.hibernate.annotations.GenericGenerator;
14
import org.hibernate.annotations.Parameter;
15
import org.hibernate.envers.Audited;
16

17
import javax.persistence.Column;
18
import javax.persistence.Entity;
19
import javax.persistence.FetchType;
20
import javax.persistence.GeneratedValue;
21
import javax.persistence.GenerationType;
22
import javax.persistence.Id;
23
import javax.persistence.JoinColumn;
24
import javax.persistence.ManyToOne;
25
import javax.persistence.Table;
26
import java.util.Date;
27

28
/**
29
 * This class represents one option for an answer to a question type of {@link Concept}. The link to
30
 * the parent question Concept is stored in {@link #getConcept()} and the answer this object is
31
 * representing is stored in {@link #getAnswerConcept()}.
32
 *
33
 * @see Concept#getAnswers()
34
 */
35
@Entity
36
@Table(name = "concept_answer")
37
@BatchSize(size = 25)
38
@Audited
39
public class ConceptAnswer extends BaseOpenmrsObject implements Auditable, java.io.Serializable, Comparable<ConceptAnswer> {
40
        
41
        public static final long serialVersionUID = 3744L;
42
        
43
        // Fields
44
        @Id
45
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "concept_answer_id_seq")
46
        @GenericGenerator(
47
                        name = "concept_answer_id_seq",
48
                        strategy = "native",
49
                        parameters = @Parameter(name = "sequence", value = "concept_answer_concept_answer_id_seq")
50
        )
51
        @Column(name = "concept_answer_id")
52
        private Integer conceptAnswerId;
53
        
54
        /**
55
         * The question concept that this object is answering
56
         */
57
        @ManyToOne(fetch = FetchType.LAZY)
58
        @JoinColumn(name = "concept_id", nullable = false)
59
        private Concept concept;
60
        
61
        /**
62
         * The answer to the question
63
         */
64
        @ManyToOne(fetch = FetchType.LAZY)
65
        @JoinColumn(name = "answer_concept", nullable = false)
66
        private Concept answerConcept;
67
        
68
        /**
69
         * The {@link Drug} answer to the question. This can be null if this does not represent a drug
70
         * type of answer
71
         */
72
        @ManyToOne(fetch = FetchType.LAZY)
73
        @JoinColumn(name = "answer_drug")
74
        private Drug answerDrug;
75
        
76
        @ManyToOne(fetch = FetchType.LAZY)
77
        @JoinColumn(name = "creator", nullable = false)
78
        private User creator;
79
        
80
        @Column(name = "date_created", nullable = false)
81
        private Date dateCreated;
82
        
83
        @Column(name = "sort_weight")
84
        private Double sortWeight;
85
        
86
        // Constructors
87
        
88
        /** default constructor */
89
        public ConceptAnswer() {
1✔
90
        }
1✔
91
        
92
        /** constructor with id */
93
        public ConceptAnswer(Integer conceptAnswerId) {
1✔
94
                this.conceptAnswerId = conceptAnswerId;
1✔
95
        }
1✔
96
        
97
        public ConceptAnswer(Concept answerConcept) {
1✔
98
                this.answerConcept = answerConcept;
1✔
99
        }
1✔
100
        
101
        public ConceptAnswer(Concept answerConcept, Drug d) {
×
102
                this.answerConcept = answerConcept;
×
103
                this.answerDrug = d;
×
104
        }
×
105
        
106
        /**
107
         * @return Returns the answerConcept.
108
         */
109
        public Concept getAnswerConcept() {
110
                return answerConcept;
1✔
111
        }
112
        
113
        /**
114
         * @param answerConcept The answerConcept to set.
115
         */
116
        public void setAnswerConcept(Concept answerConcept) {
117
                this.answerConcept = answerConcept;
×
118
        }
×
119
        
120
        /**
121
         * @return Returns the answerDrug.
122
         */
123
        public Drug getAnswerDrug() {
124
                return answerDrug;
1✔
125
        }
126
        
127
        /**
128
         * @param answerDrug The answerDrug to set.
129
         */
130
        public void setAnswerDrug(Drug answerDrug) {
131
                this.answerDrug = answerDrug;
×
132
        }
×
133
        
134
        /**
135
         * @return Returns the concept.
136
         */
137
        public Concept getConcept() {
138
                return concept;
1✔
139
        }
140
        
141
        /**
142
         * @param concept The concept to set.
143
         */
144
        public void setConcept(Concept concept) {
145
                this.concept = concept;
1✔
146
        }
1✔
147
        
148
        /**
149
         * @return Returns the conceptAnswerId.
150
         */
151
        public Integer getConceptAnswerId() {
152
                return conceptAnswerId;
1✔
153
        }
154
        
155
        /**
156
         * @param conceptAnswerId The conceptAnswerId to set.
157
         */
158
        public void setConceptAnswerId(Integer conceptAnswerId) {
159
                this.conceptAnswerId = conceptAnswerId;
×
160
        }
×
161
        
162
        /**
163
         * @return Returns the creator.
164
         */
165
        @Override
166
        public User getCreator() {
167
                return creator;
×
168
        }
169
        
170
        /**
171
         * @param creator The creator to set.
172
         */
173
        @Override
174
        public void setCreator(User creator) {
175
                this.creator = creator;
×
176
        }
×
177
        
178
        /**
179
         * @return Returns the dateCreated.
180
         */
181
        @Override
182
        public Date getDateCreated() {
183
                return dateCreated;
×
184
        }
185
        
186
        /**
187
         * @param dateCreated The dateCreated to set.
188
         */
189
        @Override
190
        public void setDateCreated(Date dateCreated) {
191
                this.dateCreated = dateCreated;
×
192
        }
×
193
        
194
        /**
195
         * @since 1.5
196
         * @see org.openmrs.OpenmrsObject#getId()
197
         */
198
        @Override
199
        public Integer getId() {
200
                return getConceptAnswerId();
1✔
201
        }
202
        
203
        /**
204
         * @since 1.5
205
         * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
206
         */
207
        @Override
208
        public void setId(Integer id) {
209
                setConceptAnswerId(id);
×
210
        }
×
211
        
212
        /**
213
         * Not currently used. Always returns null.
214
         *
215
         * @see org.openmrs.Auditable#getChangedBy()
216
         */
217
        @Override
218
        public User getChangedBy() {
219
                return null;
×
220
        }
221
        
222
        /**
223
         * Not currently used. Always returns null.
224
         *
225
         * @see org.openmrs.Auditable#getDateChanged()
226
         */
227
        @Override
228
        public Date getDateChanged() {
229
                return null;
×
230
        }
231
        
232
        /**
233
         * Not currently used.
234
         *
235
         * @see org.openmrs.Auditable#setChangedBy(org.openmrs.User)
236
         */
237
        @Override
238
        public void setChangedBy(User changedBy) {
239
        }
×
240
        
241
        /**
242
         * Not currently used.
243
         *
244
         * @see org.openmrs.Auditable#setDateChanged(java.util.Date)
245
         */
246
        @Override
247
        public void setDateChanged(Date dateChanged) {
248
        }
×
249
        
250
        /**
251
         * @return Returns the sortWeight.
252
         */
253
        public Double getSortWeight() {
254
                return sortWeight;
1✔
255
        }
256
        
257
        /**
258
         * @param sortWeight The sortWeight to set.
259
         */
260
        public void setSortWeight(Double sortWeight) {
261
                this.sortWeight = sortWeight;
1✔
262
        }
1✔
263
        
264
        /**
265
         * @see java.lang.Comparable#compareTo(java.lang.Object)
266
         * Note: this comparator imposes orderings that are inconsistent with equals.
267
         */
268
        @Override
269
        @SuppressWarnings("squid:S1210")
270
        public int compareTo(ConceptAnswer ca) {
271
                if ((getSortWeight() == null) && (ca.getSortWeight() != null)) {
1✔
272
                        return -1;
1✔
273
                }
UNCOV
274
                if ((getSortWeight() != null) && (ca.getSortWeight() == null)) {
×
UNCOV
275
                        return 1;
×
276
                }
277
                if ((getSortWeight() == null) && (ca.getSortWeight() == null)) {
×
278
                        return 0;
×
279
                }
280
                return (getSortWeight() < ca.getSortWeight()) ? -1 : (getSortWeight() > ca.getSortWeight()) ? 1 : 0;
×
281
        }
282
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc