use of org.ambraproject.rhino.view.user.UserIdView in project rhino by PLOS.
the class CommentOutputView method serializeBase.
static JsonObject serializeBase(JsonSerializationContext context, Comment comment, CompetingInterestStatement competingInterestStatement) {
JsonObject serialized = context.serialize(comment).getAsJsonObject();
serialized.remove("userProfileID");
serialized.add("creator", context.serialize(new UserIdView(comment.getUserProfileID())));
serialized.remove("articleID");
normalizeField(serialized, "title");
normalizeField(serialized, "body");
normalizeField(serialized, "highlightedText");
serialized.remove("competingInterestBody");
serialized.add("competingInterestStatement", context.serialize(competingInterestStatement));
return serialized;
}
use of org.ambraproject.rhino.view.user.UserIdView in project rhino by PLOS.
the class CommentFlagOutputView method serialize.
@Override
public JsonElement serialize(JsonSerializationContext context) {
JsonObject serialized = context.serialize(flag).getAsJsonObject();
// Alias "comment" (the flag field containing the comment that the user submitted) to avoid ambiguity.
// Should match the field name used for org.ambraproject.rhino.view.comment.CommentFlagInputView.body.
serialized.add("body", serialized.remove("comment"));
serialized.remove("userProfileID");
serialized.add("creator", context.serialize(new UserIdView(flag.getUserProfileId())));
serialized.add("flaggedComment", context.serialize(flaggedComment));
return serialized;
}
Aggregations