@Override public void setNodeProperties( long node, Map<String,Object> properties ) { delegate.setNodeProperties( node, properties ); }
@Test public void shouldChangePropertiesInCurrentBatch() { // GIVEN BatchInserter inserter = globalInserter; Map<String,Object> properties = map( "key1", "value1" ); long node = inserter.createNode( properties ); // WHEN properties.put( "additionalKey", "Additional value" ); inserter.setNodeProperties( node, properties ); // THEN assertEquals( properties, getNodeProperties( inserter, node ) ); }
@Test public void testMore() { BatchInserter graphDb = globalInserter; long startNode = graphDb.createNode( properties ); long[] endNodes = new long[25]; Set<Long> rels = new HashSet<>(); for ( int i = 0; i < 25; i++ ) { endNodes[i] = graphDb.createNode( properties ); rels.add( graphDb.createRelationship( startNode, endNodes[i], relTypeArray[i % 5], properties ) ); } for ( BatchRelationship rel : graphDb.getRelationships( startNode ) ) { assertTrue( rels.contains( rel.getId() ) ); assertEquals( rel.getStartNode(), startNode ); } graphDb.setNodeProperties( startNode, properties ); }
@Override public void setNodeProperties( long node, Map<String,Object> properties ) { delegate.setNodeProperties( node, properties ); }
public <T> T removeProperty(final String key) { final Map<String, Object> properties = this.getPropertyMapClone(); final Object value = properties.remove(key); this.graph.getRawGraph().setNodeProperties(this.id, properties); return (T) value; }
public Object removeProperty(final String key) { final Map<String, Object> properties = this.getPropertyMapClone(); final Object value = properties.remove(key); this.graph.getRawGraph().setNodeProperties(this.id, properties); return value; }
@Override public void setNodeProperty(long node, String property, Object value) { if (GraphUtil.ignoreProperty(value)) { return; } try { synchronized (graphLock) { Map<String, Object> properties = Maps.newHashMap(inserter.getNodeProperties(node)); properties.put(property, value); inserter.setNodeProperties(node, properties); } } catch (Exception e) { logger.log(Level.WARNING, "Failed to set " + property + " to " + value + " on " + node, e); } }
public void setProperty(final String key, final Object value) { if (key.isEmpty()) throw ExceptionFactory.elementKeyCanNotBeEmpty(); if (key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); final Map<String, Object> properties = this.getPropertyMapClone(); properties.put(key, value); this.graph.getRawGraph().setNodeProperties(this.id, properties); }
public void setProperty(final String key, final Object value) { if (key.isEmpty()) throw ExceptionFactory.propertyKeyCanNotBeEmpty(); if (key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); final Map<String, Object> properties = this.getPropertyMapClone(); properties.put(key, value); this.graph.getRawGraph().setNodeProperties(this.id, properties); }
@Override public void addNodeProperty(long node, String property, Object value) { if (GraphUtil.ignoreProperty(value)) { return; } synchronized(graphLock) { Map<String, Object> properties = inserter.getNodeProperties(node); if (properties.containsKey(property)) { Object originalValue = properties.get(property); Object newValue = GraphUtil.getNewPropertyValue(originalValue, value); Map<String, Object> newProperties = Maps.newHashMap(inserter.getNodeProperties(node)); newProperties.put(property, newValue); inserter.setNodeProperties(node, newProperties); } else { setNodeProperty(node, property, value); } } }