public boolean contains(String key, Visibility visibility) { return getEntry(key, visibility) != null; }
public boolean contains(String key, Visibility visibility) { return getEntry(key, visibility) != null; }
public Object getValue(String key, Visibility visibility) { Entry entry = getEntry(key, visibility); if (entry == null) { return null; } return entry.getValue(); }
public Object getValue(String key) { Entry entry = getEntry(key); if (entry == null) { return null; } return entry.getValue(); }
public Object getValue(String key, Visibility visibility) { Entry entry = getEntry(key, visibility); if (entry == null) { return null; } return entry.getValue(); }
public Object getValue(String key) { Entry entry = getEntry(key); if (entry == null) { return null; } return entry.getValue(); }
@Test public void testChangePropertyMetadata() { Metadata prop1Metadata = new Metadata(); prop1Metadata.add("prop1_key1", "valueOld", VISIBILITY_EMPTY); graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "value1", prop1Metadata, VISIBILITY_EMPTY) .setProperty("prop2", "value2", null, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A); v1.prepareMutation() .setPropertyMetadata("prop1", "prop1_key1", "valueNew", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); assertEquals("valueNew", v1.getProperty("prop1").getMetadata().getEntry("prop1_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); assertEquals("valueNew", v1.getProperty("prop1").getMetadata().getEntry("prop1_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); v1.prepareMutation() .setPropertyMetadata("prop2", "prop2_key1", "valueNew", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); assertEquals("valueNew", v1.getProperty("prop2").getMetadata().getEntry("prop2_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); assertEquals("valueNew", v1.getProperty("prop2").getMetadata().getEntry("prop2_key1", VISIBILITY_EMPTY).getValue()); }
@Test public void testChangePropertyMetadata() { Metadata prop1Metadata = new Metadata(); prop1Metadata.add("prop1_key1", "valueOld", VISIBILITY_EMPTY); graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "value1", prop1Metadata, VISIBILITY_EMPTY) .setProperty("prop2", "value2", null, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A); v1.prepareMutation() .setPropertyMetadata("prop1", "prop1_key1", "valueNew", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); assertEquals("valueNew", v1.getProperty("prop1").getMetadata().getEntry("prop1_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); assertEquals("valueNew", v1.getProperty("prop1").getMetadata().getEntry("prop1_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); v1.prepareMutation() .setPropertyMetadata("prop2", "prop2_key1", "valueNew", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A_AND_B); assertEquals("valueNew", v1.getProperty("prop2").getMetadata().getEntry("prop2_key1", VISIBILITY_EMPTY).getValue()); v1 = graph.getVertex("v1", AUTHORIZATIONS_A); assertEquals("valueNew", v1.getProperty("prop2").getMetadata().getEntry("prop2_key1", VISIBILITY_EMPTY).getValue()); }
assertNotNull(prop1Metadata); assertEquals(1, prop1Metadata.entrySet().size()); assertEquals("metadata1Value", prop1Metadata.getEntry("metadata1", VISIBILITY_A).getValue()); prop1Metadata = prop1.getMetadata(); assertEquals(2, prop1Metadata.entrySet().size()); assertEquals("metadata1Value", prop1Metadata.getEntry("metadata1", VISIBILITY_A).getValue()); assertEquals("metadata2Value", prop1Metadata.getEntry("metadata2", VISIBILITY_A).getValue());
assertNotNull(prop1Metadata); assertEquals(1, prop1Metadata.entrySet().size()); assertEquals("metadata1Value", prop1Metadata.getEntry("metadata1", VISIBILITY_A).getValue()); prop1Metadata = prop1.getMetadata(); assertEquals(2, prop1Metadata.entrySet().size()); assertEquals("metadata1Value", prop1Metadata.getEntry("metadata1", VISIBILITY_A).getValue()); assertEquals("metadata2Value", prop1Metadata.getEntry("metadata2", VISIBILITY_A).getValue());