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

openmrs / openmrs-core / 16289862711

15 Jul 2025 09:45AM UTC coverage: 65.358% (+0.001%) from 65.357%
16289862711

push

github

web-flow
TRUNK-6377:Implement getProviderRole in the core (#5131)

2 of 2 new or added lines in 2 files covered. (100.0%)

6 existing lines in 5 files now uncovered.

23548 of 36029 relevant lines covered (65.36%)

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

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

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

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

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

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

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

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

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