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

openmrs / openmrs-core / 42638912720

09 Nov 2026 02:52PM UTC coverage: 66.721% (-0.05%) from 66.768%
42638912720

push

github

web-flow
Revert "TRUNK-6848: Reject invalid dates and times in Obs.setValueAsString for DT and TM datatypes (#6732)" (#6816)

This reverts commit 4572518d7.

Reverting while the behavior changes are reviewed. Strict DT parsing rejects
"yyyy-MM-dd HH:mm[:ss]" values that existing clients send for DT obs (e.g.
labtrackingapp), and the ISO fallback now stores a time component on DT obs
instead of truncating to the date. See TRUNK-6848 for details.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

0 of 2 new or added lines in 1 file covered. (0.0%)

6 existing lines in 4 files now uncovered.

26246 of 39337 relevant lines covered (66.72%)

0.67 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.LinkedHashSet;
13
import java.util.Set;
14

15
import org.codehaus.jackson.annotate.JsonIgnore;
16
import org.hibernate.envers.Audited;
17
import org.openmrs.util.CollectionUtil;
18

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

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

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

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

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

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

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

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