Search in sources :

Example 11 with Fptr

use of org.mycore.mets.model.struct.Fptr in project mycore by MyCoRe-Org.

the class MCRSimpleModelXMLConverter method buildLogicalSubDiv.

private static void buildLogicalSubDiv(MCRMetsSection metsSection, LogicalDiv parent, Map<MCRMetsSection, String> sectionIdMap, Map<String, String> idToNewIDMap) {
    String id = metsSection.getId();
    LogicalDiv logicalSubDiv = new LogicalDiv(id, metsSection.getType(), metsSection.getLabel());
    if (metsSection.getAltoLinks().size() > 0) {
        Fptr fptr = new Fptr();
        List<Seq> seqList = fptr.getSeqList();
        Seq seq = new Seq();
        seqList.add(seq);
        metsSection.getAltoLinks().forEach(al -> {
            Area area = new Area();
            seq.getAreaList().add(area);
            area.setBetype("IDREF");
            area.setBegin(al.getBegin());
            area.setEnd(al.getEnd());
            String oldID = al.getFile().getId();
            if (!idToNewIDMap.containsKey(oldID)) {
                throw new MCRException("Could not get new id for: " + oldID);
            }
            area.setFileId(idToNewIDMap.get(oldID));
        });
        logicalSubDiv.getFptrList().add(fptr);
    }
    sectionIdMap.put(metsSection, id);
    parent.add(logicalSubDiv);
    int count = 1;
    for (MCRMetsSection section : metsSection.getMetsSectionList()) {
        buildLogicalSubDiv(section, logicalSubDiv, sectionIdMap, idToNewIDMap);
    }
}
Also used : LogicalDiv(org.mycore.mets.model.struct.LogicalDiv) Area(org.mycore.mets.model.struct.Area) MCRException(org.mycore.common.MCRException) Fptr(org.mycore.mets.model.struct.Fptr) Seq(org.mycore.mets.model.struct.Seq) MCRMetsSection(org.mycore.mets.model.simple.MCRMetsSection)

Aggregations

Fptr (org.mycore.mets.model.struct.Fptr)11 PhysicalSubDiv (org.mycore.mets.model.struct.PhysicalSubDiv)8 File (org.mycore.mets.model.files.File)7 PhysicalDiv (org.mycore.mets.model.struct.PhysicalDiv)7 PhysicalStructMap (org.mycore.mets.model.struct.PhysicalStructMap)7 FileGrp (org.mycore.mets.model.files.FileGrp)6 FLocat (org.mycore.mets.model.files.FLocat)5 LogicalDiv (org.mycore.mets.model.struct.LogicalDiv)5 IOException (java.io.IOException)4 URISyntaxException (java.net.URISyntaxException)4 ArrayList (java.util.ArrayList)4 MCRMetsFileUse (org.mycore.mets.model.simple.MCRMetsFileUse)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Objects (java.util.Objects)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3