@Test public void testCombinePropertiesTargetArrayValueSourceArrayValuesSameTypeOneSameValue(){ db.executeTransactionally("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[1995,2014], reason:\"work\"}]->(p)\n" + "Create (d)-[:GOES_TO {year:[2010,2014], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id "); testCall(db, QUERY , (r) -> { Relationship rel1 = (Relationship) r.get("rel1"); Relationship rel2 = (Relationship) r.get("rel2"); PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine"))); assertEquals(asList(1995L,2014L,2010L).toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray()); }); }
public static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig) { for (Map.Entry<String, Object> prop : properties.entrySet()) { String key = prop.getKey(); String mergeMode = refactorConfig.getMergeMode(key); mergeProperty(target, refactorConfig, prop, key, mergeMode); } }
PropertiesManager { public static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig) { for (Map.Entry<String, Object> prop : properties.entrySet()) { String key = prop.getKey(); String mergeMode = refactorConfig.getMergeMode(key); mergeProperty(target, refactorConfig, prop, key, mergeMode); } } }
PropertiesManager { public static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig) { for (Map.Entry<String, Object> prop : properties.entrySet()) { String key = prop.getKey(); String mergeMode = refactorConfig.getMergeMode(key); mergeProperty(target, refactorConfig, prop, key, mergeMode); } } private  PropertiesManager(); }
PropertiesManager { public static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig) { for (Map.Entry<String, Object> prop : properties.entrySet()) { String key = prop.getKey(); String mergeMode = refactorConfig.getMergeMode(key); mergeProperty(target, refactorConfig, prop, key, mergeMode); } } private  PropertiesManager(); static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig); static void combineProperties(Map.Entry<String, Object> prop, Entity target); }
PropertiesManager { public static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig) { for (Map.Entry<String, Object> prop : properties.entrySet()) { String key = prop.getKey(); String mergeMode = refactorConfig.getMergeMode(key); mergeProperty(target, refactorConfig, prop, key, mergeMode); } } private  PropertiesManager(); static void mergeProperties(Map<String, Object> properties, Entity target, RefactorConfig refactorConfig); static void combineProperties(Map.Entry<String, Object> prop, Entity target);  }