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

pkiraly / metadata-qa-api / #692

04 Jun 2025 11:56AM UTC coverage: 86.93% (-0.3%) from 87.231%
#692

push

pkiraly
Merge branch 'main' of github.com:pkiraly/metadata-qa-api

5547 of 6381 relevant lines covered (86.93%)

0.87 hits per line

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

76.45
/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

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

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

15
  private static final long serialVersionUID = 4101184421853217836L;
16

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

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

62
  public String getId() {
63
    return id;
1✔
64
  }
65

66
  public void setId(String id) {
67
    this.id = id;
1✔
68
  }
1✔
69

70
  public Rule withId(String id) {
71
    this.id = id;
1✔
72
    return this;
1✔
73
  }
74

75
  public String getDescription() {
76
    return description;
1✔
77
  }
78

79
  public void setDescription(String description) {
80
    this.description = description;
1✔
81
  }
1✔
82

83
  public Rule withDescription(String description) {
84
    this.description = description;
×
85
    return this;
×
86
  }
87

88
  public String getPattern() {
89
    return pattern;
1✔
90
  }
91

92
  public void setPattern(String pattern) {
93
    this.pattern = pattern;
1✔
94
  }
1✔
95

96
  public Rule withPattern(String pattern) {
97
    setPattern(pattern);
1✔
98
    return this;
1✔
99
  }
100

101
  public String getEquals() {
102
    return equals;
1✔
103
  }
104

105
  public void setEquals(String equals) {
106
    this.equals = equals;
1✔
107
  }
1✔
108

109
  public Rule withEquals(String equals) {
110
    setEquals(equals);
1✔
111
    return this;
1✔
112
  }
113

114
  public String getDisjoint() {
115
    return disjoint;
1✔
116
  }
117

118
  public void setDisjoint(String disjoint) {
119
    this.disjoint = disjoint;
1✔
120
  }
1✔
121

122
  public Rule withDisjoint(String disjoint) {
123
    setDisjoint(disjoint);
1✔
124
    return this;
1✔
125
  }
126

127
  public List<String> getIn() {
128
    return in;
1✔
129
  }
130

131
  public void setIn(List<String> in) {
132
    this.in = in;
1✔
133
  }
1✔
134

135
  public Rule withIn(List<String> in) {
136
    setIn(in);
1✔
137
    return this;
1✔
138
  }
139

140
  @JsonGetter("and")
141
  public List<Rule> getAnd() {
142
    return and;
1✔
143
  }
144

145
  public void setAnd(List<Rule> and) {
146
    this.and = and;
1✔
147
  }
1✔
148

149
  public Rule withAnd(List<Rule> and) {
150
    setAnd(and);
1✔
151
    return this;
1✔
152
  }
153

154
  public List<Rule> getOr() {
155
    return or;
1✔
156
  }
157

158
  public void setOr(List<Rule> or) {
159
    this.or = or;
1✔
160
  }
1✔
161

162
  public Rule withOr(List<Rule> or) {
163
    setOr(or);
1✔
164
    return this;
1✔
165
  }
166

167
  public List<Rule> getNot() {
168
    return not;
1✔
169
  }
170

171
  public void setNot(List<Rule> not) {
172
    this.not = not;
1✔
173
  }
1✔
174

175
  public Rule withNot(List<Rule> not) {
176
    setNot(not);
×
177
    return this;
×
178
  }
179

180
  public Integer getMinCount() {
181
    return minCount;
1✔
182
  }
183

184
  public void setMinCount(Integer minCount) {
185
    this.minCount = minCount;
1✔
186
  }
1✔
187

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

192
  public Rule withMinCount(int minCount) {
193
    setMinCount(minCount);
1✔
194
    return this;
1✔
195
  }
196

197
  public Integer getMaxCount() {
198
    return maxCount;
1✔
199
  }
200

201
  public void setMaxCount(Integer maxCount) {
202
    this.maxCount = maxCount;
1✔
203
  }
1✔
204

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

209
  public Rule withMaxCount(int maxCount) {
210
    setMaxCount(maxCount);
1✔
211
    return this;
1✔
212
  }
213

214
  public Double getMinExclusive() {
215
    return minExclusive;
1✔
216
  }
217

218
  public void setMinExclusive(Double minExclusive) {
219
    this.minExclusive = minExclusive;
1✔
220
  }
1✔
221

222
  public Rule withMinExclusive(Double minExclusive) {
223
    setMinExclusive(minExclusive);
1✔
224
    return this;
1✔
225
  }
226

227
  public Rule withMinExclusive(Integer minExclusive) {
228
    setMinExclusive(Double.valueOf(minExclusive));
×
229
    return this;
×
230
  }
231

232
  public Double getMinInclusive() {
233
    return minInclusive;
1✔
234
  }
235

236
  public void setMinInclusive(Double minInclusive) {
237
    this.minInclusive = minInclusive;
1✔
238
  }
1✔
239

240
  public Rule withMinInclusive(Double minInclusive) {
241
    setMinInclusive(minInclusive);
1✔
242
    return this;
1✔
243
  }
244

245
  public Rule withMinInclusive(Integer minInclusive) {
246
    setMinInclusive(Double.valueOf(minInclusive));
×
247
    return this;
×
248
  }
249

250
  public Double getMaxExclusive() {
251
    return maxExclusive;
1✔
252
  }
253

254
  public void setMaxExclusive(Double maxExclusive) {
255
    this.maxExclusive = maxExclusive;
1✔
256
  }
1✔
257

258
  public Rule withMaxExclusive(Double maxExclusive) {
259
    setMaxExclusive(maxExclusive);
1✔
260
    return this;
1✔
261
  }
262

263
  public Rule withMaxExclusive(Integer maxExclusive) {
264
    setMaxExclusive(Double.valueOf(maxExclusive));
×
265
    return this;
×
266
  }
267

268
  public Double getMaxInclusive() {
269
    return maxInclusive;
1✔
270
  }
271

272
  public void setMaxInclusive(Double maxInclusive) {
273
    this.maxInclusive = maxInclusive;
1✔
274
  }
1✔
275

276
  public Rule withMaxInclusive(Double maxInclusive) {
277
    setMaxInclusive(maxInclusive);
1✔
278
    return this;
1✔
279
  }
280

281
  public Rule withMaxInclusive(Integer maxInclusive) {
282
    setMaxInclusive(Double.valueOf(maxInclusive));
×
283
    return this;
×
284
  }
285

286
  public Integer getMinLength() {
287
    return minLength;
1✔
288
  }
289

290
  public void setMinLength(Integer minLength) {
291
    this.minLength = minLength;
1✔
292
  }
1✔
293

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

298
  public Rule withMinLength(int minLength) {
299
    setMinLength(minLength);
1✔
300
    return this;
1✔
301
  }
302

303
  public Integer getMaxLength() {
304
    return maxLength;
1✔
305
  }
306

307
  public void setMaxLength(Integer maxLength) {
308
    this.maxLength = maxLength;
1✔
309
  }
1✔
310

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

315
  public Rule withMaxLength(int maxLength) {
316
    setMaxLength(maxLength);
1✔
317
    return this;
1✔
318
  }
319

320
  public String getLessThan() {
321
    return lessThan;
1✔
322
  }
323

324
  public void setLessThan(String lessThan) {
325
    this.lessThan = lessThan;
1✔
326
  }
1✔
327

328
  public Rule withLessThan(String lessThan) {
329
    setLessThan(lessThan);
1✔
330
    return this;
1✔
331
  }
332

333
  public String getLessThanOrEquals() {
334
    return lessThanOrEquals;
1✔
335
  }
336

337
  public void setLessThanOrEquals(String lessThanOrEquals) {
338
    this.lessThanOrEquals = lessThanOrEquals;
1✔
339
  }
1✔
340

341
  public Rule withLessThanOrEquals(String lessThanOrEquals) {
342
    setLessThanOrEquals(lessThanOrEquals);
1✔
343
    return this;
1✔
344
  }
345

346
  public String getHasValue() {
347
    return hasValue;
1✔
348
  }
349

350
  public void setHasValue(String hasValue) {
351
    this.hasValue = hasValue;
1✔
352
  }
1✔
353

354
  public Rule withHasValue(String hasValue) {
355
    setHasValue(hasValue);
1✔
356
    return this;
1✔
357
  }
358

359
  public List<String> getHasChildren() {
360
    return hasChildren;
1✔
361
  }
362

363
  public void setHasChildren(List<String> hasChildren) {
364
    this.hasChildren = hasChildren;
1✔
365
  }
1✔
366

367
  public Rule withHasChildren(List<String> hasChildren) {
368
    setHasChildren(hasChildren);
×
369
    return this;
×
370
  }
371

372
  public Integer getFailureScore() {
373
    return failureScore;
1✔
374
  }
375

376
  public void setFailureScore(Integer failureScore) {
377
    this.failureScore = failureScore;
1✔
378
  }
1✔
379

380
  public Rule withFailureScore(Integer failureScore) {
381
    setFailureScore(failureScore);
1✔
382
    return this;
1✔
383
  }
384

385
  public Integer getSuccessScore() {
386
    return successScore;
1✔
387
  }
388

389
  public void setSuccessScore(Integer successScore) {
390
    this.successScore = successScore;
1✔
391
  }
1✔
392

393
  public Rule withSuccessScore(Integer successScore) {
394
    setSuccessScore(successScore);
1✔
395
    return this;
1✔
396
  }
397

398
  public Integer getNaScore() {
399
    return naScore;
1✔
400
  }
401

402
  public void setNaScore(Integer naScore) {
403
    this.naScore = naScore;
1✔
404
  }
1✔
405

406
  public Rule withNaScore(Integer naScore) {
407
    setNaScore(naScore);
1✔
408
    return this;
1✔
409
  }
410

411
  public ApplicationScope getScope() {
412
    return scope;
1✔
413
  }
414

415
  public void setScope(ApplicationScope scope) {
416
    this.scope = scope;
1✔
417
  }
1✔
418

419
  public Rule withScope(ApplicationScope scope) {
420
    this.scope = scope;
×
421
    return this;
×
422
  }
423

424
  public Boolean getMandatory() {
425
    return mandatory;
1✔
426
  }
427

428
  public void setMandatory(Boolean mandatory) {
429
    this.mandatory = mandatory;
1✔
430
  }
1✔
431

432
  public Rule withMandatory(Boolean mandatory) {
433
    this.mandatory = mandatory;
×
434
    return this;
×
435
  }
436

437
  public Boolean getUnique() {
438
    return unique;
1✔
439
  }
440

441
  public void setUnique(Boolean unique) {
442
    this.unique = unique;
1✔
443
  }
1✔
444

445
  public Rule withUnique(Boolean unique) {
446
    setUnique(unique);
1✔
447
    return this;
1✔
448
  }
449

450
  public List<String> getContentType() {
451
    return contentType;
1✔
452
  }
453

454
  public void setContentType(List<String> contentType) {
455
    this.contentType = contentType;
1✔
456
  }
1✔
457

458
  public Rule withContentType(List<String> contentType) {
459
    this.contentType = contentType;
×
460
    return this;
×
461
  }
462

463
  public Integer getMaxWords() {
464
    return maxWords;
1✔
465
  }
466

467
  public void setMaxWords(Integer maxWords) {
468
    this.maxWords = maxWords;
1✔
469
  }
1✔
470

471
  public void setMaxWords(int maxWords) {
472
    this.maxWords = maxWords;
×
473
  }
×
474

475
  public Rule withMaxWords(int maxWords) {
476
    setMaxWords(maxWords);
×
477
    return this;
×
478
  }
479

480
  public Integer getMinWords() {
481
    return minWords;
1✔
482
  }
483

484
  public void setMinWords(Integer minWords) {
485
    this.minWords = minWords;
×
486
  }
×
487

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

492
  public Rule withMinWords(int minWords) {
493
    setMaxWords(minWords);
×
494
    return this;
×
495
  }
496

497
  public Dimension getDimension() {
498
    return dimension;
1✔
499
  }
500

501
  public void setDimension(Dimension dimension) {
502
    this.dimension = dimension;
1✔
503
  }
1✔
504

505
  public Rule withDimension(Dimension dimension) {
506
    this.dimension = dimension;
×
507
    return this;
×
508
  }
509

510
  public Boolean getHidden() {
511
    return hidden;
1✔
512
  }
513

514
  public void setHidden(Boolean hidden) {
515
    this.hidden = hidden;
1✔
516
  }
1✔
517

518
  public Rule withHidden(Boolean hidden) {
519
    this.hidden = hidden;
×
520
    return this;
×
521
  }
522

523
  public List<String> getDependencies() {
524
    return dependencies;
1✔
525
  }
526

527
  public void setDependencies(List<String> dependencies) {
528
    this.dependencies = dependencies;
1✔
529
  }
1✔
530

531
  public Rule withDependencies(List<String> dependencies) {
532
    this.dependencies = dependencies;
1✔
533
    return this;
1✔
534
  }
535

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

541
  public Boolean getSkip() {
542
    return skip;
1✔
543
  }
544

545
  public void setSkip(Boolean skip) {
546
    this.skip = skip;
1✔
547
  }
1✔
548

549
  public Rule withSkip(Boolean skip) {
550
    this.skip = skip;
×
551
    return this;
×
552
  }
553

554
  public Boolean getDebug() {
555
    return debug;
1✔
556
  }
557

558
  public void setDebug(Boolean debug) {
559
    this.debug = debug;
1✔
560
  }
1✔
561

562
  public Rule withDebug(Boolean debug) {
563
    this.debug = debug;
×
564
    return this;
×
565
  }
566

567
  public Boolean getAllowEmptyInstances() {
568
    return allowEmptyInstances;
1✔
569
  }
570

571
  public void setAllowEmptyInstances(Boolean allowEmptyInstances) {
572
    this.allowEmptyInstances = allowEmptyInstances;
1✔
573
  }
1✔
574

575
  public Rule withAllowEmptyInstances(Boolean allowEmptyInstances) {
576
    this.allowEmptyInstances = allowEmptyInstances;
×
577
    return this;
×
578
  }
579

580
  public Boolean getMultilingual() {
581
    return multilingual;
1✔
582
  }
583

584
  public void setIsMultilingual(Boolean multilingual) {
585
    this.multilingual = multilingual;
1✔
586
  }
1✔
587

588
  public Rule withMultilingual(Boolean multilingual) {
589
    this.multilingual = multilingual;
×
590
    return this;
×
591
  }
592

593
  public ApplicationScope getHasLanguageTag() {
594
    return hasLanguageTag;
1✔
595
  }
596

597
  public void setHasLanguageTag(ApplicationScope hasLanguageTag) {
598
    this.hasLanguageTag = hasLanguageTag;
1✔
599
  }
1✔
600

601
  public Rule withHasLanguageTag(ApplicationScope hasLanguageTag) {
602
    this.hasLanguageTag = hasLanguageTag;
×
603
    return this;
×
604
  }
605

606
  public MQAFPattern getMqafPattern() {
607
    return mqafPattern;
1✔
608
  }
609

610
  public void setMqafPattern(MQAFPattern mqafPattern) {
611
    this.mqafPattern = mqafPattern;
×
612
  }
×
613

614
  public Rule withMqafPattern(MQAFPattern mqafPattern) {
615
    this.mqafPattern = mqafPattern;
×
616
    return this;
×
617
  }
618

619
  public String getValuePath() {
620
    return valuePath;
1✔
621
  }
622

623
  public void setValuePath(String valuePath) {
624
    this.valuePath = valuePath;
1✔
625
  }
1✔
626

627
  public Rule withValuePath(String valuePath) {
628
    this.valuePath = valuePath;
×
629
    return this;
×
630
  }
631

632
  @JsonGetter("alwaysCheckDependencies")
633
  public Boolean getAlwaysCheckDependencies() {
634
    return alwaysCheckDependencies;
1✔
635
  }
636

637
  public void setAlwaysCheckDependencies(Boolean alwaysCheckDependencies) {
638
    this.alwaysCheckDependencies = alwaysCheckDependencies;
1✔
639
  }
1✔
640

641
  public Rule withAlwaysCheckDependencies(Boolean alwaysCheckDependencies) {
642
    this.alwaysCheckDependencies = alwaysCheckDependencies;
×
643
    return this;
×
644
  }
645

646
  @JsonIgnore
647
  public List<String> getRulenames() {
648
    List<String> excludeFromComparision = List.of("serialVersionUID", "id", "description",
1✔
649
      "failureScore", "successScore", "naScore", "hidden", "dependencies", "skip", "debug", "allowEmptyInstances");
650

651
    List<String> existingRules = new ArrayList<>();
1✔
652
    for (Field field : getClass().getDeclaredFields()) {
1✔
653
      if (!excludeFromComparision.contains(field.getName())) {
1✔
654
        field.setAccessible(true);
1✔
655
        try {
656
          Object value = field.get(this);
1✔
657
          if (value != null)
1✔
658
            existingRules.add(field.getName());
1✔
659
        } catch (IllegalAccessException e) {
×
660
          throw new RuntimeException(e);
×
661
        }
1✔
662
      }
663
    }
664
    return existingRules;
1✔
665
  }
666

667
  public Object get(String key) {
668
    for (Field field : getClass().getDeclaredFields()) {
1✔
669
      if (field.getName().equals(key)) {
1✔
670
        try {
671
          return field.get(this);
1✔
672
        } catch (IllegalAccessException e) {
×
673
          throw new RuntimeException(e);
×
674
        }
675
      }
676
    }
677
    return null;
×
678
  }
679

680
  public void set(String key, Object value) {
681
    for (Field field : getClass().getDeclaredFields()) {
1✔
682
      if (field.getName().equals(key)) {
1✔
683
        try {
684
          field.set(this, value);
1✔
685
        } catch (IllegalAccessException e) {
×
686
          throw new RuntimeException(e);
×
687
        }
1✔
688
      }
689
    }
690
  }
1✔
691
}
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