use of org.mycore.mets.model.simple.MCRMetsSection 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