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

openmrs / openmrs-core / 27623342085

16 Jun 2026 02:05PM UTC coverage: 63.563% (+0.05%) from 63.512%
27623342085

Pull #6198

github

web-flow
Merge 249add208 into fff789b9f
Pull Request #6198: mergePatients does not reassign Conditions, Allergies, or MedicationDispenses to the surviving patient

52 of 55 new or added lines in 2 files covered. (94.55%)

3 existing lines in 2 files now uncovered.

23871 of 37555 relevant lines covered (63.56%)

0.64 hits per line

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

93.48
/api/src/main/java/org/openmrs/person/PersonMergeLogData.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.person;
11

12
import java.util.ArrayList;
13
import java.util.Date;
14
import java.util.List;
15

16
import org.openmrs.api.PatientService;
17

18
/**
19
 * This class is used for communicating to the <code>PatientService</code> the data that
20
 * needs to be serialized. This data represents the details of a merge. It is also used for
21
 * abstracting the serialization outside of the PatientService and to allow storing the
22
 * deserialized form of the merged data
23
 *
24
 * @see PersonMergeLog
25
 * @see PatientService#mergePatients(org.openmrs.Patient, org.openmrs.Patient)
26
 * @since 1.9
27
 */
28
public class PersonMergeLogData {
1✔
29
        
30
        /**
31
         * List of UUIDs of visits moved from non-preferred to preferred
32
         */
33
        private List<String> movedVisits;
34
        
35
        /**
36
         * List of UUIDs of encounters moved from non-preferred to preferred
37
         */
38
        private List<String> movedEncounters;
39
        
40
        /**
41
         * List of UUIDs of patient programs copied from non-preferred to preferred
42
         * (Deprecated in 2.6.8 and 2.7.0+, as we now move programs)
43
         */
44
        @Deprecated
45
        private List<String> createdPrograms;
46

47
        /**
48
         * List of UUIDs of patient programs moved from non-preferred to preferred
49
         */
50
        private List<String> movedPrograms;
51
        
52
        /**
53
         * List of UUIDs of voided relationships
54
         */
55
        private List<String> voidedRelationships;
56
        
57
        /**
58
         * List of UUIDs of created relationships
59
         */
60
        private List<String> createdRelationships;
61
        
62
        /**
63
         * List of UUIDs of observations not contained within any encounter moved from non-preferred to
64
         * preferred
65
         */
66
        private List<String> movedIndependentObservations;
67

68
        /**
69
         * List of UUIDs of conditions moved from non-preferred to preferred
70
         *
71
         * @since 2.9.0
72
         */
73
        private List<String> movedConditions;
74

75
        /**
76
         * List of UUIDs of allergies moved from non-preferred to preferred
77
         *
78
         * @since 2.9.0
79
         */
80
        private List<String> movedAllergies;
81

82
        /**
83
         * List of UUIDs of medication dispenses moved from non-preferred to preferred
84
         *
85
         * @since 2.9.0
86
         */
87
        private List<String> movedMedicationDispenses;
88

89
        /**
90
         * List of UUIDs of orders copied from non-preferred to preferred
91
         */
92
        private List<String> createdOrders;
93
        
94
        /**
95
         * List of UUIDs of identifiers copied from non-preferred to preferred
96
         */
97
        private List<String> createdIdentifiers;
98
        
99
        /**
100
         * List of UUIDs of addresses copied from non-preferred to preferred
101
         */
102
        private List<String> createdAddresses;
103
        
104
        /**
105
         * List of UUIDs of names copied from non-preferred to preferred
106
         */
107
        private List<String> createdNames;
108
        
109
        /**
110
         * List of UUIDs of attributes copied from non-preferred to preferred
111
         */
112
        private List<String> createdAttributes;
113
        
114
        /**
115
         * List of UUIDs of users moved to be associated from non-preferred to be associated to
116
         * preferred
117
         */
118
        private List<String> movedUsers;
119
        
120
        /**
121
         * Value of gender of preferred person as it was before the merge occurred
122
         */
123
        private String priorGender;
124
        
125
        /**
126
         * Value of Date of Birth of preferred person as it was before the merge occurred
127
         */
128
        private Date priorDateOfBirth;
129
        
130
        /**
131
         * Whether the date of birth of preferred person was an estimated value before the merge
132
         * occurred
133
         */
134
        private boolean priorDateOfBirthEstimated;
135
        
136
        /**
137
         * Value of Date of Death of preferred person as it was before the merge occurred
138
         */
139
        private Date priorDateOfDeath;
140
        
141
        /**
142
         * Whether the date of death of preferred person was an estimated value before the merge
143
         * occurred
144
         */
145
        private Boolean priorDateOfDeathEstimated;
146
        
147
        /**
148
         * Value of cause of death of preferred person as it was before the merge occurred
149
         */
150
        private String priorCauseOfDeath;
151
        
152
        public List<String> getMovedVisits() {
153
                return movedVisits;
1✔
154
        }
155
        
156
        public List<String> getMovedEncounters() {
157
                return movedEncounters;
1✔
158
        }
159
        
160
        public void addMovedVisit(String uuid) {
161
                if (movedVisits == null) {
1✔
162
                        movedVisits = new ArrayList<>();
1✔
163
                }
164
                movedVisits.add(uuid);
1✔
165
        }
1✔
166
        
167
        public void addMovedEncounter(String uuid) {
168
                if (movedEncounters == null) {
1✔
169
                        movedEncounters = new ArrayList<>();
1✔
170
                }
171
                movedEncounters.add(uuid);
1✔
172
        }
1✔
173
        
174
        @Deprecated
175
        public List<String> getCreatedPrograms() {
176
                return createdPrograms;
1✔
177
        }
178
        
179
        @Deprecated
180
        public void addCreatedProgram(String uuid) {
181
                if (createdPrograms == null) {
×
182
                        createdPrograms = new ArrayList<>();
×
183
                }
184
                createdPrograms.add(uuid);
×
185
        }
×
186

187
        public List<String> getMovedPrograms() {
188
                return movedPrograms;
1✔
189
        }
190

191
        public void addMovedProgram(String uuid) {
192
                if (movedPrograms == null) {
1✔
193
                        movedPrograms = new ArrayList<>();
1✔
194
                }
195
                movedPrograms.add(uuid);
1✔
196
        }
1✔
197
        
198
        public List<String> getVoidedRelationships() {
199
                return voidedRelationships;
1✔
200
        }
201
        
202
        public void addVoidedRelationship(String uuid) {
203
                if (voidedRelationships == null) {
1✔
204
                        voidedRelationships = new ArrayList<>();
1✔
205
                }
206
                voidedRelationships.add(uuid);
1✔
207
        }
1✔
208
        
209
        public List<String> getCreatedRelationships() {
210
                return createdRelationships;
1✔
211
        }
212
        
213
        public void addCreatedRelationship(String uuid) {
214
                if (createdRelationships == null) {
1✔
215
                        createdRelationships = new ArrayList<>();
1✔
216
                }
217
                createdRelationships.add(uuid);
1✔
218
        }
1✔
219
        
220
        public List<String> getMovedIndependentObservations() {
221
                return movedIndependentObservations;
1✔
222
        }
223
        
224
        public void addMovedIndependentObservation(String uuid) {
225
                if (movedIndependentObservations == null) {
1✔
226
                        movedIndependentObservations = new ArrayList<>();
1✔
227
                }
228
                movedIndependentObservations.add(uuid);
1✔
229
        }
1✔
230

231
        /**
232
         * @since 2.9.0
233
         */
234
        public List<String> getMovedConditions() {
235
                return movedConditions;
1✔
236
        }
237

238
        /**
239
         * @since 2.9.0
240
         */
241
        public void addMovedCondition(String uuid) {
242
                if (movedConditions == null) {
1✔
243
                        movedConditions = new ArrayList<>();
1✔
244
                }
245
                movedConditions.add(uuid);
1✔
246
        }
1✔
247

248
        /**
249
         * @since 2.9.0
250
         */
251
        public List<String> getMovedAllergies() {
252
                return movedAllergies;
1✔
253
        }
254

255
        /**
256
         * @since 2.9.0
257
         */
258
        public void addMovedAllergy(String uuid) {
259
                if (movedAllergies == null) {
1✔
260
                        movedAllergies = new ArrayList<>();
1✔
261
                }
262
                movedAllergies.add(uuid);
1✔
263
        }
1✔
264

265
        /**
266
         * @since 2.9.0
267
         */
268
        public List<String> getMovedMedicationDispenses() {
269
                return movedMedicationDispenses;
1✔
270
        }
271

272
        /**
273
         * @since 2.9.0
274
         */
275
        public void addMovedMedicationDispense(String uuid) {
276
                if (movedMedicationDispenses == null) {
1✔
277
                        movedMedicationDispenses = new ArrayList<>();
1✔
278
                }
279
                movedMedicationDispenses.add(uuid);
1✔
280
        }
1✔
281

282
        public List<String> getCreatedOrders() {
283
                return createdOrders;
1✔
284
        }
285
        
286
        public void addCreatedOrder(String uuid) {
287
                if (createdOrders == null) {
1✔
288
                        createdOrders = new ArrayList<>();
1✔
289
                }
290
                createdOrders.add(uuid);
1✔
291
        }
1✔
292
        
293
        public List<String> getCreatedIdentifiers() {
294
                return createdIdentifiers;
1✔
295
        }
296
        
297
        public void addCreatedIdentifier(String uuid) {
298
                if (createdIdentifiers == null) {
1✔
299
                        createdIdentifiers = new ArrayList<>();
1✔
300
                }
301
                createdIdentifiers.add(uuid);
1✔
302
        }
1✔
303
        
304
        public List<String> getCreatedAddresses() {
305
                return createdAddresses;
1✔
306
        }
307
        
308
        public void addCreatedAddress(String uuid) {
309
                if (createdAddresses == null) {
1✔
310
                        createdAddresses = new ArrayList<>();
1✔
311
                }
312
                createdAddresses.add(uuid);
1✔
313
        }
1✔
314
        
315
        public List<String> getCreatedNames() {
316
                return createdNames;
1✔
317
        }
318
        
319
        public void addCreatedName(String uuid) {
320
                if (createdNames == null) {
1✔
321
                        createdNames = new ArrayList<>();
1✔
322
                }
323
                createdNames.add(uuid);
1✔
324
        }
1✔
325
        
326
        public List<String> getCreatedAttributes() {
327
                return createdAttributes;
1✔
328
        }
329
        
330
        public void addCreatedAttribute(String uuid) {
331
                if (createdAttributes == null) {
1✔
332
                        createdAttributes = new ArrayList<>();
1✔
333
                }
334
                createdAttributes.add(uuid);
1✔
335
        }
1✔
336
        
337
        public List<String> getMovedUsers() {
338
                return movedUsers;
1✔
339
        }
340
        
341
        public void addMovedUser(String uuid) {
342
                if (movedUsers == null) {
1✔
343
                        movedUsers = new ArrayList<>();
1✔
344
                }
345
                movedUsers.add(uuid);
1✔
346
        }
1✔
347
        
348
        public String getPriorGender() {
349
                return priorGender;
1✔
350
        }
351
        
352
        public void setPriorGender(String priorGender) {
353
                this.priorGender = priorGender;
1✔
354
        }
1✔
355
        
356
        public Date getPriorDateOfBirth() {
357
                return priorDateOfBirth;
1✔
358
        }
359
        
360
        public void setPriorDateOfBirth(Date priorDateOfBirth) {
361
                this.priorDateOfBirth = priorDateOfBirth;
1✔
362
        }
1✔
363
        
364
        public boolean isPriorDateOfBirthEstimated() {
365
                return priorDateOfBirthEstimated;
1✔
366
        }
367
        
368
        public void setPriorDateOfBirthEstimated(boolean priorDateOfBirthEstimated) {
369
                this.priorDateOfBirthEstimated = priorDateOfBirthEstimated;
1✔
370
        }
1✔
371
        
372
        public Date getPriorDateOfDeath() {
373
                return priorDateOfDeath;
1✔
374
        }
375
        
376
        public void setPriorDateOfDeath(Date priorDateOfDeath) {
377
                this.priorDateOfDeath = priorDateOfDeath;
1✔
378
        }
1✔
379
        
380
        public Boolean getPriorDateOfDeathEstimated() {
381
                return priorDateOfDeathEstimated;
1✔
382
        }
383
        
384
        public void setPriorDateOfDeathEstimated(Boolean priorDateOfDeathEstimated) {
385
                this.priorDateOfDeathEstimated = priorDateOfDeathEstimated;
1✔
386
        }
1✔
387
        
388
        public String getPriorCauseOfDeath() {
389
                return priorCauseOfDeath;
1✔
390
        }
391
        
392
        public void setPriorCauseOfDeath(String uuid) {
393
                this.priorCauseOfDeath = uuid;
1✔
394
        }
1✔
395
        
396
        /**
397
         * Computes a unique hash value representing the object
398
         *
399
         * @return hash value
400
         */
401
        public int computeHashValue() {
402
                String str = "";
1✔
403
                if (getCreatedAddresses() != null) {
1✔
404
                        str += getCreatedAddresses().toString();
1✔
405
                }
406
                if (getCreatedAttributes() != null) {
1✔
407
                        str += getCreatedAttributes().toString();
1✔
408
                }
409
                if (getCreatedIdentifiers() != null) {
1✔
410
                        str += getCreatedIdentifiers().toString();
1✔
411
                }
412
                if (getCreatedNames() != null) {
1✔
413
                        str += getCreatedNames().toString();
1✔
414
                }
415
                if (getCreatedOrders() != null) {
1✔
416
                        str += getCreatedOrders().toString();
1✔
417
                }
418
                if (getCreatedPrograms() != null) {
1✔
419
                        str += getCreatedPrograms().toString();
×
420
                }
421
                if (getMovedPrograms() != null) {
1✔
422
                        str += getMovedPrograms().toString();
1✔
423
                }
424
                if (getCreatedRelationships() != null) {
1✔
425
                        str += getCreatedRelationships().toString();
1✔
426
                }
427
                if (getVoidedRelationships() != null) {
1✔
428
                        str += getVoidedRelationships().toString();
1✔
429
                }
430
                if (getMovedVisits() != null) {
1✔
431
                        str += getMovedVisits().toString();
×
432
                }
433
                if (getMovedEncounters() != null) {
1✔
434
                        str += getMovedEncounters().toString();
1✔
435
                }
436
                if (getMovedIndependentObservations() != null) {
1✔
437
                        str += getMovedIndependentObservations().toString();
1✔
438
                }
439
                if (getMovedConditions() != null) {
1✔
NEW
440
                        str += getMovedConditions().toString();
×
441
                }
442
                if (getMovedAllergies() != null) {
1✔
NEW
443
                        str += getMovedAllergies().toString();
×
444
                }
445
                if (getMovedMedicationDispenses() != null) {
1✔
NEW
446
                        str += getMovedMedicationDispenses().toString();
×
447
                }
448
                if (getMovedUsers() != null) {
1✔
449
                        str += getMovedUsers().toString();
1✔
450
                }
451
                str += getPriorCauseOfDeath();
1✔
452
                str += getPriorGender();
1✔
453
                str += (getPriorDateOfBirth() != null) ? getPriorDateOfBirth().toString() : getPriorDateOfBirth();
1✔
454
                str += (getPriorDateOfBirth() != null) ? getPriorDateOfDeath().toString() : getPriorDateOfDeath();
1✔
455
                str += isPriorDateOfBirthEstimated();
1✔
456
                return str.hashCode();
1✔
457
        }
458
        
459
}
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