@Override public Metadata getMetadata() { return Metadata.create(fetchHints); }
public AddPropertyMetadataMutation( long timestamp, String key, String name, Metadata metadata, Visibility visibility) { super(timestamp, key, name, visibility, visibility); this.metadata = Metadata.create(metadata); }
@Override public Metadata getMetadata() { return Metadata.create(fetchHints); }
public AddPropertyValueMutation( long timestamp, String key, String name, Object value, Metadata metadata, Visibility visibility) { super(timestamp, key, name, visibility, visibility); this.value = value; this.metadata = Metadata.create(metadata); }
public Metadata getMetadata(FetchHints fetchHints) { return Metadata.create(this.metadata, fetchHints); } }
public Metadata getMetadata(FetchHints fetchHints) { return Metadata.create(metadata, fetchHints); } }
public ElementMutation<T> setProperty(String name, Object value, Visibility visibility) { return setProperty(name, value, Metadata.create(FetchHints.ALL), visibility); }
/** * Adds or updates a property. * <p> * The added property will also be indexed in the configured search provider. The type of the value * will determine how it gets indexed. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ public ElementBuilder<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, Metadata.create(FetchHints.ALL), visibility); }
@Override public Metadata getMetadata() { return Metadata.create(getFetchHints()); }
/** * Sets or updates a property value. The property key will be set to a constant. This is a convenience method * which allows treating the multi-valued nature of properties as only containing a single value. Care must be * taken when using this method because properties are not only uniquely identified by just key and name but also * visibility so adding properties with the same name and different visibility strings is still permitted. * <p> * The added property will also be indexed in the configured search provider. The type of the value * will determine how it gets indexed. * * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ public ElementBuilder<T> setProperty(String name, Object value, Visibility visibility) { return setProperty(name, value, Metadata.create(FetchHints.ALL), visibility); }
/** * Adds or updates a property. * <p> * The added property will also be indexed in the configured search provider. The type of the value * will determine how it gets indexed. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ public ElementBuilder<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, Metadata.create(FetchHints.ALL), visibility); }
public ElementMutation<T> setProperty(String name, Object value, Visibility visibility) { return setProperty(name, value, Metadata.create(FetchHints.ALL), visibility); }
public ElementMutation<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, Metadata.create(FetchHints.ALL), visibility); }
public ElementMutation<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, Metadata.create(FetchHints.ALL), visibility); }
/** * Sets or updates a property value. The property key will be set to a constant. This is a convenience method * which allows treating the multi-valued nature of properties as only containing a single value. Care must be * taken when using this method because properties are not only uniquely identified by just key and name but also * visibility so adding properties with the same name and different visibility strings is still permitted. * <p> * The added property will also be indexed in the configured search provider. The type of the value * will determine how it gets indexed. * * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ public ElementBuilder<T> setProperty(String name, Object value, Visibility visibility) { return setProperty(name, value, Metadata.create(FetchHints.ALL), visibility); }
@Test public void testMetadataMutationsOnEdge() { Metadata metadataPropB = Metadata.create(); metadataPropB.add("meta1", "meta1", VISIBILITY_A); Edge edge = graph.prepareEdge("v1", "v2", LABEL_LABEL1, VISIBILITY_A) .setProperty("propBmeta", "propBmeta", metadataPropB, VISIBILITY_A) .save(AUTHORIZATIONS_ALL); graph.flush(); ExistingElementMutation<Edge> m = edge.prepareMutation(); m.setPropertyMetadata("propBmeta", "meta1", "meta2", VISIBILITY_A); edge = m.save(AUTHORIZATIONS_ALL); assertEquals("meta2", edge.getProperty("propBmeta").getMetadata().getEntry("meta1").getValue()); }
@Test public void testMetadataMutationsOnVertex() { Metadata metadataPropB = Metadata.create(); metadataPropB.add("meta1", "meta1", VISIBILITY_A); Vertex vertex = graph.prepareVertex("v1", VISIBILITY_A) .setProperty("propBmeta", "propBmeta", metadataPropB, VISIBILITY_A) .save(AUTHORIZATIONS_ALL); graph.flush(); ExistingElementMutation<Vertex> m = vertex.prepareMutation(); m.setPropertyMetadata("propBmeta", "meta1", "meta2", VISIBILITY_A); vertex = m.save(AUTHORIZATIONS_ALL); assertEquals("meta2", vertex.getProperty("propBmeta").getMetadata().getEntry("meta1").getValue()); }
@Test public void testMetadataMutationsOnVertex() { Metadata metadataPropB = Metadata.create(); metadataPropB.add("meta1", "meta1", VISIBILITY_A); Vertex vertex = graph.prepareVertex("v1", VISIBILITY_A) .setProperty("propBmeta", "propBmeta", metadataPropB, VISIBILITY_A) .save(AUTHORIZATIONS_ALL); graph.flush(); ExistingElementMutation<Vertex> m = vertex.prepareMutation(); m.setPropertyMetadata("propBmeta", "meta1", "meta2", VISIBILITY_A); vertex = m.save(AUTHORIZATIONS_ALL); assertEquals("meta2", vertex.getProperty("propBmeta").getMetadata().getEntry("meta1").getValue()); }
@Test public void testMetadataMutationsOnEdge() { Metadata metadataPropB = Metadata.create(); metadataPropB.add("meta1", "meta1", VISIBILITY_A); Edge edge = graph.prepareEdge("v1", "v2", LABEL_LABEL1, VISIBILITY_A) .setProperty("propBmeta", "propBmeta", metadataPropB, VISIBILITY_A) .save(AUTHORIZATIONS_ALL); graph.flush(); ExistingElementMutation<Edge> m = edge.prepareMutation(); m.setPropertyMetadata("propBmeta", "meta1", "meta2", VISIBILITY_A); edge = m.save(AUTHORIZATIONS_ALL); assertEquals("meta2", edge.getProperty("propBmeta").getMetadata().getEntry("meta1").getValue()); }
@Test public void testMutationChangePropertyVisibilityFollowedByMetadataUsingPropertyObject() { Metadata prop1Metadata = Metadata.create(); prop1Metadata.add("prop1_key1", "valueOld", VISIBILITY_A); graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "value1", prop1Metadata, VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); Vertex v1 = graph.getVertex("v1", FetchHints.ALL, AUTHORIZATIONS_A_AND_B); Property p1 = v1.getProperty("prop1", VISIBILITY_A); v1.prepareMutation() .alterPropertyVisibility(p1, VISIBILITY_B) .setPropertyMetadata(p1, "prop1_key1", "valueNew", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); v1 = graph.getVertex("v1", FetchHints.ALL, AUTHORIZATIONS_A_AND_B); assertEquals("valueNew", v1.getProperty("prop1", VISIBILITY_B).getMetadata().getEntry("prop1_key1", VISIBILITY_B).getValue()); }