use of org.ambraproject.rhino.model.ArticleItem in project rhino by PLOS.
the class SolrIndexServiceImpl method appendStrikingImage.
/**
* Append an additional XML node to an article document specifying the striking image.
*
* @param doc article XML
* @param ingestion
* @return doc
*/
private Document appendStrikingImage(Document doc, ArticleIngestion ingestion) {
ArticleItem strikingImage = ingestion.getStrikingImage();
String strikingImageDoi = (strikingImage == null) ? null : Doi.create(strikingImage.getDoi()).asUri(Doi.UriStyle.INFO_DOI).toString();
NodeList metaNodeLst = doc.getElementsByTagName("article-meta");
Node metaNode = metaNodeLst.item(0);
Element strkImgElem = doc.createElement("article-strkImg");
strkImgElem.setTextContent(Strings.nullToEmpty(strikingImageDoi));
metaNode.appendChild(strkImgElem.cloneNode(true));
return doc;
}
Aggregations