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

pkiraly / metadata-qa-api / #634

13 Mar 2025 08:06PM UTC coverage: 87.186% (-0.1%) from 87.296%
#634

push

pkiraly
Fix dependency checker #223

20 of 74 new or added lines in 11 files covered. (27.03%)

1 existing line in 1 file now uncovered.

5375 of 6165 relevant lines covered (87.19%)

0.87 hits per line

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

75.11
/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
  private String id;
18
  private String description;
19
  private Integer failureScore;
20
  private Integer successScore;
21
  private Integer naScore;
22

23
  private String pattern;
24
  private String equals;
25
  private String disjoint;
26
  private List<String> in;
27
  private List<Rule> and;
28
  private List<Rule> or;
29
  private List<Rule> not;
30
  private Integer minCount;
31
  private Integer maxCount;
32
  private Double minExclusive;
33
  private Double minInclusive;
34
  private Double maxExclusive;
35
  private Double maxInclusive;
36
  private Integer minLength;
37
  private Integer maxLength;
38
  private String lessThan;
39
  private String lessThanOrEquals;
40
  private String hasValue;
41
  private Boolean unique;
42
  private List<String> contentType;
43
  private Integer maxWords;
44
  private Integer minWords;
45
  private Dimension dimension;
46
  private Boolean hidden = Boolean.FALSE;
1✔
47
  private List<String> dependencies;
48
  private Boolean skip = Boolean.FALSE;
1✔
49
  private Boolean debug = Boolean.FALSE;
1✔
50
  private Boolean allowEmptyInstances = Boolean.FALSE;
1✔
51
  private Boolean multilingual;
52
  private ApplicationScope hasLanguageTag;
53
  private List<String> hasChildren;
54
  private MQAFPattern mqafPattern;
55

56
  public String getId() {
57
    return id;
1✔
58
  }
59

60
  public void setId(String id) {
61
    this.id = id;
1✔
62
  }
1✔
63

64
  public Rule withId(String id) {
65
    this.id = id;
1✔
66
    return this;
1✔
67
  }
68

69
  public String getDescription() {
70
    return description;
1✔
71
  }
72

73
  public void setDescription(String description) {
74
    this.description = description;
1✔
75
  }
1✔
76

77
  public Rule withDescription(String description) {
78
    this.description = description;
×
79
    return this;
×
80
  }
81

82
  public String getPattern() {
83
    return pattern;
1✔
84
  }
85

86
  public void setPattern(String pattern) {
87
    this.pattern = pattern;
1✔
88
  }
1✔
89

90
  public Rule withPattern(String pattern) {
91
    setPattern(pattern);
1✔
92
    return this;
1✔
93
  }
94

95
  public String getEquals() {
96
    return equals;
1✔
97
  }
98

99
  public void setEquals(String equals) {
100
    this.equals = equals;
1✔
101
  }
1✔
102

103
  public Rule withEquals(String equals) {
104
    setEquals(equals);
1✔
105
    return this;
1✔
106
  }
107

108
  public String getDisjoint() {
109
    return disjoint;
1✔
110
  }
111

112
  public void setDisjoint(String disjoint) {
113
    this.disjoint = disjoint;
1✔
114
  }
1✔
115

116
  public Rule withDisjoint(String disjoint) {
117
    setDisjoint(disjoint);
1✔
118
    return this;
1✔
119
  }
120

121
  public List<String> getIn() {
122
    return in;
1✔
123
  }
124

125
  public void setIn(List<String> in) {
126
    this.in = in;
1✔
127
  }
1✔
128

129
  public Rule withIn(List<String> in) {
130
    setIn(in);
1✔
131
    return this;
1✔
132
  }
133

134
  @JsonGetter("and")
135
  public List<Rule> getAnd() {
136
    return and;
1✔
137
  }
138

139
  public void setAnd(List<Rule> and) {
140
    this.and = and;
1✔
141
  }
1✔
142

143
  public Rule withAnd(List<Rule> and) {
144
    setAnd(and);
1✔
145
    return this;
1✔
146
  }
147

148
  public List<Rule> getOr() {
149
    return or;
1✔
150
  }
151

152
  public void setOr(List<Rule> or) {
153
    this.or = or;
1✔
154
  }
1✔
155

156
  public Rule withOr(List<Rule> or) {
157
    setOr(or);
1✔
158
    return this;
1✔
159
  }
160

161
  public List<Rule> getNot() {
162
    return not;
1✔
163
  }
164

165
  public void setNot(List<Rule> not) {
166
    this.not = not;
1✔
167
  }
1✔
168

169
  public Rule withNot(List<Rule> not) {
170
    setNot(not);
×
171
    return this;
×
172
  }
173

174
  public Integer getMinCount() {
175
    return minCount;
1✔
176
  }
177

178
  public void setMinCount(Integer minCount) {
179
    this.minCount = minCount;
1✔
180
  }
1✔
181

182
  public void setMinCount(int minCount) {
183
    this.minCount = minCount;
1✔
184
  }
1✔
185

186
  public Rule withMinCount(int minCount) {
187
    setMinCount(minCount);
1✔
188
    return this;
1✔
189
  }
190

191
  public Integer getMaxCount() {
192
    return maxCount;
1✔
193
  }
194

195
  public void setMaxCount(Integer maxCount) {
196
    this.maxCount = maxCount;
1✔
197
  }
1✔
198

199
  public void setMaxCount(int maxCount) {
200
    this.maxCount = maxCount;
1✔
201
  }
1✔
202

203
  public Rule withMaxCount(int maxCount) {
204
    setMaxCount(maxCount);
1✔
205
    return this;
1✔
206
  }
207

208
  public Double getMinExclusive() {
209
    return minExclusive;
1✔
210
  }
211

212
  public void setMinExclusive(Double minExclusive) {
213
    this.minExclusive = minExclusive;
1✔
214
  }
1✔
215

216
  public Rule withMinExclusive(Double minExclusive) {
217
    setMinExclusive(minExclusive);
1✔
218
    return this;
1✔
219
  }
220

221
  public Rule withMinExclusive(Integer minExclusive) {
222
    setMinExclusive(Double.valueOf(minExclusive));
×
223
    return this;
×
224
  }
225

226
  public Double getMinInclusive() {
227
    return minInclusive;
1✔
228
  }
229

230
  public void setMinInclusive(Double minInclusive) {
231
    this.minInclusive = minInclusive;
1✔
232
  }
1✔
233

234
  public Rule withMinInclusive(Double minInclusive) {
235
    setMinInclusive(minInclusive);
1✔
236
    return this;
1✔
237
  }
238

239
  public Rule withMinInclusive(Integer minInclusive) {
240
    setMinInclusive(Double.valueOf(minInclusive));
×
241
    return this;
×
242
  }
243

244
  public Double getMaxExclusive() {
245
    return maxExclusive;
1✔
246
  }
247

248
  public void setMaxExclusive(Double maxExclusive) {
249
    this.maxExclusive = maxExclusive;
1✔
250
  }
1✔
251

252
  public Rule withMaxExclusive(Double maxExclusive) {
253
    setMaxExclusive(maxExclusive);
1✔
254
    return this;
1✔
255
  }
256

257
  public Rule withMaxExclusive(Integer maxExclusive) {
258
    setMaxExclusive(Double.valueOf(maxExclusive));
×
259
    return this;
×
260
  }
261

262
  public Double getMaxInclusive() {
263
    return maxInclusive;
1✔
264
  }
265

266
  public void setMaxInclusive(Double maxInclusive) {
267
    this.maxInclusive = maxInclusive;
1✔
268
  }
1✔
269

270
  public Rule withMaxInclusive(Double maxInclusive) {
271
    setMaxInclusive(maxInclusive);
1✔
272
    return this;
1✔
273
  }
274

275
  public Rule withMaxInclusive(Integer maxInclusive) {
276
    setMaxInclusive(Double.valueOf(maxInclusive));
×
277
    return this;
×
278
  }
279

280
  public Integer getMinLength() {
281
    return minLength;
1✔
282
  }
283

284
  public void setMinLength(Integer minLength) {
285
    this.minLength = minLength;
1✔
286
  }
1✔
287

288
  public void setMinLength(int minLength) {
289
    this.minLength = minLength;
1✔
290
  }
1✔
291

292
  public Rule withMinLength(int minLength) {
293
    setMinLength(minLength);
1✔
294
    return this;
1✔
295
  }
296

297
  public Integer getMaxLength() {
298
    return maxLength;
1✔
299
  }
300

301
  public void setMaxLength(Integer maxLength) {
302
    this.maxLength = maxLength;
1✔
303
  }
1✔
304

305
  public void setMaxLength(int maxLength) {
306
    this.maxLength = maxLength;
1✔
307
  }
1✔
308

309
  public Rule withMaxLength(int maxLength) {
310
    setMaxLength(maxLength);
1✔
311
    return this;
1✔
312
  }
313

314
  public String getLessThan() {
315
    return lessThan;
1✔
316
  }
317

318
  public void setLessThan(String lessThan) {
319
    this.lessThan = lessThan;
1✔
320
  }
1✔
321

322
  public Rule withLessThan(String lessThan) {
323
    setLessThan(lessThan);
1✔
324
    return this;
1✔
325
  }
326

327
  public String getLessThanOrEquals() {
328
    return lessThanOrEquals;
1✔
329
  }
330

331
  public void setLessThanOrEquals(String lessThanOrEquals) {
332
    this.lessThanOrEquals = lessThanOrEquals;
1✔
333
  }
1✔
334

335
  public Rule withLessThanOrEquals(String lessThanOrEquals) {
336
    setLessThanOrEquals(lessThanOrEquals);
1✔
337
    return this;
1✔
338
  }
339

340
  public String getHasValue() {
341
    return hasValue;
1✔
342
  }
343

344
  public void setHasValue(String hasValue) {
345
    this.hasValue = hasValue;
1✔
346
  }
1✔
347

348
  public Rule withHasValue(String hasValue) {
349
    setHasValue(hasValue);
1✔
350
    return this;
1✔
351
  }
352

353
  public List<String> getHasChildren() {
354
    return hasChildren;
1✔
355
  }
356

357
  public void setHasChildren(List<String> hasChildren) {
358
    this.hasChildren = hasChildren;
1✔
359
  }
1✔
360

361
  public Rule withHasChildren(List<String> hasChildren) {
362
    setHasChildren(hasChildren);
×
363
    return this;
×
364
  }
365

366
  public Integer getFailureScore() {
367
    return failureScore;
1✔
368
  }
369

370
  public void setFailureScore(Integer failureScore) {
371
    this.failureScore = failureScore;
1✔
372
  }
1✔
373

374
  public Rule withFailureScore(Integer failureScore) {
375
    setFailureScore(failureScore);
1✔
376
    return this;
1✔
377
  }
378

379
  public Integer getSuccessScore() {
380
    return successScore;
1✔
381
  }
382

383
  public void setSuccessScore(Integer successScore) {
384
    this.successScore = successScore;
1✔
385
  }
1✔
386

387
  public Rule withSuccessScore(Integer successScore) {
388
    setSuccessScore(successScore);
1✔
389
    return this;
1✔
390
  }
391

392
  public Integer getNaScore() {
393
    return naScore;
1✔
394
  }
395

396
  public void setNaScore(Integer naScore) {
397
    this.naScore = naScore;
1✔
398
  }
1✔
399

400
  public Rule withNaScore(Integer naScore) {
401
    setNaScore(naScore);
1✔
402
    return this;
1✔
403
  }
404

405
  public Boolean getUnique() {
406
    return unique;
1✔
407
  }
408

409
  public void setUnique(Boolean unique) {
410
    this.unique = unique;
1✔
411
  }
1✔
412

413
  public Rule withUnique(Boolean unique) {
414
    setUnique(unique);
1✔
415
    return this;
1✔
416
  }
417

418
  public List<String> getContentType() {
419
    return contentType;
1✔
420
  }
421

422
  public void setContentType(List<String> contentType) {
423
    this.contentType = contentType;
1✔
424
  }
1✔
425

426
  public Rule withContentType(List<String> contentType) {
427
    this.contentType = contentType;
×
428
    return this;
×
429
  }
430

431
  public Integer getMaxWords() {
432
    return maxWords;
1✔
433
  }
434

435
  public void setMaxWords(Integer maxWords) {
436
    this.maxWords = maxWords;
×
437
  }
×
438

439
  public void setMaxWords(int maxWords) {
440
    this.maxWords = maxWords;
×
441
  }
×
442

443
  public Rule withMaxWords(int maxWords) {
444
    setMaxWords(maxWords);
×
445
    return this;
×
446
  }
447

448
  public Integer getMinWords() {
449
    return minWords;
1✔
450
  }
451

452
  public void setMinWords(Integer minWords) {
453
    this.minWords = minWords;
×
454
  }
×
455

456
  public void setMinWords(int minWords) {
457
    this.minWords = minWords;
×
458
  }
×
459

460
  public Rule withMinWords(int minWords) {
461
    setMaxWords(minWords);
×
462
    return this;
×
463
  }
464

465
  public Dimension getDimension() {
466
    return dimension;
1✔
467
  }
468

469
  public void setDimension(Dimension dimension) {
470
    this.dimension = dimension;
1✔
471
  }
1✔
472

473
  public Rule withDimension(Dimension dimension) {
474
    this.dimension = dimension;
×
475
    return this;
×
476
  }
477

478
  public Boolean getHidden() {
479
    return hidden;
1✔
480
  }
481

482
  public void setHidden(Boolean hidden) {
483
    this.hidden = hidden;
1✔
484
  }
1✔
485

486
  public Rule withHidden(Boolean hidden) {
487
    this.hidden = hidden;
×
488
    return this;
×
489
  }
490

491
  public List<String> getDependencies() {
492
    return dependencies;
1✔
493
  }
494

495
  public void setDependencies(List<String> dependencies) {
496
    this.dependencies = dependencies;
1✔
497
  }
1✔
498

499
  public Rule withDependencies(List<String> dependencies) {
500
    this.dependencies = dependencies;
1✔
501
    return this;
1✔
502
  }
503

504
  public Rule withRulesAlreadyPassed(List<String> dependencies) {
505
    this.dependencies = dependencies;
×
506
    return this;
×
507
  }
508

509
  public Boolean getSkip() {
510
    return skip;
1✔
511
  }
512

513
  public void setSkip(Boolean skip) {
514
    this.skip = skip;
×
515
  }
×
516

517
  public Rule withSkip(Boolean skip) {
518
    this.skip = skip;
×
519
    return this;
×
520
  }
521

522
  public Boolean getDebug() {
523
    return debug;
1✔
524
  }
525

526
  public void setDebug(Boolean debug) {
527
    this.debug = debug;
1✔
528
  }
1✔
529

530
  public Rule withDebug(Boolean debug) {
531
    this.debug = debug;
×
532
    return this;
×
533
  }
534

535
  public Boolean getAllowEmptyInstances() {
536
    return allowEmptyInstances;
1✔
537
  }
538

539
  public void setAllowEmptyInstances(Boolean allowEmptyInstances) {
540
    this.allowEmptyInstances = allowEmptyInstances;
×
541
  }
×
542

543
  public Rule withAllowEmptyInstances(Boolean allowEmptyInstances) {
544
    this.allowEmptyInstances = allowEmptyInstances;
×
545
    return this;
×
546
  }
547

548
  public Boolean getMultilingual() {
549
    return multilingual;
1✔
550
  }
551

552
  public void setIsMultilingual(Boolean multilingual) {
553
    this.multilingual = multilingual;
1✔
554
  }
1✔
555

556
  public Rule withMultilingual(Boolean multilingual) {
557
    this.multilingual = multilingual;
×
558
    return this;
×
559
  }
560

561
  public ApplicationScope getHasLanguageTag() {
562
    return hasLanguageTag;
1✔
563
  }
564

565
  public void setHasLanguageTag(ApplicationScope hasLanguageTag) {
566
    this.hasLanguageTag = hasLanguageTag;
1✔
567
  }
1✔
568

569
  public Rule withHasLanguageTag(ApplicationScope hasLanguageTag) {
570
    this.hasLanguageTag = hasLanguageTag;
×
571
    return this;
×
572
  }
573

574
  public MQAFPattern getMqafPattern() {
575
    return mqafPattern;
1✔
576
  }
577

578
  public void setMqafPattern(MQAFPattern mqafPattern) {
NEW
579
    this.mqafPattern = mqafPattern;
×
NEW
580
  }
×
581

582
  public Rule withMqafPattern(MQAFPattern mqafPattern) {
NEW
583
    this.mqafPattern = mqafPattern;
×
NEW
584
    return this;
×
585
  }
586

587
  @JsonIgnore
588
  public List<String> getRulenames() {
589
    List<String> excludeFromComparision = List.of("serialVersionUID", "id", "description",
1✔
590
      "failureScore", "successScore", "naScore", "hidden", "dependencies", "skip", "debug", "allowEmptyInstances");
591

592
    List<String> existingRules = new ArrayList<>();
1✔
593
    for (Field field : getClass().getDeclaredFields()) {
1✔
594
      if (!excludeFromComparision.contains(field.getName())) {
1✔
595
        field.setAccessible(true);
1✔
596
        try {
597
          Object value = field.get(this);
1✔
598
          if (value != null)
1✔
599
            existingRules.add(field.getName());
1✔
600
        } catch (IllegalAccessException e) {
×
601
          throw new RuntimeException(e);
×
602
        }
1✔
603
      }
604
    }
605
    return existingRules;
1✔
606
  }
607

608
  public Object get(String key) {
609
    for (Field field : getClass().getDeclaredFields()) {
1✔
610
      if (field.getName().equals(key)) {
1✔
611
        try {
612
          return field.get(this);
1✔
613
        } catch (IllegalAccessException e) {
×
614
          throw new RuntimeException(e);
×
615
        }
616
      }
617
    }
618
    return null;
×
619
  }
620

621
  public void set(String key, Object value) {
622
    for (Field field : getClass().getDeclaredFields()) {
1✔
623
      if (field.getName().equals(key)) {
1✔
624
        try {
625
          field.set(this, value);
1✔
626
        } catch (IllegalAccessException e) {
×
627
          throw new RuntimeException(e);
×
628
        }
1✔
629
      }
630
    }
631
  }
1✔
632
}
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