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

openmrs / openmrs-core / 10689050349

03 Sep 2024 07:05PM CUT coverage: 64.741% (+0.008%) from 64.733%
10689050349

push

github

web-flow
maven(deps): bump org.codehaus.mojo:buildnumber-maven-plugin (#4738)

Bumps [org.codehaus.mojo:buildnumber-maven-plugin](https://github.com/mojohaus/buildnumber-maven-plugin) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/mojohaus/buildnumber-maven-plugin/releases)
- [Commits](https://github.com/mojohaus/buildnumber-maven-plugin/compare/3.2.0...3.2.1)

---
updated-dependencies:
- dependency-name: org.codehaus.mojo:buildnumber-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

22963 of 35469 relevant lines covered (64.74%)

0.65 hits per line

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

42.39
/api/src/main/java/org/openmrs/FormField.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.envers.Audited;
17

18
/**
19
 * The FormField object relates/orders the <code>fields</code> on a <code>form</code> A form can
20
 * have many 0 to n fields associated with it in a hierarchical manor. This FormField object governs
21
 * what/how that takes place
22
 *
23
 * @see org.openmrs.Form
24
 * @see org.openmrs.Field
25
 */
26
@Audited
27
public class FormField extends BaseChangeableOpenmrsMetadata implements java.io.Serializable, Comparable<FormField> {
28
        
29
        public static final long serialVersionUID = 3456L;
30
        
31
        // Fields
32
        
33
        protected Integer formFieldId;
34
        
35
        protected FormField parent;
36
        
37
        protected Form form;
38
        
39
        protected Field field;
40
        
41
        protected Integer fieldNumber;
42
        
43
        protected String fieldPart;
44
        
45
        protected Integer pageNumber;
46
        
47
        protected Integer minOccurs;
48
        
49
        protected Integer maxOccurs;
50
        
51
        protected Boolean required = false;
1✔
52
        
53
        protected Float sortWeight;
54
        
55
        // Constructors
56
        
57
        /** default constructor */
58
        public FormField() {
1✔
59
        }
1✔
60
        
61
        /** constructor with id */
62
        public FormField(Integer formFieldId) {
1✔
63
                this.formFieldId = formFieldId;
1✔
64
        }
1✔
65
        
66
        // Property accessors
67
        
68
        /**
69
         * @return Returns the formFieldId.
70
         */
71
        public Integer getFormFieldId() {
72
                return formFieldId;
1✔
73
        }
74
        
75
        /**
76
         * @param formFieldId The formFieldId to set.
77
         */
78
        public void setFormFieldId(Integer formFieldId) {
79
                this.formFieldId = formFieldId;
1✔
80
        }
1✔
81
        
82
        /**
83
         * @return Returns the parent FormField.
84
         */
85
        public FormField getParent() {
86
                return parent;
1✔
87
        }
88
        
89
        /**
90
         * @param parent The formField to set as parent.
91
         */
92
        public void setParent(FormField parent) {
93
                this.parent = parent;
1✔
94
        }
1✔
95
        
96
        /**
97
         * @return Returns the form.
98
         */
99
        public Form getForm() {
100
                return form;
1✔
101
        }
102
        
103
        /**
104
         * @param form The form to set.
105
         */
106
        public void setForm(Form form) {
107
                this.form = form;
1✔
108
        }
1✔
109
        
110
        /**
111
         * @return Returns the field.
112
         */
113
        public Field getField() {
114
                return field;
1✔
115
        }
116
        
117
        /**
118
         * @param field The field to set.
119
         */
120
        public void setField(Field field) {
121
                this.field = field;
1✔
122
        }
1✔
123
        
124
        /**
125
         * @return Returns the fieldNumber.
126
         */
127
        public Integer getFieldNumber() {
128
                return fieldNumber;
1✔
129
        }
130
        
131
        /**
132
         * @param fieldNumber The fieldNumber to set.
133
         */
134
        public void setFieldNumber(Integer fieldNumber) {
135
                this.fieldNumber = fieldNumber;
1✔
136
        }
1✔
137
        
138
        /**
139
         * @return Returns the fieldPart.
140
         */
141
        public String getFieldPart() {
142
                return fieldPart;
1✔
143
        }
144
        
145
        /**
146
         * @param fieldPart The fieldPart to set.
147
         */
148
        public void setFieldPart(String fieldPart) {
149
                this.fieldPart = fieldPart;
1✔
150
        }
1✔
151
        
152
        /**
153
         * @return Returns the pageNumber.
154
         */
155
        public Integer getPageNumber() {
156
                return pageNumber;
1✔
157
        }
158
        
159
        /**
160
         * @param pageNumber The pageNumber to set.
161
         */
162
        public void setPageNumber(Integer pageNumber) {
163
                this.pageNumber = pageNumber;
1✔
164
        }
1✔
165
        
166
        /**
167
         * @return Returns the minOccurs.
168
         */
169
        public Integer getMinOccurs() {
170
                return minOccurs;
1✔
171
        }
172
        
173
        /**
174
         * @param minOccurs The minOccurs to set.
175
         */
176
        public void setMinOccurs(Integer minOccurs) {
177
                this.minOccurs = minOccurs;
1✔
178
        }
1✔
179
        
180
        /**
181
         * @return Returns the maxOccurs.
182
         */
183
        public Integer getMaxOccurs() {
184
                return maxOccurs;
1✔
185
        }
186
        
187
        /**
188
         * @param maxOccurs The maxOccurs to set.
189
         */
190
        public void setMaxOccurs(Integer maxOccurs) {
191
                this.maxOccurs = maxOccurs;
1✔
192
        }
1✔
193
        
194
        /**
195
         * @return Returns the required status.
196
         * 
197
         * @deprecated as of 2.0, use {@link #getRequired()}
198
         */
199
        @Deprecated
200
        @JsonIgnore
201
        public Boolean isRequired() {
202
                return getRequired();
×
203
        }
204
        
205
        /**
206
         * @return same as isRequired()
207
         */
208
        public Boolean getRequired() {
209
                return required == null ? Boolean.FALSE : required;
1✔
210
        }
211
        
212
        /**
213
         * @param required The required status to set.
214
         */
215
        public void setRequired(Boolean required) {
216
                this.required = required;
1✔
217
        }
1✔
218
        
219
        /**
220
         * @return Returns the sortWeight.
221
         */
222
        public Float getSortWeight() {
223
                return sortWeight;
1✔
224
        }
225
        
226
        /**
227
         * @param sortWeight The weight to order the formFields on.
228
         */
229
        public void setSortWeight(Float sortWeight) {
230
                this.sortWeight = sortWeight;
1✔
231
        }
1✔
232
        
233
        /**
234
         * @see java.lang.Object#toString()
235
         */
236
        @Override
237
        public String toString() {
238
                if (formFieldId == null) {
×
239
                        return "null";
×
240
                }
241
                
242
                return this.formFieldId.toString();
×
243
        }
244
        
245
        /**
246
         * @since 1.5
247
         * @see org.openmrs.OpenmrsObject#getId()
248
         */
249
        @Override
250
        public Integer getId() {
251
                return getFormFieldId();
×
252
        }
253
        
254
        /**
255
         * @since 1.5
256
         * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
257
         */
258
        @Override
259
        public void setId(Integer id) {
260
                setFormFieldId(id);
×
261
                
262
        }
×
263
        
264
        @Override
265
        public int compareTo(FormField other) {
266
                DefaultComparator pnDefaultComparator = new DefaultComparator();
×
267
                return pnDefaultComparator.compare(this, other);
×
268
        }
269
        
270
        /**
271
         Provides a default comparator.
272
         @since 1.12
273
         **/
274
        public static class DefaultComparator implements Comparator<FormField>, Serializable {
×
275

276
                private static final long serialVersionUID = 1L;
277
                
278
                @Override
279
                public int compare(FormField ff1, FormField ff2) {
280
                        if (ff1.getSortWeight() != null || ff2.getSortWeight() != null) {
×
281
                                if (ff1.getSortWeight() == null) {
×
282
                                        return -1;
×
283
                                }
284
                                if (ff2.getSortWeight() == null) {
×
285
                                        return 1;
×
286
                                }
287
                                int c = ff1.getSortWeight().compareTo(ff2.getSortWeight());
×
288
                                if (c != 0) {
×
289
                                        return c;
×
290
                                }
291
                        }
292
                        if (ff1.getPageNumber() != null || ff2.getPageNumber() != null) {
×
293
                                if (ff1.getPageNumber() == null) {
×
294
                                        return -1;
×
295
                                }
296
                                if (ff2.getPageNumber() == null) {
×
297
                                        return 1;
×
298
                                }
299
                                int c = ff1.getPageNumber().compareTo(ff2.getPageNumber());
×
300
                                if (c != 0) {
×
301
                                        return c;
×
302
                                }
303
                        }
304
                        if (ff1.getFieldNumber() != null || ff2.getFieldNumber() != null) {
×
305
                                if (ff1.getFieldNumber() == null) {
×
306
                                        return -1;
×
307
                                }
308
                                if (ff2.getFieldNumber() == null) {
×
309
                                        return 1;
×
310
                                }
311
                                int c = ff1.getFieldNumber().compareTo(ff2.getFieldNumber());
×
312
                                if (c != 0) {
×
313
                                        return c;
×
314
                                }
315
                        }
316
                        if (ff1.getFieldPart() != null || ff2.getFieldPart() != null) {
×
317
                                if (ff1.getFieldPart() == null) {
×
318
                                        return -1;
×
319
                                }
320
                                if (ff2.getFieldPart() == null) {
×
321
                                        return 1;
×
322
                                }
323
                                int c = ff1.getFieldPart().compareTo(ff2.getFieldPart());
×
324
                                if (c != 0) {
×
325
                                        return c;
×
326
                                }
327
                        }
328
                        if (ff1.getField() != null && ff2.getField() != null) {
×
329
                                int c = ff1.getField().getName().compareTo(ff2.getField().getName());
×
330
                                if (c != 0) {
×
331
                                        return c;
×
332
                                }
333
                        }
334
                        if (ff1.getFormFieldId() == null && ff2.getFormFieldId() != null) {
×
335
                                return -1;
×
336
                        }
337
                        if (ff1.getFormFieldId() != null && ff2.getFormFieldId() == null) {
×
338
                                return 1;
×
339
                        }
340
                        if (ff1.getFormFieldId() == null && ff2.getFormFieldId() == null) {
×
341
                                return 1;
×
342
                        }
343
                        
344
                        return ff1.getFormFieldId().compareTo(ff2.getFormFieldId());
×
345
                }
346
        }
347
}
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

© 2025 Coveralls, Inc