use of org.marc4j.marc.DataField in project RecordManager2 by moravianlibrary.
the class MarcDSL method getAuthor2Display.
public List<String> getAuthor2Display() {
List<String> result = new ArrayList<String>();
for (DataField df : record.getDataFields("700")) {
result.add(getNameForDisplay(df));
}
result.addAll(getFields("110ab:111ab:710ab:711ab"));
return result;
}
use of org.marc4j.marc.DataField in project RecordManager2 by moravianlibrary.
the class MarcDSL method getPublisherStrMv.
public List<String> getPublisherStrMv() throws IOException {
Set<String> publishers = new HashSet<String>();
for (DataField dataField : record.getDataFields("264")) {
if (dataField.getIndicator2() == '1') {
dataField.getSubfields('b').stream().forEach(sf -> publishers.add(editPublisherName(sf.getData())));
}
}
for (DataField dataField : record.getDataFields("928")) {
if (dataField.getIndicator1() == '9') {
dataField.getSubfields('a').stream().forEach(sf -> publishers.add(editPublisherName(sf.getData())));
}
}
getFields("260b:978ab").stream().forEach(str -> publishers.add(editPublisherName(str)));
Set<String> result = new HashSet<String>();
for (String publisher : publishers) {
List<String> newPublisher = translate("publisher.map", publisher, null);
if (newPublisher == null)
result.add(publisher);
else
result.addAll(newPublisher);
}
return new ArrayList<String>(result);
}
use of org.marc4j.marc.DataField in project RecordManager2 by moravianlibrary.
the class MarcDSL method getPublisher.
public List<String> getPublisher() {
List<String> publishers = new ArrayList<String>();
for (DataField dataField : record.getDataFields("264")) {
if (dataField.getIndicator2() == '1') {
publishers.addAll(getFieldsTrim("264b"));
}
}
publishers.addAll(getFieldsTrim("260b"));
return publishers;
}
use of org.marc4j.marc.DataField in project RecordManager2 by moravianlibrary.
the class MarcDSL method getHoldings996.
public List<String> getHoldings996() {
List<String> result = new ArrayList<>();
Map<String, List<DataField>> allFields = record.getAllFields();
List<DataField> list996 = allFields.get("996");
if (list996 == null) {
return result;
}
for (DataField dataField : list996) {
StringBuilder currentSb = new StringBuilder();
// 996 with '0' in subfield 'q'
if (dataField.getSubfield('q') != null && dataField.getSubfield('q').getData().equals("0")) {
continue;
}
for (Subfield subfield : dataField.getSubfields()) {
currentSb.append('$');
currentSb.append(subfield.getCode());
currentSb.append(subfield.getData());
}
result.add(currentSb.toString());
}
return result;
}
use of org.marc4j.marc.DataField in project RecordManager2 by moravianlibrary.
the class MarcDSL method getTitleDisplay.
public String getTitleDisplay() {
DataField df = getFirstDataField("245");
if (df == null)
return null;
final char[] titleSubfields = new char[] { 'a', 'b', 'n', 'p' };
final char[] sfhPunctuation = new char[] { '.', ',', ':' };
char endCharH = ' ';
StringBuilder sb = new StringBuilder();
for (Subfield sf : df.getSubfields()) {
// get last punctuation from 'h'
if (sf.getCode() == 'h') {
String data = sf.getData().trim();
if (data.length() > 0) {
if (Chars.contains(sfhPunctuation, data.charAt(data.length() - 1))) {
endCharH = data.charAt(data.length() - 1);
}
}
} else if (Chars.contains(titleSubfields, sf.getCode())) {
// print punctuation from h
if (endCharH != ' ') {
sb.append(endCharH);
sb.append(" ");
endCharH = ' ';
}
sb.append(sf.getData());
sb.append(" ");
} else
endCharH = ' ';
}
return removeEndPunctuation(sb.toString());
}
Aggregations