use of org.mycore.mets.model.files.File in project mycore by MyCoRe-Org.
the class MCRSimpleModelXMLConverter method buildPhysicalPages.
private static void buildPhysicalPages(MCRMetsSimpleModel msm, Mets mets, Map<MCRMetsPage, String> pageIdMap, Map<String, String> idToNewIDMap) {
List<MCRMetsPage> pageList = msm.getMetsPageList();
PhysicalStructMap structMap = (PhysicalStructMap) mets.getStructMap(PhysicalStructMap.TYPE);
structMap.setDivContainer(new PhysicalDiv(PHYSICAL_ID_PREFIX + UUID.randomUUID(), PhysicalDiv.TYPE_PHYS_SEQ));
for (MCRMetsPage page : pageList) {
String id = page.getId();
PhysicalSubDiv physicalSubDiv = new PhysicalSubDiv(id, DEFAULT_PHYSICAL_TYPE);
String orderLabel = page.getOrderLabel();
if (orderLabel != null) {
physicalSubDiv.setOrderLabel(orderLabel);
}
String contentIds = page.getContentIds();
if (contentIds != null) {
physicalSubDiv.setContentids(contentIds);
}
structMap.getDivContainer().add(physicalSubDiv);
pageIdMap.put(page, id);
page.getFileList().forEach((simpleFile) -> {
String href = simpleFile.getHref();
String fileID = simpleFile.getId();
String mimeType = simpleFile.getMimeType();
MCRMetsFileUse use = simpleFile.getUse();
idToNewIDMap.put(simpleFile.getId(), fileID);
File file = new File(fileID, mimeType);
FLocat fLocat = new FLocat(LOCTYPE.URL, href);
file.setFLocat(fLocat);
FileGrp fileGrp = getFileGroup(mets, use);
fileGrp.addFile(file);
physicalSubDiv.add(new Fptr(fileID));
});
}
}
Aggregations