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

openmrs / openmrs-core / 12830375618

17 Jan 2025 01:51PM UTC coverage: 63.8% (+0.02%) from 63.785%
12830375618

push

github

openmrs-bot
Setting new SNAPSHOT version

21715 of 34036 relevant lines covered (63.8%)

0.64 hits per line

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

88.24
/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 java.io.Serializable;
13
import java.util.Comparator;
14

15
import org.codehaus.jackson.annotate.JsonIgnore;
16
import org.hibernate.search.annotations.Field;
17
import org.openmrs.util.OpenmrsUtil;
18

19
/**
20
 * PersonAttributeType
21
 */
22
public class PersonAttributeType extends BaseChangeableOpenmrsMetadata implements java.io.Serializable, Comparable<PersonAttributeType> {
23
        
24
        public static final long serialVersionUID = 2112313431211L;
25
        
26
        private Integer personAttributeTypeId;
27
        
28
        private String format;
29
        
30
        private Integer foreignKey;
31
        
32
        private Double sortWeight;
33

34
        @Field
1✔
35
        private Boolean searchable = false;
1✔
36
        
37
        private Privilege editPrivilege;
38
        
39
        /** default constructor */
40
        public PersonAttributeType() {
1✔
41
        }
1✔
42
        
43
        /** constructor with id */
44
        public PersonAttributeType(Integer myPersonAttributeTypeId) {
1✔
45
                this.personAttributeTypeId = myPersonAttributeTypeId;
1✔
46
        }
1✔
47
        
48
        // Property accessors
49
        
50
        /**
51
         * @return Returns the format.
52
         */
53
        public String getFormat() {
54
                return format;
1✔
55
        }
56
        
57
        /**
58
         * @param format The format to set.
59
         */
60
        public void setFormat(String format) {
61
                this.format = format;
1✔
62
        }
1✔
63
        
64
        /**
65
         * @return the foreignKey
66
         */
67
        public Integer getForeignKey() {
68
                return foreignKey;
1✔
69
        }
70
        
71
        /**
72
         * @param foreignKey the foreignKey to set
73
         */
74
        public void setForeignKey(Integer foreignKey) {
75
                this.foreignKey = foreignKey;
1✔
76
        }
1✔
77
        
78
        /**
79
         * @return the sortWeight
80
         */
81
        public Double getSortWeight() {
82
                return sortWeight;
1✔
83
        }
84
        
85
        /**
86
         * @param sortWeight the formOrder to set
87
         */
88
        public void setSortWeight(Double sortWeight) {
89
                this.sortWeight = sortWeight;
1✔
90
        }
1✔
91
        
92
        /**
93
         * @return Returns the PersonAttributeTypeId.
94
         */
95
        public Integer getPersonAttributeTypeId() {
96
                return personAttributeTypeId;
1✔
97
        }
98
        
99
        /**
100
         * @param newPersonAttributeTypeId The PersonAttributeTypeId to set.
101
         */
102
        public void setPersonAttributeTypeId(Integer newPersonAttributeTypeId) {
103
                this.personAttributeTypeId = newPersonAttributeTypeId;
1✔
104
        }
1✔
105
        
106
        /**
107
         * @return the searchable status
108
         * 
109
         * @deprecated as of 2.0, use {@link #getSearchable()}
110
         */
111
        @Deprecated
112
        @JsonIgnore
113
        public Boolean isSearchable() {
114
                return getSearchable();
×
115
        }
116
        
117
        /**
118
         * @return the searchable status
119
         */
120
        public Boolean getSearchable() {
121
                return searchable;
1✔
122
        }
123
        
124
        /**
125
         * @param searchable the searchable to set
126
         */
127
        public void setSearchable(Boolean searchable) {
128
                this.searchable = searchable;
1✔
129
        }
1✔
130
        
131
        /**
132
         * @see java.lang.Object#toString()
133
         */
134
        @Override
135
        public String toString() {
136
                return getName();
×
137
        }
138
        
139
        /**
140
         * The privilege required in order to edit this attribute
141
         * 
142
         * @return Returns the required privilege
143
         * @since 1.5
144
         */
145
        public Privilege getEditPrivilege() {
146
                return editPrivilege;
1✔
147
        }
148
        
149
        /**
150
         * The privilege required in order to edit this attribute If <code>editPrivilege</code> is null,
151
         * no extra permissions are required to edit this type
152
         * 
153
         * @param editPrivilege
154
         * @since 1.5
155
         */
156
        public void setEditPrivilege(Privilege editPrivilege) {
157
                this.editPrivilege = editPrivilege;
1✔
158
        }
1✔
159
        
160
        /**
161
         * @since 1.5
162
         * @see org.openmrs.OpenmrsObject#getId()
163
         */
164
        @Override
165
        public Integer getId() {
166
                return getPersonAttributeTypeId();
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
                setPersonAttributeTypeId(id);
×
176
                
177
        }
×
178
        
179
        /**
180
        *
181
        * @deprecated since 1.12. Use DefaultComparator instead.
182
        * Note: this comparator imposes orderings that are inconsistent with equals.
183
        */
184
        @Override
185
        @SuppressWarnings("squid:S1210")
186
        public int compareTo(PersonAttributeType other) {
187
                DefaultComparator patDefaultComparator = new DefaultComparator();
1✔
188
                return patDefaultComparator.compare(this, other);
1✔
189
        }
190
        
191
        /**
192
         Provides a default comparator.
193
         @since 1.12
194
         **/
195
        public static class DefaultComparator implements Comparator<PersonAttributeType>, Serializable {
1✔
196

197
                private static final long serialVersionUID = 1L;
198
                
199
                @Override
200
                public int compare(PersonAttributeType pat1, PersonAttributeType pat2) {
201
                        return OpenmrsUtil.compareWithNullAsGreatest(pat1.getPersonAttributeTypeId(), pat2.getPersonAttributeTypeId());
1✔
202
                        
203
                }
204
        }
205
        
206
}
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