Search in sources :

Example 1 with DmdSec

use of org.mycore.mets.model.sections.DmdSec in project mycore by MyCoRe-Org.

the class MCRMetsMods2IIIFConverter method extractMedataFromLogicalDiv.

protected List<MCRIIIFMetadata> extractMedataFromLogicalDiv(Mets mets, LogicalDiv divContainer) {
    String dmdId = divContainer.getDmdId();
    if (dmdId != null && !dmdId.isEmpty()) {
        DmdSec dmdSec = mets.getDmdSecById(dmdId);
        if (dmdSec != null) {
            MdWrap mdWrap = dmdSec.getMdWrap();
            MDTYPE mdtype = mdWrap.getMdtype();
            MCRMetsIIIFModsMetadataExtractor extractor;
            switch(mdtype) {
                case MODS:
                    extractor = new MCRMetsIIIFModsMetadataExtractor();
                    break;
                default:
                    LOGGER.info("No extractor found for mdType: {}", mdtype);
                    return Collections.emptyList();
            }
            return extractor.extractModsMetadata(mdWrap.asElement().getChild("xmlData", MCRConstants.METS_NAMESPACE));
        }
    }
    return Collections.emptyList();
}
Also used : MDTYPE(org.mycore.mets.model.struct.MDTYPE) DmdSec(org.mycore.mets.model.sections.DmdSec) MdWrap(org.mycore.mets.model.struct.MdWrap)

Example 2 with DmdSec

use of org.mycore.mets.model.sections.DmdSec 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;
}
Also used : AmdSec(org.mycore.mets.model.sections.AmdSec) PhysicalStructMap(org.mycore.mets.model.struct.PhysicalStructMap) FileGrp(org.mycore.mets.model.files.FileGrp) StructLink(org.mycore.mets.model.struct.StructLink) DmdSec(org.mycore.mets.model.sections.DmdSec) MCRMetsFileUse(org.mycore.mets.model.simple.MCRMetsFileUse) PhysicalDiv(org.mycore.mets.model.struct.PhysicalDiv) LogicalStructMap(org.mycore.mets.model.struct.LogicalStructMap) LogicalDiv(org.mycore.mets.model.struct.LogicalDiv) FileSec(org.mycore.mets.model.files.FileSec)

Aggregations

DmdSec (org.mycore.mets.model.sections.DmdSec)2 FileGrp (org.mycore.mets.model.files.FileGrp)1 FileSec (org.mycore.mets.model.files.FileSec)1 AmdSec (org.mycore.mets.model.sections.AmdSec)1 MCRMetsFileUse (org.mycore.mets.model.simple.MCRMetsFileUse)1 LogicalDiv (org.mycore.mets.model.struct.LogicalDiv)1 LogicalStructMap (org.mycore.mets.model.struct.LogicalStructMap)1 MDTYPE (org.mycore.mets.model.struct.MDTYPE)1 MdWrap (org.mycore.mets.model.struct.MdWrap)1 PhysicalDiv (org.mycore.mets.model.struct.PhysicalDiv)1 PhysicalStructMap (org.mycore.mets.model.struct.PhysicalStructMap)1 StructLink (org.mycore.mets.model.struct.StructLink)1