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

openmrs / openmrs-core / 43502855768

13 Nov 2026 08:33PM UTC coverage: 67.328% (+0.4%) from 66.969%
43502855768

push

github

ibacher
TRUNK-6616: Count obs version history statements without the privilege check

getObsVersionHistory_shouldLoadTheWholeChainInTwoQueries counted the
statements of the service call, which include its privilege check. When
test setup has cleared the role privilege cache in the same transaction,
that check reads roles from the database, so the count depended on test
order. Measure the DAO call instead.

26896 of 39948 relevant lines covered (67.33%)

0.67 hits per line

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

88.89
/api/src/main/java/org/openmrs/RelationshipType.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 org.codehaus.jackson.annotate.JsonIgnore;
13
import org.hibernate.envers.Audited;
14

15
/**
16
 * Defines a type of relationship between two people in the database. <br>
17
 * <br>
18
 * A relationship is two-way. There is a name for the relationship in both directions. <br>
19
 * <br>
20
 * For example: <br>
21
 * a) physician Joe<br>
22
 * b) patient Bob<br>
23
 * Joe is the "physician of" Bob <u>and</u> Bob is the patient of Joe. Once you can establish one of
24
 * the two relationships, you automatically know the other. <br>
25
 * <br>
26
 * ALL relationships are two-way and can be defined as such. <br>
27
 * <br>
28
 * RelationshipTypes should be defined as <b>gender non-specific</b> For example: A mother and her
29
 * son. Instead of having a RelationshipType defined as mother-son, it should be defined as
30
 * Parent-child. (This avoids the duplicative types that would come out like father-son,
31
 * father-daughter, mother-daughter) <br>
32
 * <br>
33
 * In English, we run into a tricky RelationshipType with aunts and uncles. We have chosen to define
34
 * them as aunt/uncle-niece/nephew.
35
 */
36
@Audited
37
public class RelationshipType extends BaseChangeableOpenmrsMetadata{
38
        
39
        public static final long serialVersionUID = 4223L;
40
        
41
        // Fields
42
        
43
        private Integer relationshipTypeId;
44
        
45
        private String aIsToB;
46
        
47
        private String bIsToA;
48
        
49
        private Integer weight = 0;
1 ✔
50
        
51
        private Boolean preferred = false;
1 ✔
52
        
53
        // Constructors
54
        
55
        /** default constructor */
56
        public RelationshipType() {
1 ✔
57
        }
1 ✔
58
        
59
        /** constructor with id */
60
        public RelationshipType(Integer relationshipTypeId) {
1 ✔
61
                this.relationshipTypeId = relationshipTypeId;
1 ✔
62
        }
1 ✔
63
        
64
        // Property accessors
65
        
66
        /**
67
         * @return Returns the relationshipTypeId.
68
         */
69
        public Integer getRelationshipTypeId() {
70
                return relationshipTypeId;
1 ✔
71
        }
72
        
73
        /**
74
         * @param relationshipTypeId The relationshipTypeId to set.
75
         */
76
        public void setRelationshipTypeId(Integer relationshipTypeId) {
77
                this.relationshipTypeId = relationshipTypeId;
1 ✔
78
        }
1 ✔
79
        
80
        /**
81
         * @return the weight
82
         */
83
        public Integer getWeight() {
84
                return weight;
1 ✔
85
        }
86
        
87
        /**
88
         * @param weight the weight to set
89
         */
90
        public void setWeight(Integer weight) {
91
                this.weight = weight;
1 ✔
92
        }
1 ✔
93
        
94
        /**
95
         * The java bean specifications says that if an attribute has the second letter capitalized (as
96
         * the "I" is), the initial "a" is not to be capitalized. Both Spring and Hibernate use this
97
         * "getter" definition
98
         * 
99
         * @return the aIsToB
100
         */
101
        public String getaIsToB() {
102
                return aIsToB;
1 ✔
103
        }
104
        
105
        /**
106
         * @param aisToB the aIsToB to set
107
         */
108
        public void setaIsToB(String aisToB) {
109
                aIsToB = aisToB;
1 ✔
110
        }
1 ✔
111
        
112
        /**
113
         * @return the bIsToA
114
         */
115
        public String getbIsToA() {
116
                return bIsToA;
1 ✔
117
        }
118
        
119
        /**
120
         * "Preferred" relationship types are those that should be shown as default types when
121
         * adding/editing a person's relationships
122
         * 
123
         * @return the preferred status
124
         * 
125
         * @deprecated as of 2.0, use {@link #getPreferred()}
126
         */
127
        @Deprecated
128
        @JsonIgnore
129
        public Boolean isPreferred() {
130
                return getPreferred();
×
131
        }
132
        
133
        public Boolean getPreferred() {
134
                return preferred;
1 ✔
135
        }
136
        
137
        /**
138
         * "Preferred" relationship types are those that should be shown as default types when
139
         * adding/editing a person's relationships
140
         * 
141
         * @param preferred sets the preferred status of this relationship type
142
         */
143
        public void setPreferred(Boolean preferred) {
144
                this.preferred = preferred;
1 ✔
145
        }
1 ✔
146
        
147
        /**
148
         * @param bisToA the bIsToA to set
149
         */
150
        public void setbIsToA(String bisToA) {
151
                bIsToA = bisToA;
1 ✔
152
        }
1 ✔
153
        
154
        /**
155
         * @see java.lang.Object#toString()
156
         */
157
        @Override
158
        public String toString() {
159
                return getaIsToB() + "/" + getbIsToA();
1 ✔
160
        }
161
        
162
        /**
163
         * @since 1.5
164
         * @see org.openmrs.OpenmrsObject#getId()
165
         */
166
        @Override
167
        public Integer getId() {
168
                return getRelationshipTypeId();
1 ✔
169
        }
170
        
171
        /**
172
         * @since 1.5
173
         * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
174
         */
175
        @Override
176
        public void setId(Integer id) {
177
                setRelationshipTypeId(id);
×
178
                
179
        }
×
180
        
181
}
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