protected Response updateMetadataLabel(final String label, final String property, final String value) {
StreamingOutput stream = new StreamingOutput()
{
@Override
public void write( OutputStream os ) throws IOException, WebApplicationException
{
try ( Transaction tx = database.beginTx() ) {
JsonGenerator jg = objectMapper.getFactory().createGenerator(os, JsonEncoding.UTF8);
IndexManager index = database.index();
Index<Node> metadata = index.forNodes("Metadatum");
for ( Node metadatum : metadata.query( "label:"+label ) ) {
if (property.equals("explorable") || property.equals("searchable"))
metadatum.setProperty(property, Boolean.valueOf(value));
else
metadatum.setProperty(property, value);
}
jg.writeString("Updated "+label);
jg.flush();
tx.success();
}
}
};
return Response.ok().entity( stream ).type( MediaType.APPLICATION_JSON ).build();
}
MetadatumSearcher.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:WhiteLab2.0-Neo4J-Plugin
作者:
评论列表
文章目录