Search in sources :

Example 11 with ArticleItem

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;
}
Also used : ArticleItem(org.ambraproject.rhino.model.ArticleItem) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element)

Aggregations

ArticleItem (org.ambraproject.rhino.model.ArticleItem)11 ArticleFile (org.ambraproject.rhino.model.ArticleFile)5 ArticleIngestion (org.ambraproject.rhino.model.ArticleIngestion)5 Article (org.ambraproject.rhino.model.Article)4 Query (org.hibernate.Query)4 Collection (java.util.Collection)3 List (java.util.List)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 ArticleRevision (org.ambraproject.rhino.model.ArticleRevision)3 RestClientException (org.ambraproject.rhino.rest.RestClientException)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 JsonObject (com.google.gson.JsonObject)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Doi (org.ambraproject.rhino.identity.Doi)2 Journal (org.ambraproject.rhino.model.Journal)2 ArticleItemInput (org.ambraproject.rhino.model.ingest.ArticleItemInput)2 ArticleCrudService (org.ambraproject.rhino.service.ArticleCrudService)2