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

openmrs / openmrs-core / 31843719412

14 Aug 2026 09:43PM UTC coverage: 64.329% (+0.007%) from 64.322%
31843719412

push

github

ibacher
TRUNK-6717: Replace reflective BeanUtils property access with direct PersonName getters (#6431)

11 of 11 new or added lines in 1 file covered. (100.0%)

60 existing lines in 11 files now uncovered.

24629 of 38286 relevant lines covered (64.33%)

0.64 hits per line

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

64.71
/api/src/main/java/org/openmrs/PersonAttributeType.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 javax.persistence.Column;
13
import javax.persistence.Entity;
14
import javax.persistence.FetchType;
15
import javax.persistence.GeneratedValue;
16
import javax.persistence.GenerationType;
17
import javax.persistence.Id;
18
import javax.persistence.JoinColumn;
19
import javax.persistence.ManyToOne;
20
import javax.persistence.Table;
21
import java.io.Serializable;
22
import java.util.Comparator;
23

24
import org.codehaus.jackson.annotate.JsonIgnore;
25
import org.hibernate.envers.Audited;
26
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
27
import org.openmrs.util.OpenmrsUtil;
28

29
/**
30
 * PersonAttributeType
31
 */
32
@Entity
33
@Table(name = "person_attribute_type")
34
@Audited
35
public class PersonAttributeType extends BaseChangeableOpenmrsMetadata implements java.io.Serializable, Comparable<PersonAttributeType> {
36
        
37
        public static final long serialVersionUID = 2112313431211L;
38
        
39
        @Id
40
        @GeneratedValue(strategy = GenerationType.IDENTITY)
41
        @Column(name = "person_attribute_type_id")
42
        private Integer personAttributeTypeId;
43
        
44
        @Column(name = "format", length = 50)
45
        private String format;
46
        
47
        @Column(name = "foreign_key")
48
        private Integer foreignKey;
49
        
50
        @Column(name = "sort_weight", nullable = false)
51
        private Double sortWeight;
52

53
        @GenericField
1✔
54
        @Column(name = "searchable", nullable = false)
55
        private Boolean searchable = false;
1✔
56
        
57
        @ManyToOne(fetch = FetchType.LAZY)
58
        @JoinColumn(name = "edit_privilege")
59
        private Privilege editPrivilege;
60
        
61
        /** default constructor */
62
        public PersonAttributeType() {
1✔
63
        }
1✔
64
        
65
        /** constructor with id */
66
        public PersonAttributeType(Integer myPersonAttributeTypeId) {
1✔
67
                this.personAttributeTypeId = myPersonAttributeTypeId;
1✔
68
        }
1✔
69
        
70
        // Property accessors
71
        
72
        /**
73
         * @return Returns the format.
74
         */
75
        public String getFormat() {
76
                return format;
1✔
77
        }
78
        
79
        /**
80
         * @param format The format to set.
81
         */
82
        public void setFormat(String format) {
83
                this.format = format;
1✔
84
        }
1✔
85
        
86
        /**
87
         * @return the foreignKey
88
         */
89
        public Integer getForeignKey() {
UNCOV
90
                return foreignKey;
×
91
        }
92
        
93
        /**
94
         * @param foreignKey the foreignKey to set
95
         */
96
        public void setForeignKey(Integer foreignKey) {
97
                this.foreignKey = foreignKey;
×
UNCOV
98
        }
×
99
        
100
        /**
101
         * @return the sortWeight
102
         */
103
        public Double getSortWeight() {
104
                return sortWeight;
1✔
105
        }
106
        
107
        /**
108
         * @param sortWeight the formOrder to set
109
         */
110
        public void setSortWeight(Double sortWeight) {
111
                this.sortWeight = sortWeight;
1✔
112
        }
1✔
113
        
114
        /**
115
         * @return Returns the PersonAttributeTypeId.
116
         */
117
        public Integer getPersonAttributeTypeId() {
118
                return personAttributeTypeId;
1✔
119
        }
120
        
121
        /**
122
         * @param newPersonAttributeTypeId The PersonAttributeTypeId to set.
123
         */
124
        public void setPersonAttributeTypeId(Integer newPersonAttributeTypeId) {
125
                this.personAttributeTypeId = newPersonAttributeTypeId;
×
UNCOV
126
        }
×
127
        
128
        /**
129
         * @return the searchable status
130
         * 
131
         * @deprecated as of 2.0, use {@link #getSearchable()}
132
         */
133
        @Deprecated
134
        @JsonIgnore
135
        public Boolean isSearchable() {
UNCOV
136
                return getSearchable();
×
137
        }
138
        
139
        /**
140
         * @return the searchable status
141
         */
142
        public Boolean getSearchable() {
143
                return searchable;
1✔
144
        }
145
        
146
        /**
147
         * @param searchable the searchable to set
148
         */
149
        public void setSearchable(Boolean searchable) {
150
                this.searchable = searchable;
1✔
151
        }
1✔
152
        
153
        /**
154
         * @see java.lang.Object#toString()
155
         */
156
        @Override
157
        public String toString() {
UNCOV
158
                return getName();
×
159
        }
160
        
161
        /**
162
         * The privilege required in order to edit this attribute
163
         * 
164
         * @return Returns the required privilege
165
         * @since 1.5
166
         */
167
        public Privilege getEditPrivilege() {
UNCOV
168
                return editPrivilege;
×
169
        }
170
        
171
        /**
172
         * The privilege required in order to edit this attribute If <code>editPrivilege</code> is null,
173
         * no extra permissions are required to edit this type
174
         * 
175
         * @param editPrivilege
176
         * @since 1.5
177
         */
178
        public void setEditPrivilege(Privilege editPrivilege) {
179
                this.editPrivilege = editPrivilege;
×
UNCOV
180
        }
×
181
        
182
        /**
183
         * @since 1.5
184
         * @see org.openmrs.OpenmrsObject#getId()
185
         */
186
        @Override
187
        public Integer getId() {
188
                return getPersonAttributeTypeId();
1✔
189
        }
190
        
191
        /**
192
         * @since 1.5
193
         * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
194
         */
195
        @Override
196
        public void setId(Integer id) {
UNCOV
197
                setPersonAttributeTypeId(id);
×
198
                
UNCOV
199
        }
×
200
        
201
        /**
202
        *
203
        * @deprecated since 1.12. Use DefaultComparator instead.
204
        * Note: this comparator imposes orderings that are inconsistent with equals.
205
        */
206
        @Override
207
        @SuppressWarnings("squid:S1210")
208
        public int compareTo(PersonAttributeType other) {
209
                DefaultComparator patDefaultComparator = new DefaultComparator();
1✔
210
                return patDefaultComparator.compare(this, other);
1✔
211
        }
212
        
213
        /**
214
         Provides a default comparator.
215
         @since 1.12
216
         **/
217
        public static class DefaultComparator implements Comparator<PersonAttributeType>, Serializable {
1✔
218

219
                private static final long serialVersionUID = 1L;
220
                
221
                @Override
222
                public int compare(PersonAttributeType pat1, PersonAttributeType pat2) {
223
                        return OpenmrsUtil.compareWithNullAsGreatest(pat1.getPersonAttributeTypeId(), pat2.getPersonAttributeTypeId());
1✔
224
                        
225
                }
226
        }
227
        
228
}
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