use of org.mycore.common.content.MCRJAXBContent in project mycore by MyCoRe-Org.
the class MCRSolrInputDocumentGenerator method getSolrInputDocument.
public static List<SolrInputDocument> getSolrInputDocument(MCRContent source) throws JAXBException, IOException {
if (source instanceof MCRJAXBContent) {
@SuppressWarnings("unchecked") MCRJAXBContent<MCRSolrInputDocumentList> jaxbContent = (MCRJAXBContent<MCRSolrInputDocumentList>) source;
return getSolrInputDocuments(jaxbContent.getObject().getDoc());
}
Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
MCRSolrInputDocumentList solrDocuments = (MCRSolrInputDocumentList) unmarshaller.unmarshal(source.getSource());
return getSolrInputDocuments(solrDocuments.getDoc());
}
use of org.mycore.common.content.MCRJAXBContent in project mycore by MyCoRe-Org.
the class MCRUserTransformer method getDocument.
private static Document getDocument(MCRUser user) {
MCRJAXBContent<MCRUser> content = new MCRJAXBContent<>(JAXB_CONTEXT, user);
try {
Document userXML = content.asXML();
sortAttributes(userXML);
return userXML;
} catch (SAXParseException | JDOMException | IOException e) {
throw new MCRException("Exception while transforming MCRUser " + user.getUserID() + " to JDOM document.", e);
}
}
Aggregations