use of org.mycore.mets.model.struct.LogicalDiv in project mycore by MyCoRe-Org.
the class MCRSimpleModelXMLConverter method buildLogicalPages.
private static void buildLogicalPages(MCRMetsSimpleModel msm, Mets mets, Map<MCRMetsSection, String> sectionIdMap, Map<String, String> idToNewIDMap) {
LogicalStructMap logicalStructMap = (LogicalStructMap) mets.getStructMap(LogicalStructMap.TYPE);
MCRMetsSection rootSection = msm.getRootSection();
String type = rootSection.getType();
String label = rootSection.getLabel();
String id = rootSection.getId();
LogicalDiv logicalDiv = new LogicalDiv(id, type, label);
sectionIdMap.put(rootSection, id);
for (MCRMetsSection metsSection : rootSection.getMetsSectionList()) {
buildLogicalSubDiv(metsSection, logicalDiv, sectionIdMap, idToNewIDMap);
}
logicalStructMap.setDivContainer(logicalDiv);
}
use of org.mycore.mets.model.struct.LogicalDiv in project mycore by MyCoRe-Org.
the class MCRMetsMods2IIIFConverter method processDivContainer.
protected void processDivContainer(List<MCRIIIFRange> complete, LogicalDiv divContainer) {
MCRIIIFRange range = new MCRIIIFRange(divContainer.getId());
if (divContainer.getParent() == null) {
range.setViewingHint(MCRIIIFViewingHint.top);
}
complete.add(range);
range.setLabel(divContainer.getLabel());
this.logicalIdIdentifiersMap.get(divContainer.getId()).stream().map(refId -> refId).forEach(canvasRef -> range.canvases.add(canvasRef));
divContainer.getChildren().stream().forEach(div -> {
processDivContainer(complete, div);
range.ranges.add(div.getId());
});
range.metadata = extractMedataFromLogicalDiv(mets, divContainer);
}
use of org.mycore.mets.model.struct.LogicalDiv in project mycore by MyCoRe-Org.
the class MCRMETSDefaultGenerator method createMets.
private Mets createMets() throws IOException {
Mets mets = new Mets();
String owner = getOwner();
// add dmdsec
DmdSec dmdSec = new DmdSec("dmd_" + owner);
// add amdsec
AmdSec amdSec = new AmdSec("amd_" + owner);
// file sec
FileSec fileSec = new FileSec();
for (MCRMetsFileUse fileUse : MCRMetsFileUse.values()) {
FileGrp fileGrp = new FileGrp(fileUse.toString());
fileSec.addFileGrp(fileGrp);
}
// physical structure
PhysicalStructMap physicalStructMap = new PhysicalStructMap();
PhysicalDiv physicalDiv = new PhysicalDiv("phys_" + owner, "physSequence");
physicalStructMap.setDivContainer(physicalDiv);
// logical structure
MCRILogicalStructMapTypeProvider typeProvider = getTypeProvider();
LogicalStructMap logicalStructMap = new LogicalStructMap();
LogicalDiv logicalDiv = new LogicalDiv("log_" + owner, typeProvider.getType(MCRObjectID.getInstance(owner)), owner, amdSec.getId(), dmdSec.getId());
logicalDiv.setDmdId(dmdSec.getId());
logicalStructMap.setDivContainer(logicalDiv);
// struct Link
StructLink structLink = new StructLink();
// create internal structure
structureMets(getDerivatePath(), getIgnorePaths(), fileSec, physicalDiv, logicalDiv, structLink, 0);
hrefIdMap.clear();
// add to mets
mets.addDmdSec(dmdSec);
mets.addAmdSec(amdSec);
mets.setFileSec(fileSec);
mets.addStructMap(physicalStructMap);
mets.addStructMap(logicalStructMap);
mets.setStructLink(structLink);
return mets;
}
use of org.mycore.mets.model.struct.LogicalDiv in project mycore by MyCoRe-Org.
the class MCRMETSDefaultGenerator method structureMets.
private void structureMets(MCRPath dir, Set<MCRPath> ignoreNodes, FileSec fileSec, PhysicalDiv physicalDiv, LogicalDiv logicalDiv, StructLink structLink, int logOrder) throws IOException {
SortedMap<MCRPath, BasicFileAttributes> files = new TreeMap<>(), directories = new TreeMap<>();
fillFileMap(ignoreNodes, files, directories, dir);
for (Map.Entry<MCRPath, BasicFileAttributes> file : files.entrySet()) {
createStructure(dir, fileSec, physicalDiv, logicalDiv, structLink, file);
}
for (Map.Entry<MCRPath, BasicFileAttributes> directory : directories.entrySet()) {
String dirName = directory.getKey().getFileName().toString();
if (isInExcludedRootFolder(directory.getKey())) {
structureMets(directory.getKey(), ignoreNodes, fileSec, physicalDiv, logicalDiv, structLink, logOrder);
} else {
LogicalDiv section = new LogicalDiv("log_" + Integer.toString(++logOrder), "section", dirName);
logicalDiv.add(section);
structureMets(directory.getKey(), ignoreNodes, fileSec, physicalDiv, section, structLink, logOrder);
}
}
}
use of org.mycore.mets.model.struct.LogicalDiv in project mycore by MyCoRe-Org.
the class MCRMETSHierarchyGenerator method newLogicalStructMap.
/**
* Creates the logical structure recursive.
*
* @param parentObject mycore object
* @param parentLogicalDiv parent div
*/
protected void newLogicalStructMap(MCRObject parentObject, LogicalDiv parentLogicalDiv) {
// run through all children
List<MCRObject> children = getChildren(parentObject);
children.forEach(childObject -> {
// create new logical sub div
String id = childObject.getId().toString();
LogicalDiv logicalChildDiv = new LogicalDiv(id, getType(childObject), getLabel(childObject));
// add to parent
parentLogicalDiv.add(logicalChildDiv);
// check if a derivate link exists and get the linked file
updateStructLinkMapUsingDerivateLinks(logicalChildDiv, childObject);
// do recursive call for children
newLogicalStructMap(childObject, logicalChildDiv);
});
}
Aggregations