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;
}
Aggregations