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

openmrs / openmrs-core / 33638341921

02 Sep 2026 01:51PM UTC coverage: 65.422% (-0.02%) from 65.446%
33638341921

Pull #6534

github

web-flow
Merge d921c79ab into 4d17cf1b0
Pull Request #6534: TRUNK-6512: Introduce ConceptReferenceRangeContext API

101 of 123 new or added lines in 4 files covered. (82.11%)

16 existing lines in 11 files now uncovered.

23781 of 36350 relevant lines covered (65.42%)

0.65 hits per line

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

98.85
/api/src/main/java/org/openmrs/ConceptNumeric.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 java.util.HashSet;
13
import java.util.LinkedHashSet;
14
import java.util.Set;
15
import java.util.TreeSet;
16

17
import org.codehaus.jackson.annotate.JsonIgnore;
18
import org.hibernate.envers.Audited;
19
import org.hibernate.search.annotations.Indexed;
20

21
/**
22
 * The ConceptNumeric extends upon the Concept object by adding some number range values
23
 * 
24
 * @see Concept
25
 */
26
@Indexed
27
@Audited
28
public class ConceptNumeric extends Concept {
29
        
30
        public static final long serialVersionUID = 47323L;
31
        
32
        // Fields
33
        
34
        private Double hiAbsolute;
35
        
36
        private Double hiCritical;
37
        
38
        private Double hiNormal;
39
        
40
        private Double lowAbsolute;
41
        
42
        private Double lowCritical;
43
        
44
        private Double lowNormal;
45
        
46
        private String units;
47
        
48
        private Boolean allowDecimal = false;
1✔
49
        
50
        private Set<ConceptReferenceRange> referenceRanges;
51
        
52
        /**
53
         * displayPrecision, represents the number of significant digits
54
         * to be used for display of a numeric value
55
         */
56
        private Integer displayPrecision;
57
        
58
        // Constructors
59
        
60
        /** default constructor */
61
        public ConceptNumeric() {
1✔
62
                referenceRanges = new LinkedHashSet<>();
1✔
63
        }
1✔
64
        
65
        /**
66
         * Generic constructor taking the primary key
67
         * 
68
         * @param conceptId key for this numeric concept
69
         */
70
        public ConceptNumeric(Integer conceptId) {
1✔
71
                setConceptId(conceptId);
1✔
72
        }
1✔
73
        
74
        /**
75
         * Optional constructor for turning a Concept into a ConceptNumeric <br>
76
         * <br>
77
         * Note: This cannot copy over numeric specific values
78
         * 
79
         * @param c
80
         * <strong>Should</strong> make deep copy of collections
81
         * <strong>Should</strong> change reference to the parent object  for objects in answers collection
82
         * <strong>Should</strong> change reference to the parent object  for objects in conceptSets collection
83
         * <strong>Should</strong> change reference to the parent object  for objects in names collection
84
         * <strong>Should</strong> change reference to the parent object  for objects in descriptions collection
85
         * <strong>Should</strong> change reference to the parent object  for objects in conceptMappings collection
86
         */
87
        public ConceptNumeric(Concept c) {
1✔
88
                this.setChangedBy(c.getChangedBy());
1✔
89
                this.setConceptClass(c.getConceptClass());
1✔
90
                this.setConceptId(c.getConceptId());
1✔
91
                this.setCreator(c.getCreator());
1✔
92
                this.setDatatype(c.getDatatype());
1✔
93
                this.setDateChanged(c.getDateChanged());
1✔
94
                this.setDateCreated(c.getDateCreated());
1✔
95
                this.setSet(c.getSet());
1✔
96
                this.setRetired(c.getRetired());
1✔
97
                this.setRetiredBy(c.getRetiredBy());
1✔
98
                this.setRetireReason(c.getRetireReason());
1✔
99
                this.setVersion(c.getVersion());
1✔
100
                this.setUuid(c.getUuid());
1✔
101
                
102
                this.setNames(new HashSet<>(c.getNames()));
1✔
103
                for (ConceptName cName : this.getNames()) {
1✔
104
                        cName.setConcept(this);
1✔
105
                }
1✔
106
                
107
                this.setAnswers(new HashSet<>(c.getAnswers(true)));
1✔
108
                for (ConceptAnswer cAnswer : this.getAnswers()) {
1✔
109
                        cAnswer.setConcept(this);
1✔
110
                }
1✔
111
                
112
                this.setConceptSets(new TreeSet<>(c.getConceptSets()));
1✔
113
                for (ConceptSet cSet : this.getConceptSets()) {
1✔
114
                        cSet.setConceptSet(this);
1✔
115
                }
1✔
116
                
117
                this.setDescriptions(new HashSet<>(c.getDescriptions()));
1✔
118
                for (ConceptDescription cDescription : this.getDescriptions()) {
1✔
119
                        cDescription.setConcept(this);
1✔
120
                }
1✔
121
                
122
                this.setConceptMappings(new HashSet<>(c.getConceptMappings()));
1✔
123
                for (ConceptMap cMap : this.getConceptMappings()) {
1✔
124
                        cMap.setConcept(this);
1✔
125
                }
1✔
126
                
127
                this.hiAbsolute = null;
1✔
128
                this.hiCritical = null;
1✔
129
                this.hiNormal = null;
1✔
130
                this.lowAbsolute = null;
1✔
131
                this.lowCritical = null;
1✔
132
                this.lowNormal = null;
1✔
133
                this.units = "";
1✔
134
                this.allowDecimal = false;
1✔
135

136
                referenceRanges = new LinkedHashSet<>();
1✔
137
        }
1✔
138
        
139
        // Property accessors
140
        
141
        public Double getHiAbsolute() {
142
                return this.hiAbsolute;
1✔
143
        }
144
        
145
        public void setHiAbsolute(Double hiAbsolute) {
146
                this.hiAbsolute = hiAbsolute;
1✔
147
        }
1✔
148
        
149
        public Double getHiCritical() {
150
                return this.hiCritical;
1✔
151
        }
152
        
153
        public void setHiCritical(Double hiCritical) {
154
                this.hiCritical = hiCritical;
1✔
155
        }
1✔
156
        
157
        public Double getHiNormal() {
158
                return this.hiNormal;
1✔
159
        }
160
        
161
        public void setHiNormal(Double hiNormal) {
162
                this.hiNormal = hiNormal;
1✔
163
        }
1✔
164
        
165
        public Double getLowAbsolute() {
166
                return this.lowAbsolute;
1✔
167
        }
168
        
169
        public void setLowAbsolute(Double lowAbsolute) {
170
                this.lowAbsolute = lowAbsolute;
1✔
171
        }
1✔
172
        
173
        public Double getLowCritical() {
174
                return this.lowCritical;
1✔
175
        }
176
        
177
        public void setLowCritical(Double lowCritical) {
178
                this.lowCritical = lowCritical;
1✔
179
        }
1✔
180
        
181
        public Double getLowNormal() {
182
                return this.lowNormal;
1✔
183
        }
184
        
185
        public void setLowNormal(Double lowNormal) {
186
                this.lowNormal = lowNormal;
1✔
187
        }
1✔
188
        
189
        public String getUnits() {
190
                return this.units;
1✔
191
        }
192
        
193
        public void setUnits(String units) {
194
                this.units = units;
1✔
195
        }
1✔
196

197
        /**
198
         * This method will <i>always</i> return true for ConceptNumeric objects that have a datatype of
199
         * Numeric
200
         * 
201
         * @see org.openmrs.Concept#isNumeric()
202
         */
203
        @Override
204
        public boolean isNumeric() {
205
                return "Numeric".equals(getDatatype().getName());
1✔
206
        }
207
        
208
        /**
209
         * @return displayPrecision to be used for the display of a numeric value
210
         */
211
        public Integer getDisplayPrecision() {
212
                return displayPrecision;
1✔
213
        }
214

215
        /**
216
         * @param displayPrecision sets displayPrecision to be used for the display of a numeric value
217
         */
218
        public void setDisplayPrecision(Integer displayPrecision) {
219
                this.displayPrecision = displayPrecision;
1✔
220
        }
1✔
221
        
222
        public Boolean getAllowDecimal() {
223
                return allowDecimal == null ? Boolean.FALSE : allowDecimal;
1✔
224
        }
225
        
226
        public void setAllowDecimal(Boolean allowDecimal) {
227
                this.allowDecimal = allowDecimal;
1✔
228
        }
1✔
229
        
230
        /**
231
         * @deprecated as of 2.0, use {@link #getAllowDecimal()}
232
         */
233
        @Deprecated
234
        @JsonIgnore
235
        public Boolean isAllowDecimal() {
UNCOV
236
                return getAllowDecimal();
×
237
        }
238

239
        /**
240
         * Gets conceptReferenceRanges
241
         * 
242
         * @since 2.7.0
243
         * 
244
         * @return list of conceptReferenceRange
245
         */
246
        public Set<ConceptReferenceRange> getReferenceRanges() {
247
                return referenceRanges;
1✔
248
        }
249

250
        /**
251
         * Sets conceptReferenceRanges
252
         * 
253
         * @since 2.7.0
254
         * 
255
         * @param referenceRanges List of ConceptReferenceRange
256
         */
257
        public void setReferenceRanges(Set<ConceptReferenceRange> referenceRanges) {
258
                this.referenceRanges = referenceRanges;
1✔
259
        }
1✔
260

261
        /**
262
         * Helper method used to add conceptReferenceRange to the list of conceptReferenceRanges
263
         *
264
         * @since 2.7.0
265
         *
266
         * @param referenceRange to add
267
         */
268
        public void addReferenceRange(ConceptReferenceRange referenceRange) {
269
                getReferenceRanges().add(referenceRange);
1✔
270
        }
1✔
271

272
        /**
273
         * Helper method used to remove conceptReferenceRange from a list of conceptReferenceRanges
274
         *
275
         * @param referenceRange reference range to remove
276
         *                          
277
         * @since 2.7.0
278
         */
279
        public void removeReferenceRange(ConceptReferenceRange referenceRange) {
280
                getReferenceRanges().remove(referenceRange);
1✔
281
        }
1✔
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