@Test public void testSaveMultipleTimestampedValuesInSameMutationEdge() { Vertex v1 = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY); Vertex v2 = graph.addVertex("v2", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY); String edgeId = "e1"; String propertyKey = "k1"; String propertyName = "p1"; Map<String, Long> values = ImmutableMap.of( "value1", createDate(2016, 4, 6, 9, 20, 0).getTime(), "value2", createDate(2016, 5, 6, 9, 20, 0).getTime(), "value3", createDate(2016, 6, 6, 9, 20, 0).getTime(), "value4", createDate(2016, 7, 6, 9, 20, 0).getTime(), "value5", createDate(2016, 8, 6, 9, 20, 0).getTime() ); ElementMutation<Edge> edgeMutation = graph.prepareEdge(edgeId, v1, v2, LABEL_LABEL1, VISIBILITY_EMPTY); for (Map.Entry<String, Long> entry : values.entrySet()) { edgeMutation.addPropertyValue(propertyKey, propertyName, entry.getKey(), Metadata.create(), entry.getValue(), VISIBILITY_EMPTY); } edgeMutation.save(AUTHORIZATIONS_EMPTY); graph.flush(); Edge retrievedEdge = graph.getEdge(edgeId, AUTHORIZATIONS_EMPTY); Iterable<HistoricalPropertyValue> historicalPropertyValues = retrievedEdge.getHistoricalPropertyValues(propertyKey, propertyName, VISIBILITY_EMPTY, null, null, AUTHORIZATIONS_EMPTY); compareHistoricalValues(values, historicalPropertyValues); }
@Test public void testSaveMultipleTimestampedValuesInSameMutationEdge() { Vertex v1 = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY); Vertex v2 = graph.addVertex("v2", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY); String edgeId = "e1"; String propertyKey = "k1"; String propertyName = "p1"; Map<String, Long> values = ImmutableMap.of( "value1", createDate(2016, 4, 6, 9, 20, 0).getTime(), "value2", createDate(2016, 5, 6, 9, 20, 0).getTime(), "value3", createDate(2016, 6, 6, 9, 20, 0).getTime(), "value4", createDate(2016, 7, 6, 9, 20, 0).getTime(), "value5", createDate(2016, 8, 6, 9, 20, 0).getTime() ); ElementMutation<Edge> edgeMutation = graph.prepareEdge(edgeId, v1, v2, LABEL_LABEL1, VISIBILITY_EMPTY); for (Map.Entry<String, Long> entry : values.entrySet()) { edgeMutation.addPropertyValue(propertyKey, propertyName, entry.getKey(), Metadata.create(), entry.getValue(), VISIBILITY_EMPTY); } edgeMutation.save(AUTHORIZATIONS_EMPTY); graph.flush(); Edge retrievedEdge = graph.getEdge(edgeId, AUTHORIZATIONS_EMPTY); Iterable<HistoricalPropertyValue> historicalPropertyValues = retrievedEdge.getHistoricalPropertyValues(propertyKey, propertyName, VISIBILITY_EMPTY, null, null, AUTHORIZATIONS_EMPTY); compareHistoricalValues(values, historicalPropertyValues); }
@Handle public ClientApiHistoricalPropertyResults handle( @Required(name = "graphEdgeId") String graphEdgeId, @Optional(name = "startTime") Long startTime, @Optional(name = "endTime") Long endTime, @Optional(name = "withVisibility") Boolean withVisibility, Locale locale, ResourceBundle resourceBundle, Authorizations authorizations ) throws Exception { Edge edge = graph.getEdge(graphEdgeId, authorizations); if (edge == null) { throw new VisalloResourceNotFoundException(String.format("edge %s not found", graphEdgeId)); } Iterable<HistoricalPropertyValue> historicalPropertyValues = edge.getHistoricalPropertyValues( startTime, endTime, authorizations ); return ClientApiConverter.toClientApi(historicalPropertyValues, locale, resourceBundle, withVisibility); } }
Iterable<HistoricalPropertyValue> historicalPropertyValues = edge.getHistoricalPropertyValues( property.getKey(), property.getName(),