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

pkiraly / metadata-qa-api / #695

13 Jun 2025 03:55PM UTC coverage: 86.677% (-0.3%) from 86.944%
#695

push

pkiraly
Add validLink

61 of 90 new or added lines in 6 files covered. (67.78%)

5608 of 6470 relevant lines covered (86.68%)

0.87 hits per line

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

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

65
  public String getId() {
66
    return id;
1✔
67
  }
68

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

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

78
  public String getDescription() {
79
    return description;
1✔
80
  }
81

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

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

91
  public String getPattern() {
92
    return pattern;
1✔
93
  }
94

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

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

104
  public String getEquals() {
105
    return equals;
1✔
106
  }
107

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

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

117
  public String getDisjoint() {
118
    return disjoint;
1✔
119
  }
120

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

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

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

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

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

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

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

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

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

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

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

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

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

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

183
  public Integer getMinCount() {
184
    return minCount;
1✔
185
  }
186

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

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

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

200
  public Integer getMaxCount() {
201
    return maxCount;
1✔
202
  }
203

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

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

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

217
  public Double getMinExclusive() {
218
    return minExclusive;
1✔
219
  }
220

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

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

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

235
  public Double getMinInclusive() {
236
    return minInclusive;
1✔
237
  }
238

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

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

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

253
  public Double getMaxExclusive() {
254
    return maxExclusive;
1✔
255
  }
256

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

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

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

271
  public Double getMaxInclusive() {
272
    return maxInclusive;
1✔
273
  }
274

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

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

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

289
  public Integer getMinLength() {
290
    return minLength;
1✔
291
  }
292

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

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

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

306
  public Integer getMaxLength() {
307
    return maxLength;
1✔
308
  }
309

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

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

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

323
  public String getLessThan() {
324
    return lessThan;
1✔
325
  }
326

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

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

336
  public String getLessThanOrEquals() {
337
    return lessThanOrEquals;
1✔
338
  }
339

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

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

349
  public String getHasValue() {
350
    return hasValue;
1✔
351
  }
352

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

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

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

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

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

375
  public Integer getFailureScore() {
376
    return failureScore;
1✔
377
  }
378

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

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

388
  public Integer getSuccessScore() {
389
    return successScore;
1✔
390
  }
391

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

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

401
  public Integer getNaScore() {
402
    return naScore;
1✔
403
  }
404

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

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

414
  public ApplicationScope getScope() {
415
    return scope;
1✔
416
  }
417

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

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

427
  public Boolean getMandatory() {
428
    return mandatory;
1✔
429
  }
430

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

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

440
  public Boolean getUnique() {
441
    return unique;
1✔
442
  }
443

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

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

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

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

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

466
  public Integer getMaxWords() {
467
    return maxWords;
1✔
468
  }
469

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

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

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

483
  public Integer getMinWords() {
484
    return minWords;
1✔
485
  }
486

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

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

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

500
  public Dimension getDimension() {
501
    return dimension;
1✔
502
  }
503

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

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

513
  public Boolean getHidden() {
514
    return hidden;
1✔
515
  }
516

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

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

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

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

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

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

544
  public Boolean getSkip() {
545
    return skip;
1✔
546
  }
547

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

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

557
  public Boolean getDebug() {
558
    return debug;
1✔
559
  }
560

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

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

570
  public Boolean getAllowEmptyInstances() {
571
    return allowEmptyInstances;
1✔
572
  }
573

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

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

583
  public Boolean getMultilingual() {
584
    return multilingual;
1✔
585
  }
586

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

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

596
  public ApplicationScope getHasLanguageTag() {
597
    return hasLanguageTag;
1✔
598
  }
599

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

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

609
  public MQAFPattern getMqafPattern() {
610
    return mqafPattern;
1✔
611
  }
612

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

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

622
  public String getValuePath() {
623
    return valuePath;
1✔
624
  }
625

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

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

635
  public Integer getTimeout() {
636
    return timeout;
1✔
637
  }
638

639
  public void setTimeout(int timeout) {
NEW
640
    this.timeout = timeout;
×
NEW
641
  }
×
642

643
  public Rule withTimeout(int timeout) {
NEW
644
    this.timeout = timeout;
×
NEW
645
    return this;
×
646
  }
647

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

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

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

662
  public Boolean getValidLink() {
663
    return validLink;
1✔
664
  }
665

666
  public void setValidLink(Boolean validLink) {
NEW
667
    this.validLink = validLink;
×
NEW
668
  }
×
669

670
  public Rule withValidLink(Boolean validLink) {
NEW
671
    this.validLink = validLink;
×
NEW
672
    return this;
×
673
  }
674

675
  @JsonIgnore
676
  public List<String> getRulenames() {
677
    List<String> excludeFromComparision = List.of("serialVersionUID", "id", "description",
1✔
678
      "failureScore", "successScore", "naScore", "hidden", "dependencies", "skip", "debug", "allowEmptyInstances");
679

680
    List<String> existingRules = new ArrayList<>();
1✔
681
    for (Field field : getClass().getDeclaredFields()) {
1✔
682
      if (!excludeFromComparision.contains(field.getName())) {
1✔
683
        field.setAccessible(true);
1✔
684
        try {
685
          Object value = field.get(this);
1✔
686
          if (value != null)
1✔
687
            existingRules.add(field.getName());
1✔
688
        } catch (IllegalAccessException e) {
×
689
          throw new RuntimeException(e);
×
690
        }
1✔
691
      }
692
    }
693
    return existingRules;
1✔
694
  }
695

696
  public Object get(String key) {
697
    for (Field field : getClass().getDeclaredFields()) {
1✔
698
      if (field.getName().equals(key)) {
1✔
699
        try {
700
          return field.get(this);
1✔
701
        } catch (IllegalAccessException e) {
×
702
          throw new RuntimeException(e);
×
703
        }
704
      }
705
    }
706
    return null;
×
707
  }
708

709
  public void set(String key, Object value) {
710
    for (Field field : getClass().getDeclaredFields()) {
1✔
711
      if (field.getName().equals(key)) {
1✔
712
        try {
713
          field.set(this, value);
1✔
714
        } catch (IllegalAccessException e) {
×
715
          throw new RuntimeException(e);
×
716
        }
1✔
717
      }
718
    }
719
  }
1✔
720
}
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