Search in sources :

Example 1 with XmlData

use of eu.transkribus.core.model.beans.mets.MdSecType.MdWrap.XmlData in project TranskribusCore by Transkribus.

the class MetsUtil method getTrpDocMd.

public static TrpDocMetadata getTrpDocMd(Mets mets) {
    TrpDocMetadata md = null;
    List<AmdSecType> secList = mets.getAmdSec();
    List<MdSecType> mdSecList = null;
    for (AmdSecType sec : secList) {
        if (sec.getID().equals(TrpMetsBuilder.SOURCE_MD_ID_CONST)) {
            mdSecList = sec.getSourceMD();
            break;
        }
    }
    if (mdSecList == null)
        logger.error("No SourceMd Section found!");
    else {
        XmlData xmlData = null;
        for (MdSecType mdSec : mdSecList) {
            if (mdSec.getID().equals(TrpMetsBuilder.SOURCE_DOC_MD_ID_CONST) && mdSec.getMdWrap().getID().equals(TrpMetsBuilder.TRP_DOC_MD_TYPE_CONST)) {
                xmlData = mdSec.getMdWrap().getXmlData();
                break;
            }
        }
        if (xmlData != null && xmlData.getAny().size() > 0) {
            Object o = xmlData.getAny().get(0);
            if (o instanceof TrpDocMetadata) {
                md = (TrpDocMetadata) o;
                logger.info("Found metadata: " + md.toString());
            } else {
                logger.error("No doc MD found! ");
            }
        }
    }
    return md;
}
Also used : MdSecType(eu.transkribus.core.model.beans.mets.MdSecType) XmlData(eu.transkribus.core.model.beans.mets.MdSecType.MdWrap.XmlData) TrpDocMetadata(eu.transkribus.core.model.beans.TrpDocMetadata) AmdSecType(eu.transkribus.core.model.beans.mets.AmdSecType)

Aggregations

TrpDocMetadata (eu.transkribus.core.model.beans.TrpDocMetadata)1 AmdSecType (eu.transkribus.core.model.beans.mets.AmdSecType)1 MdSecType (eu.transkribus.core.model.beans.mets.MdSecType)1 XmlData (eu.transkribus.core.model.beans.mets.MdSecType.MdWrap.XmlData)1