Search in sources :

Example 11 with MCRMetsSection

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;
}
Also used : MCRMetsPage(org.mycore.mets.model.simple.MCRMetsPage) Mets(org.mycore.mets.model.Mets) MCRException(org.mycore.common.MCRException) IStructMap(org.mycore.mets.model.struct.IStructMap) LogicalDiv(org.mycore.mets.model.struct.LogicalDiv) PhysicalSubDiv(org.mycore.mets.model.struct.PhysicalSubDiv) ArrayList(java.util.ArrayList) Document(org.jdom2.Document) MCRMetsFile(org.mycore.mets.model.simple.MCRMetsFile) AbstractMap(java.util.AbstractMap) List(java.util.List) FileGrp(org.mycore.mets.model.files.FileGrp) LogicalStructMap(org.mycore.mets.model.struct.LogicalStructMap) Map(java.util.Map) MCRMetsAltoLink(org.mycore.mets.model.simple.MCRMetsAltoLink) MCRMetsFileUse(org.mycore.mets.model.simple.MCRMetsFileUse) MCRMetsSection(org.mycore.mets.model.simple.MCRMetsSection) MCRMetsSimpleModel(org.mycore.mets.model.simple.MCRMetsSimpleModel) Hashtable(java.util.Hashtable) MCRMetsLink(org.mycore.mets.model.simple.MCRMetsLink) PhysicalStructMap(org.mycore.mets.model.struct.PhysicalStructMap) MCRException(org.mycore.common.MCRException) MCRMetsAltoLink(org.mycore.mets.model.simple.MCRMetsAltoLink) MCRMetsFile(org.mycore.mets.model.simple.MCRMetsFile) MCRMetsSection(org.mycore.mets.model.simple.MCRMetsSection)

Aggregations

MCRMetsSection (org.mycore.mets.model.simple.MCRMetsSection)11 MCRMetsPage (org.mycore.mets.model.simple.MCRMetsPage)6 MCRMetsSimpleModel (org.mycore.mets.model.simple.MCRMetsSimpleModel)6 Hashtable (java.util.Hashtable)5 MCRException (org.mycore.common.MCRException)5 MCRMetsLink (org.mycore.mets.model.simple.MCRMetsLink)5 List (java.util.List)4 Map (java.util.Map)4 MCRMetsFile (org.mycore.mets.model.simple.MCRMetsFile)4 MCRMetsFileUse (org.mycore.mets.model.simple.MCRMetsFileUse)4 LogicalDiv (org.mycore.mets.model.struct.LogicalDiv)4 Mets (org.mycore.mets.model.Mets)3 MCRMetsAltoLink (org.mycore.mets.model.simple.MCRMetsAltoLink)3 LogicalStructMap (org.mycore.mets.model.struct.LogicalStructMap)3 GsonBuilder (com.google.gson.GsonBuilder)2 Collectors.toList (java.util.stream.Collectors.toList)2 Document (org.jdom2.Document)2 FileGrp (org.mycore.mets.model.files.FileGrp)2 Area (org.mycore.mets.model.struct.Area)2 Fptr (org.mycore.mets.model.struct.Fptr)2