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

pkiraly / metadata-qa-api / #717

28 Aug 2025 09:15AM UTC coverage: 86.426% (-0.1%) from 86.526%
#717

push

pkiraly
Add priorityOnFail

12 of 23 new or added lines in 4 files covered. (52.17%)

3 existing lines in 2 files now uncovered.

5654 of 6542 relevant lines covered (86.43%)

0.86 hits per line

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

72.4
/src/main/java/de/gwdg/metadataqa/api/configuration/schema/Rule.java
1
package de.gwdg.metadataqa.api.configuration.schema;
2

3
import com.fasterxml.jackson.annotation.JsonGetter;
4
import com.fasterxml.jackson.annotation.JsonIgnore;
5
import com.fasterxml.jackson.annotation.JsonInclude;
6
import org.apache.commons.lang3.StringUtils;
7

8
import java.io.Serializable;
9
import java.lang.reflect.Field;
10
import java.util.ArrayList;
11
import java.util.List;
12

13
@JsonInclude(JsonInclude.Include.NON_NULL)
14
public class Rule implements Serializable {
1✔
15

16
  private static final long serialVersionUID = 4101184421853217836L;
17

18
  // general parameters
19
  private String id;
20
  private String description;
21
  private Integer failureScore;
22
  private Integer successScore;
23
  private Integer naScore;
24
  private Boolean hidden = Boolean.FALSE;
1✔
25
  private Boolean skip = Boolean.FALSE;
1✔
26
  private Boolean debug = Boolean.FALSE;
1✔
27
  private ApplicationScope scope;
28
  private Boolean mandatory = Boolean.FALSE;
1✔
29

30
  // checkers
31
  private String pattern;
32
  private String equals;
33
  private String disjoint;
34
  private List<String> in;
35
  private List<Rule> and;
36
  private List<Rule> or;
37
  private List<Rule> not;
38
  private Integer minCount;
39
  private Integer maxCount;
40
  private Double minExclusive;
41
  private Double minInclusive;
42
  private Double maxExclusive;
43
  private Double maxInclusive;
44
  private Integer minLength;
45
  private Integer maxLength;
46
  private String lessThan;
47
  private String lessThanOrEquals;
48
  private String hasValue;
49
  private Boolean unique;
50
  private List<String> contentType;
51
  private Integer maxWords;
52
  private Integer minWords;
53
  private Dimension dimension;
54
  private List<String> dependencies;
55
  private Boolean allowEmptyInstances = Boolean.FALSE;
1✔
56
  private Boolean multilingual;
57
  private ApplicationScope hasLanguageTag;
58
  private List<String> hasChildren;
59
  private MQAFPattern mqafPattern;
60
  private Boolean alwaysCheckDependencies = Boolean.FALSE;
1✔
61
  private String valuePath;
62
  private int timeout;
63
  private Boolean validLink;
64
  private String skippableUrl;
65
  private Boolean priorityOnFail;
66

67
  public String getId() {
68
    return id;
1✔
69
  }
70

71
  public void setId(String id) {
72
    this.id = id;
1✔
73
  }
1✔
74

75
  public Rule withId(String id) {
76
    this.id = id;
1✔
77
    return this;
1✔
78
  }
79

80
  public String getDescription() {
81
    return description;
1✔
82
  }
83

84
  public void setDescription(String description) {
85
    this.description = description;
1✔
86
  }
1✔
87

88
  public Rule withDescription(String description) {
89
    this.description = description;
×
90
    return this;
×
91
  }
92

93
  public String getPattern() {
94
    return pattern;
1✔
95
  }
96

97
  public void setPattern(String pattern) {
98
    this.pattern = pattern;
1✔
99
  }
1✔
100

101
  public Rule withPattern(String pattern) {
102
    setPattern(pattern);
1✔
103
    return this;
1✔
104
  }
105

106
  public String getEquals() {
107
    return equals;
1✔
108
  }
109

110
  public void setEquals(String equals) {
111
    this.equals = equals;
1✔
112
  }
1✔
113

114
  public Rule withEquals(String equals) {
115
    setEquals(equals);
1✔
116
    return this;
1✔
117
  }
118

119
  public String getDisjoint() {
120
    return disjoint;
1✔
121
  }
122

123
  public void setDisjoint(String disjoint) {
124
    this.disjoint = disjoint;
1✔
125
  }
1✔
126

127
  public Rule withDisjoint(String disjoint) {
128
    setDisjoint(disjoint);
1✔
129
    return this;
1✔
130
  }
131

132
  public List<String> getIn() {
133
    return in;
1✔
134
  }
135

136
  public void setIn(List<String> in) {
137
    this.in = in;
1✔
138
  }
1✔
139

140
  public Rule withIn(List<String> in) {
141
    setIn(in);
1✔
142
    return this;
1✔
143
  }
144

145
  @JsonGetter("and")
146
  public List<Rule> getAnd() {
147
    return and;
1✔
148
  }
149

150
  public void setAnd(List<Rule> and) {
151
    this.and = and;
1✔
152
  }
1✔
153

154
  public Rule withAnd(List<Rule> and) {
155
    setAnd(and);
1✔
156
    return this;
1✔
157
  }
158

159
  public List<Rule> getOr() {
160
    return or;
1✔
161
  }
162

163
  public void setOr(List<Rule> or) {
164
    this.or = or;
1✔
165
  }
1✔
166

167
  public Rule withOr(List<Rule> or) {
168
    setOr(or);
1✔
169
    return this;
1✔
170
  }
171

172
  public List<Rule> getNot() {
173
    return not;
1✔
174
  }
175

176
  public void setNot(List<Rule> not) {
177
    this.not = not;
1✔
178
  }
1✔
179

180
  public Rule withNot(List<Rule> not) {
181
    setNot(not);
×
182
    return this;
×
183
  }
184

185
  public Integer getMinCount() {
186
    return minCount;
1✔
187
  }
188

189
  public void setMinCount(Integer minCount) {
190
    this.minCount = minCount;
1✔
191
  }
1✔
192

193
  public void setMinCount(int minCount) {
194
    this.minCount = minCount;
1✔
195
  }
1✔
196

197
  public Rule withMinCount(int minCount) {
198
    setMinCount(minCount);
1✔
199
    return this;
1✔
200
  }
201

202
  public Integer getMaxCount() {
203
    return maxCount;
1✔
204
  }
205

206
  public void setMaxCount(Integer maxCount) {
207
    this.maxCount = maxCount;
1✔
208
  }
1✔
209

210
  public void setMaxCount(int maxCount) {
211
    this.maxCount = maxCount;
1✔
212
  }
1✔
213

214
  public Rule withMaxCount(int maxCount) {
215
    setMaxCount(maxCount);
1✔
216
    return this;
1✔
217
  }
218

219
  public Double getMinExclusive() {
220
    return minExclusive;
1✔
221
  }
222

223
  public void setMinExclusive(Double minExclusive) {
224
    this.minExclusive = minExclusive;
1✔
225
  }
1✔
226

227
  public Rule withMinExclusive(Double minExclusive) {
228
    setMinExclusive(minExclusive);
1✔
229
    return this;
1✔
230
  }
231

232
  public Rule withMinExclusive(Integer minExclusive) {
233
    setMinExclusive(Double.valueOf(minExclusive));
×
234
    return this;
×
235
  }
236

237
  public Double getMinInclusive() {
238
    return minInclusive;
1✔
239
  }
240

241
  public void setMinInclusive(Double minInclusive) {
242
    this.minInclusive = minInclusive;
1✔
243
  }
1✔
244

245
  public Rule withMinInclusive(Double minInclusive) {
246
    setMinInclusive(minInclusive);
1✔
247
    return this;
1✔
248
  }
249

250
  public Rule withMinInclusive(Integer minInclusive) {
251
    setMinInclusive(Double.valueOf(minInclusive));
×
252
    return this;
×
253
  }
254

255
  public Double getMaxExclusive() {
256
    return maxExclusive;
1✔
257
  }
258

259
  public void setMaxExclusive(Double maxExclusive) {
260
    this.maxExclusive = maxExclusive;
1✔
261
  }
1✔
262

263
  public Rule withMaxExclusive(Double maxExclusive) {
264
    setMaxExclusive(maxExclusive);
1✔
265
    return this;
1✔
266
  }
267

268
  public Rule withMaxExclusive(Integer maxExclusive) {
269
    setMaxExclusive(Double.valueOf(maxExclusive));
×
270
    return this;
×
271
  }
272

273
  public Double getMaxInclusive() {
274
    return maxInclusive;
1✔
275
  }
276

277
  public void setMaxInclusive(Double maxInclusive) {
278
    this.maxInclusive = maxInclusive;
1✔
279
  }
1✔
280

281
  public Rule withMaxInclusive(Double maxInclusive) {
282
    setMaxInclusive(maxInclusive);
1✔
283
    return this;
1✔
284
  }
285

286
  public Rule withMaxInclusive(Integer maxInclusive) {
287
    setMaxInclusive(Double.valueOf(maxInclusive));
×
288
    return this;
×
289
  }
290

291
  public Integer getMinLength() {
292
    return minLength;
1✔
293
  }
294

295
  public void setMinLength(Integer minLength) {
296
    this.minLength = minLength;
1✔
297
  }
1✔
298

299
  public void setMinLength(int minLength) {
300
    this.minLength = minLength;
1✔
301
  }
1✔
302

303
  public Rule withMinLength(int minLength) {
304
    setMinLength(minLength);
1✔
305
    return this;
1✔
306
  }
307

308
  public Integer getMaxLength() {
309
    return maxLength;
1✔
310
  }
311

312
  public void setMaxLength(Integer maxLength) {
313
    this.maxLength = maxLength;
1✔
314
  }
1✔
315

316
  public void setMaxLength(int maxLength) {
317
    this.maxLength = maxLength;
1✔
318
  }
1✔
319

320
  public Rule withMaxLength(int maxLength) {
321
    setMaxLength(maxLength);
1✔
322
    return this;
1✔
323
  }
324

325
  public String getLessThan() {
326
    return lessThan;
1✔
327
  }
328

329
  public void setLessThan(String lessThan) {
330
    this.lessThan = lessThan;
1✔
331
  }
1✔
332

333
  public Rule withLessThan(String lessThan) {
334
    setLessThan(lessThan);
1✔
335
    return this;
1✔
336
  }
337

338
  public String getLessThanOrEquals() {
339
    return lessThanOrEquals;
1✔
340
  }
341

342
  public void setLessThanOrEquals(String lessThanOrEquals) {
343
    this.lessThanOrEquals = lessThanOrEquals;
1✔
344
  }
1✔
345

346
  public Rule withLessThanOrEquals(String lessThanOrEquals) {
347
    setLessThanOrEquals(lessThanOrEquals);
1✔
348
    return this;
1✔
349
  }
350

351
  public String getHasValue() {
352
    return hasValue;
1✔
353
  }
354

355
  public void setHasValue(String hasValue) {
356
    this.hasValue = hasValue;
1✔
357
  }
1✔
358

359
  public Rule withHasValue(String hasValue) {
360
    setHasValue(hasValue);
1✔
361
    return this;
1✔
362
  }
363

364
  public List<String> getHasChildren() {
365
    return hasChildren;
1✔
366
  }
367

368
  public void setHasChildren(List<String> hasChildren) {
369
    this.hasChildren = hasChildren;
1✔
370
  }
1✔
371

372
  public Rule withHasChildren(List<String> hasChildren) {
373
    setHasChildren(hasChildren);
×
374
    return this;
×
375
  }
376

377
  public Integer getFailureScore() {
378
    return failureScore;
1✔
379
  }
380

381
  public void setFailureScore(Integer failureScore) {
382
    this.failureScore = failureScore;
1✔
383
  }
1✔
384

385
  public Rule withFailureScore(Integer failureScore) {
386
    setFailureScore(failureScore);
1✔
387
    return this;
1✔
388
  }
389

390
  public Integer getSuccessScore() {
391
    return successScore;
1✔
392
  }
393

394
  public void setSuccessScore(Integer successScore) {
395
    this.successScore = successScore;
1✔
396
  }
1✔
397

398
  public Rule withSuccessScore(Integer successScore) {
399
    setSuccessScore(successScore);
1✔
400
    return this;
1✔
401
  }
402

403
  public Integer getNaScore() {
404
    return naScore;
1✔
405
  }
406

407
  public void setNaScore(Integer naScore) {
408
    this.naScore = naScore;
1✔
409
  }
1✔
410

411
  public Rule withNaScore(Integer naScore) {
412
    setNaScore(naScore);
1✔
413
    return this;
1✔
414
  }
415

416
  public ApplicationScope getScope() {
417
    return scope;
1✔
418
  }
419

420
  public void setScope(ApplicationScope scope) {
421
    this.scope = scope;
1✔
422
  }
1✔
423

424
  public Rule withScope(ApplicationScope scope) {
425
    this.scope = scope;
×
426
    return this;
×
427
  }
428

429
  public Boolean getMandatory() {
430
    return mandatory;
1✔
431
  }
432

433
  public void setMandatory(Boolean mandatory) {
434
    this.mandatory = mandatory;
1✔
435
  }
1✔
436

437
  public Rule withMandatory(Boolean mandatory) {
438
    this.mandatory = mandatory;
×
439
    return this;
×
440
  }
441

442
  public Boolean getUnique() {
443
    return unique;
1✔
444
  }
445

446
  public void setUnique(Boolean unique) {
447
    this.unique = unique;
1✔
448
  }
1✔
449

450
  public Rule withUnique(Boolean unique) {
451
    setUnique(unique);
1✔
452
    return this;
1✔
453
  }
454

455
  public List<String> getContentType() {
456
    return contentType;
1✔
457
  }
458

459
  public void setContentType(List<String> contentType) {
460
    this.contentType = contentType;
1✔
461
  }
1✔
462

463
  public Rule withContentType(List<String> contentType) {
464
    this.contentType = contentType;
×
465
    return this;
×
466
  }
467

468
  public Integer getMaxWords() {
469
    return maxWords;
1✔
470
  }
471

472
  public void setMaxWords(Integer maxWords) {
473
    this.maxWords = maxWords;
1✔
474
  }
1✔
475

476
  public void setMaxWords(int maxWords) {
477
    this.maxWords = maxWords;
×
478
  }
×
479

480
  public Rule withMaxWords(int maxWords) {
481
    setMaxWords(maxWords);
×
482
    return this;
×
483
  }
484

485
  public Integer getMinWords() {
486
    return minWords;
1✔
487
  }
488

489
  public void setMinWords(Integer minWords) {
490
    this.minWords = minWords;
×
491
  }
×
492

493
  public void setMinWords(int minWords) {
494
    this.minWords = minWords;
×
495
  }
×
496

497
  public Rule withMinWords(int minWords) {
498
    setMaxWords(minWords);
×
499
    return this;
×
500
  }
501

502
  public Dimension getDimension() {
503
    return dimension;
1✔
504
  }
505

506
  public void setDimension(Dimension dimension) {
507
    this.dimension = dimension;
1✔
508
  }
1✔
509

510
  public Rule withDimension(Dimension dimension) {
511
    this.dimension = dimension;
×
512
    return this;
×
513
  }
514

515
  public Boolean getHidden() {
516
    return hidden;
1✔
517
  }
518

519
  public void setHidden(Boolean hidden) {
520
    this.hidden = hidden;
1✔
521
  }
1✔
522

523
  public Rule withHidden(Boolean hidden) {
524
    this.hidden = hidden;
×
525
    return this;
×
526
  }
527

528
  public List<String> getDependencies() {
529
    return dependencies;
1✔
530
  }
531

532
  public void setDependencies(List<String> dependencies) {
533
    this.dependencies = dependencies;
1✔
534
  }
1✔
535

536
  public Rule withDependencies(List<String> dependencies) {
537
    this.dependencies = dependencies;
1✔
538
    return this;
1✔
539
  }
540

541
  public Rule withRulesAlreadyPassed(List<String> dependencies) {
542
    this.dependencies = dependencies;
×
543
    return this;
×
544
  }
545

546
  public Boolean getSkip() {
547
    return skip;
1✔
548
  }
549

550
  public void setSkip(Boolean skip) {
551
    this.skip = skip;
1✔
552
  }
1✔
553

554
  public Rule withSkip(Boolean skip) {
555
    this.skip = skip;
×
556
    return this;
×
557
  }
558

559
  public Boolean getDebug() {
560
    return debug;
1✔
561
  }
562

563
  public void setDebug(Boolean debug) {
564
    this.debug = debug;
1✔
565
  }
1✔
566

567
  public Rule withDebug(Boolean debug) {
568
    this.debug = debug;
×
569
    return this;
×
570
  }
571

572
  public Boolean getAllowEmptyInstances() {
573
    return allowEmptyInstances;
1✔
574
  }
575

576
  public void setAllowEmptyInstances(Boolean allowEmptyInstances) {
577
    this.allowEmptyInstances = allowEmptyInstances;
1✔
578
  }
1✔
579

580
  public Rule withAllowEmptyInstances(Boolean allowEmptyInstances) {
581
    this.allowEmptyInstances = allowEmptyInstances;
×
582
    return this;
×
583
  }
584

585
  public Boolean getMultilingual() {
586
    return multilingual;
1✔
587
  }
588

589
  public void setIsMultilingual(Boolean multilingual) {
590
    this.multilingual = multilingual;
1✔
591
  }
1✔
592

593
  public Rule withMultilingual(Boolean multilingual) {
594
    this.multilingual = multilingual;
×
595
    return this;
×
596
  }
597

598
  public ApplicationScope getHasLanguageTag() {
599
    return hasLanguageTag;
1✔
600
  }
601

602
  public void setHasLanguageTag(ApplicationScope hasLanguageTag) {
603
    this.hasLanguageTag = hasLanguageTag;
1✔
604
  }
1✔
605

606
  public Rule withHasLanguageTag(ApplicationScope hasLanguageTag) {
607
    this.hasLanguageTag = hasLanguageTag;
×
608
    return this;
×
609
  }
610

611
  public MQAFPattern getMqafPattern() {
612
    return mqafPattern;
1✔
613
  }
614

615
  public void setMqafPattern(MQAFPattern mqafPattern) {
616
    this.mqafPattern = mqafPattern;
×
617
  }
×
618

619
  public Rule withMqafPattern(MQAFPattern mqafPattern) {
620
    this.mqafPattern = mqafPattern;
×
621
    return this;
×
622
  }
623

624
  public String getValuePath() {
625
    return valuePath;
1✔
626
  }
627

628
  public void setValuePath(String valuePath) {
629
    this.valuePath = valuePath;
1✔
630
  }
1✔
631

632
  public Rule withValuePath(String valuePath) {
633
    this.valuePath = valuePath;
×
634
    return this;
×
635
  }
636

637
  public Integer getTimeout() {
638
    return timeout;
1✔
639
  }
640

641
  public void setTimeout(int timeout) {
642
    this.timeout = timeout;
×
643
  }
×
644

645
  public Rule withTimeout(int timeout) {
646
    this.timeout = timeout;
×
647
    return this;
×
648
  }
649

650
  @JsonGetter("alwaysCheckDependencies")
651
  public Boolean getAlwaysCheckDependencies() {
652
    return alwaysCheckDependencies;
1✔
653
  }
654

655
  public void setAlwaysCheckDependencies(Boolean alwaysCheckDependencies) {
656
    this.alwaysCheckDependencies = alwaysCheckDependencies;
1✔
657
  }
1✔
658

659
  public Rule withAlwaysCheckDependencies(Boolean alwaysCheckDependencies) {
660
    this.alwaysCheckDependencies = alwaysCheckDependencies;
×
661
    return this;
×
662
  }
663

664
  public Boolean getValidLink() {
665
    return validLink;
1✔
666
  }
667

668
  public void setValidLink(Boolean validLink) {
669
    this.validLink = validLink;
×
670
  }
×
671

672
  public Rule withValidLink(Boolean validLink) {
673
    this.validLink = validLink;
×
674
    return this;
×
675
  }
676

677
  public String getSkippableUrl() {
678
    return skippableUrl;
1✔
679
  }
680

681
  public void setSkippableUrl(String skippableUrl) {
682
    this.skippableUrl = skippableUrl;
×
683
  }
×
684

685
  public Rule withSkippableUrl(String skippableUrl) {
686
    this.skippableUrl = skippableUrl;
×
687
    return this;
×
688
  }
689

690
  public Boolean getPriorityOnFail() {
691
    return priorityOnFail;
1✔
692
  }
693

694
  public void setPriorityOnFail(Boolean priorityOnFail) {
NEW
695
    this.priorityOnFail = priorityOnFail;
×
NEW
696
  }
×
697

698
  public Rule withPriorityOnFail(Boolean priorityOnFail) {
NEW
699
    this.priorityOnFail = priorityOnFail;
×
NEW
700
    return this;
×
701
  }
702

703
  @JsonIgnore
704
  public List<String> getRulenames() {
705
    List<String> excludeFromComparision = List.of("serialVersionUID", "id", "description",
1✔
706
      "failureScore", "successScore", "naScore", "hidden", "dependencies", "skip", "debug", "allowEmptyInstances");
707

708
    List<String> existingRules = new ArrayList<>();
1✔
709
    for (Field field : getClass().getDeclaredFields()) {
1✔
710
      if (!excludeFromComparision.contains(field.getName())) {
1✔
711
        field.setAccessible(true);
1✔
712
        try {
713
          Object value = field.get(this);
1✔
714
          if (value != null)
1✔
715
            existingRules.add(field.getName());
1✔
716
        } catch (IllegalAccessException e) {
×
717
          throw new RuntimeException(e);
×
718
        }
1✔
719
      }
720
    }
721
    return existingRules;
1✔
722
  }
723

724
  public Object get(String key) {
725
    for (Field field : getClass().getDeclaredFields()) {
1✔
726
      if (field.getName().equals(key)) {
1✔
727
        try {
728
          return field.get(this);
1✔
729
        } catch (IllegalAccessException e) {
×
730
          throw new RuntimeException(e);
×
731
        }
732
      }
733
    }
734
    return null;
×
735
  }
736

737
  public void set(String key, Object value) {
738
    for (Field field : getClass().getDeclaredFields()) {
1✔
739
      if (field.getName().equals(key)) {
1✔
740
        try {
741
          field.set(this, value);
1✔
742
        } catch (IllegalAccessException e) {
×
743
          throw new RuntimeException(e);
×
744
        }
1✔
745
      }
746
    }
747
  }
1✔
748

749
}
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