use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project pratilipi by Pratilipi.
the class LogAndSecurityFilter method doFilter.
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
String uri = ((HttpServletRequest) request).getRequestURI().toString();
if (!uri.equals("/poc1")) {
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
Page page = dataAccessor.getPage(uri);
if (page != null) {
if (page.getType() == PageType.BLOG_POST) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("pageId", page.getId());
jsonObject.addProperty("accessToken", AccessTokenFilter.getAccessToken().getId());
logger.log(Level.INFO, "DataFlow#PAGE_HIT::" + jsonObject.toString());
}
}
}
chain.doFilter(request, response);
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project rhino by PLOS.
the class JsonWrapper method serialize.
@Override
public JsonElement serialize(JsonSerializationContext context) {
JsonObject serialized = new JsonObject();
for (String property : propertiesToInclude) {
String value;
try {
value = (String) PropertyUtils.getSimpleProperty(target, property);
} catch (IllegalAccessException iae) {
throw new RuntimeException(iae);
} catch (InvocationTargetException ite) {
throw new RuntimeException(ite);
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
serialized.addProperty(property, value);
}
return serialized;
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project rhino by PLOS.
the class ArticleIngestionView method serialize.
@Override
public JsonElement serialize(JsonSerializationContext context) {
JsonObject serialized = new JsonObject();
serialized.addProperty("doi", ingestion.getArticle().getDoi());
serialized.addProperty("ingestionNumber", ingestion.getIngestionNumber());
serialized.add("journal", context.serialize(journal));
serialized.addProperty("bucketName", bucketName);
ArticleItem strikingImage = ingestion.getStrikingImage();
if (strikingImage != null) {
serialized.add("strikingImage", context.serialize(ItemSetView.getItemView(strikingImage)));
}
JsonAdapterUtil.copyWithoutOverwriting(context.serialize(metadata).getAsJsonObject(), serialized);
JsonAdapterUtil.copyWithoutOverwriting(context.serialize(customMetadata).getAsJsonObject(), serialized);
serialized.remove("assets");
List<AssetMetadataView> assetViews = metadata.getAssets().stream().map(AssetMetadataView::new).collect(Collectors.toList());
serialized.add("assetsLinkedFromManuscript", context.serialize(assetViews));
return serialized;
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject in project rhino by PLOS.
the class ArticleRevisionView method serialize.
@Override
public JsonElement serialize(JsonSerializationContext context) {
JsonObject serialized = new JsonObject();
serialized.addProperty("doi", article.getDoi());
this.revision.ifPresent((ArticleRevision revision) -> {
serialized.addProperty("revisionNumber", revision.getRevisionNumber());
serialized.add("ingestion", serializeIngestion(context, revision.getIngestion()));
});
return serialized;
}
use of org.apache.beam.vendor.grpc.v1p43p2.com.google.gson.JsonObject 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;
}
Aggregations