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

openmrs / openmrs-core / 10946298164

19 Sep 2024 05:33PM UTC coverage: 63.759% (+0.09%) from 63.671%
10946298164

push

github

mogoodrich
TRUNK-6265: Bugs in Concept.getPreferredName(Locale) method (#4749)

(cherry picked from commit bc725f242)

14 of 16 new or added lines in 1 file covered. (87.5%)

12 existing lines in 9 files now uncovered.

21692 of 34022 relevant lines covered (63.76%)

0.64 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

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