Search in sources :

Example 1 with JournalOutputView

use of org.ambraproject.rhino.view.journal.JournalOutputView in project rhino by PLOS.

the class ArticleRevisionView method serializeIngestion.

// Could be extracted for more public use, in case we ever need this shallow ArticleIngestion view elsewhere.
private JsonObject serializeIngestion(JsonSerializationContext context, ArticleIngestion ingestion) {
    JsonObject serialized = new JsonObject();
    JournalOutputView journalOutputView = JournalOutputView.getView(ingestion.getJournal());
    serialized.add("journal", context.serialize(journalOutputView));
    serialized.addProperty("ingestionNumber", ingestion.getIngestionNumber());
    serialized.addProperty("title", ingestion.getTitle());
    serialized.addProperty("publicationDate", ingestion.getPublicationDate().toLocalDate().toString());
    if (ingestion.getRevisionDate() != null) {
        serialized.addProperty("revisionDate", ingestion.getRevisionDate().toLocalDate().toString());
    }
    serialized.addProperty("publicationStage", ingestion.getPublicationStage());
    serialized.addProperty("articleType", ingestion.getArticleType());
    return serialized;
}
Also used : JsonObject(com.google.gson.JsonObject) JournalOutputView(org.ambraproject.rhino.view.journal.JournalOutputView)

Aggregations

JsonObject (com.google.gson.JsonObject)1 JournalOutputView (org.ambraproject.rhino.view.journal.JournalOutputView)1