use of org.mycore.mets.model.simple.MCRMetsSimpleModel in project mycore by MyCoRe-Org.
the class MCRMetsTestUtil method buildMetsSimpleModel.
public static MCRMetsSimpleModel buildMetsSimpleModel() {
MCRMetsSimpleModel metsSimpleModel = new MCRMetsSimpleModel();
builSimpleModelSections(metsSimpleModel);
buildSimpleModelPages(metsSimpleModel);
buildSimpleModelLinkList(metsSimpleModel);
return metsSimpleModel;
}
use of org.mycore.mets.model.simple.MCRMetsSimpleModel in project mycore by MyCoRe-Org.
the class MCRSimpleModelXMLConverter method toXML.
/**
* Converts MetsSimpleModel to XML
* @param msm the MetsSimpleModel which should be converted
* @return xml
*/
public static Document toXML(MCRMetsSimpleModel msm) {
Mets mets = new Mets();
Hashtable<MCRMetsPage, String> pageIdMap = new Hashtable<>();
Map<String, String> idToNewIDMap = new Hashtable<>();
buildPhysicalPages(msm, mets, pageIdMap, idToNewIDMap);
Hashtable<MCRMetsSection, String> sectionIdMap = new Hashtable<>();
buildLogicalPages(msm, mets, sectionIdMap, idToNewIDMap);
StructLink structLink = mets.getStructLink();
msm.getSectionPageLinkList().stream().map((metsLink) -> {
MCRMetsSection section = metsLink.getFrom();
MCRMetsPage page = metsLink.getTo();
String fromId = sectionIdMap.get(section);
String toId = pageIdMap.get(page);
return new SmLink(fromId, toId);
}).forEach(structLink::addSmLink);
return mets.asDocument();
}
Aggregations