use of org.mycore.mets.model.simple.MCRMetsAltoLink in project mycore by MyCoRe-Org.
the class MCRJSONSimpleModelConverter method processSections.
private static void processSections(MCRMetsSection current, Hashtable<String, MCRMetsSection> idSectionTable, Map<String, MCRMetsFile> idFileMap) {
idSectionTable.put(current.getId(), current);
final List<MCRMetsAltoLink> altoLinks = current.getAltoLinks().stream().map(altoLink -> {
if (altoLink instanceof MCRAltoLinkTypeAdapter.MCRAltoLinkPlaceHolder) {
MCRAltoLinkTypeAdapter.MCRAltoLinkPlaceHolder ph = (MCRAltoLinkTypeAdapter.MCRAltoLinkPlaceHolder) altoLink;
if (!idFileMap.containsKey(ph.getFileID())) {
throw new MCRException("Could not parse link from section to alto! (FileID of alto not found in file list)");
}
return new MCRMetsAltoLink(idFileMap.get(ph.getFileID()), ph.getBegin(), ph.getEnd());
}
return altoLink;
}).collect(toList());
current.setAltoLinks(altoLinks);
current.getMetsSectionList().forEach((child) -> {
child.setParent(current);
processSections(child, idSectionTable, idFileMap);
});
}
use of org.mycore.mets.model.simple.MCRMetsAltoLink in project mycore by MyCoRe-Org.
the class MCRXMLSimpleModelConverter method buildSection.
private static MCRMetsSection buildSection(LogicalDiv current, Map<String, MCRMetsSection> idSectionMap, MCRMetsSection parent, Map<String, MCRMetsFile> idFileMap) {
MCRMetsSection metsSection = new MCRMetsSection();
metsSection.setId(current.getId());
metsSection.setLabel(current.getLabel());
metsSection.setType(current.getType());
metsSection.setParent(parent);
current.getFptrList().forEach(fptr -> fptr.getSeqList().forEach(seq -> {
seq.getAreaList().forEach(area -> {
String fileId = area.getFileId();
String begin = area.getBegin();
String end = area.getEnd();
if (!idFileMap.containsKey(fileId)) {
throw new MCRException("No file with id " + fileId + " found!");
}
MCRMetsFile file = idFileMap.get(fileId);
MCRMetsAltoLink e = new MCRMetsAltoLink(file, begin, end);
metsSection.addAltoLink(e);
});
}));
if (idSectionMap != null) {
idSectionMap.put(current.getId(), metsSection);
}
List<MCRMetsSection> childSectionList = metsSection.getMetsSectionList();
current.getChildren().stream().map(section -> MCRXMLSimpleModelConverter.buildSection(section, idSectionMap, metsSection, idFileMap)).forEachOrdered(metsSection::addSection);
return metsSection;
}
Aggregations