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

openmrs / openmrs-core / 26773559161

01 Jun 2026 06:21PM UTC coverage: 63.376% (-0.01%) from 63.389%
26773559161

push

github

web-flow
TRUNK-6429: Create application events for service method calls and entity changes (#6084)

272 of 504 new or added lines in 27 files covered. (53.97%)

5 existing lines in 2 files now uncovered.

23598 of 37235 relevant lines covered (63.38%)

0.63 hits per line

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

50.0
/api/src/main/java/org/openmrs/api/db/event/SaveDbEvent.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.api.db.event;
11

12
import org.openmrs.event.EntityEvent;
13

14
import java.io.Serializable;
15
import java.util.HashSet;
16
import java.util.Set;
17

18
/**
19
 * DB level event emitted upon creation or modification of an entity.
20
 * 
21
 * @param <T> type of entity
22
 */
23
public class SaveDbEvent<T> extends EntityEvent<T> {
24
        
25
        private Serializable id;
26
        private Object[] state;
27
        private Object[] previousState;
28
        private String[] propertyNames;
29
        private boolean modified = false;
1✔
30
        
NEW
31
        public SaveDbEvent() {
×
NEW
32
        }
×
33
        
34
        public SaveDbEvent(T entity, Serializable id, Object[] state, String[] propertyNames) {
NEW
35
                this(entity, id, state, propertyNames, null, new HashSet<>());
×
NEW
36
        }
×
37

38
        public SaveDbEvent(T entity, Serializable id, Object[] state, Object[] previousState, String[] propertyNames) {
39
                this(entity, id, state, previousState, propertyNames, new HashSet<>());
1✔
40
        }
1✔
41

42
        public SaveDbEvent(T entity, Serializable id, Object[] state, Object[] previousState, String[] propertyNames, Set<String> tags) {
43
                super(entity, tags);
1✔
44
                this.id = id;
1✔
45
                this.state = state;
1✔
46
                this.previousState = previousState;
1✔
47
                this.propertyNames = propertyNames;
1✔
48
        }
1✔
49

50
        public Serializable getId() {
NEW
51
                return id;
×
52
        }
53

54
        public Object[] getState() {
NEW
55
                return state;
×
56
        }
57

58
        public Object[] getPreviousState() {
NEW
59
                return previousState;
×
60
        }
61

62
        public String[] getPropertyNames() {
NEW
63
                return propertyNames;
×
64
        }
65

66
        public boolean isModified() {
67
                return modified;
1✔
68
        }
69

70
        /**
71
         * The setting is only respected if called from a synchronous listener
72
         * and before commit. Changes will be applied to the object by Hibernate before persisting.
73
         * Please note that modifications to collection properties are not propagated and are read-only.
74
         * 
75
         * @param modified false by default
76
         */
77
        public void setModified(boolean modified) {
NEW
78
                this.modified = modified;
×
NEW
79
        }
×
80
}
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