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

pkiraly / metadata-qa-marc / #1527

22 Aug 2025 02:21PM UTC coverage: 90.345%. Remained the same
#1527

push

pkiraly
Improve timeline handling

5191 of 6416 new or added lines in 219 files covered. (80.91%)

886 existing lines in 78 files now uncovered.

36717 of 40641 relevant lines covered (90.34%)

0.9 hits per line

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

94.74
/src/main/java/de/gwdg/metadataqa/marc/cli/utils/BibSelector.java
1
package de.gwdg.metadataqa.marc.cli.utils;
2

3
import de.gwdg.metadataqa.api.model.XmlFieldInstance;
4
import de.gwdg.metadataqa.api.model.selector.Selector;
5
import de.gwdg.metadataqa.marc.dao.DataField;
6
import de.gwdg.metadataqa.marc.dao.record.BibliographicRecord;
7
import de.gwdg.metadataqa.marc.dao.record.Marc21BibliographicRecord;
8
import de.gwdg.metadataqa.marc.dao.record.PicaRecord;
9
import de.gwdg.metadataqa.marc.dao.record.UnimarcRecord;
10

11
import java.util.ArrayList;
12
import java.util.Collections;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.stream.Collectors;
16

17
public abstract class BibSelector implements Selector {
18
  protected final BibliographicRecord record;
19
  private boolean isMarc21 = false;
1✔
20
  private boolean isPica = false;
1✔
21
  private boolean isUnimarc = false;
1✔
22

23
  public BibSelector(BibliographicRecord record) {
1✔
24
    if (record != null) {
1✔
25
      this.record = record;
1✔
26
      if (record instanceof Marc21BibliographicRecord) {
1✔
27
        isMarc21 = true;
1✔
28
      } else if (record instanceof PicaRecord) {
1✔
29
        isPica = true;
1✔
30
      } else if (record instanceof UnimarcRecord) {
1✔
31
        isUnimarc = true;
1✔
32
      }
33
    } else {
UNCOV
34
      throw new IllegalArgumentException("Only BibliographicRecord object as Argument");
×
35
    }
36
  }
1✔
37

38
  protected List<XmlFieldInstance> transformTags(List<String> tags) {
39
    List<XmlFieldInstance> fieldList = new ArrayList<>();
1✔
40
    if (tags != null) {
1✔
41
      for (Object tag : tags) {
1✔
42
        if (tag instanceof String)
1✔
43
          fieldList.add(new XmlFieldInstance((String) tag));
1✔
44
        else if (tag instanceof DataField) {
1✔
45
          fieldList.add(new XmlFieldInstance(((DataField) tag)
1✔
46
            .getSubfields()
1✔
47
            .stream()
1✔
48
            .map(e -> e.getValue())
1✔
49
            .collect(Collectors.joining(", "))));
1✔
50
        }
51
      }
1✔
52
    }
53
    return fieldList;
1✔
54
  }
55

56
  @Override
57
  public Object read(String path, Object jsonFragment) {
58
    return null;
1✔
59
  }
60

61
  @Override
62
  public List get(String address, String path, Object jsonFragment) {
63
    return Collections.emptyList();
1✔
64
  }
65

66
  @Override
67
  public List get(String address, String path, Object jsonFragment, Class clazz) {
68
    return Collections.emptyList();
1✔
69
  }
70

71
  @Override
72
  public Object getFragment(String path) {
73
    return null;
1✔
74
  }
75

76
  @Override
77
  public Object getFragment(String address, String path, Object jsonFragment) {
78
    return null;
1✔
79
  }
80

81
  @Override
82
  public String getRecordId() {
83
    return record.getId();
1✔
84
  }
85

86
  @Override
87
  public void setRecordId(String recordId) {
88

89
  }
1✔
90

91
  @Override
92
  public Map<String, List> getCache() {
93
    return Collections.emptyMap();
1✔
94
  }
95

96
  @Override
97
  public Map<String, Object> getFragmentCache() {
98
    return Collections.emptyMap();
1✔
99
  }
100

101
  @Override
102
  public String getContent() {
103
    return null;
1✔
104
  }
105

106
  public BibliographicRecord getRecord() {
NEW
107
    return record;
×
108
  }
109
}
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