Jugen commented on code in PR #627:
URL: https://github.com/apache/cayenne/pull/627#discussion_r1965479185


##########
cayenne-server/src/main/java/org/apache/cayenne/access/ObjectStore.java:
##########
@@ -993,60 +1022,44 @@ public void arcDeleted(Object nodeId, Object 
targetNodeId, ArcId arcId) {
      * @since 4.1
      */
     boolean hasFlattenedPath(ObjectId objectId, String path) {
-        if(trackedFlattenedPaths == null) {
-            return false;
-        }
-        return trackedFlattenedPaths
-                .getOrDefault(objectId, 
Collections.emptyMap()).containsKey(path);
+        ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) 
objectMap.get(objectId);
+        return wrapper.hasFlattenedPath(path);
     }
 
     /**
      * @since 4.2
      */
     public ObjectId getFlattenedId(ObjectId objectId, String path) {
-        if(trackedFlattenedPaths == null) {
-            return null;
-        }
-
-        return trackedFlattenedPaths
-                .getOrDefault(objectId, Collections.emptyMap()).get(path);
+        ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) 
objectMap.get(objectId);
+        return wrapper.getFlattenedId(path);
     }
 
     /**
      * @since 4.2
      */
     public Collection<ObjectId> getFlattenedIds(ObjectId objectId) {
-        if(trackedFlattenedPaths == null) {
-            return Collections.emptyList();
-        }
-
-        return trackedFlattenedPaths
-                .getOrDefault(objectId, Collections.emptyMap()).values();
+        ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) 
objectMap.get(objectId);
+        return wrapper.getFlattenedIds();
     }
 
     /**
      * @since 4.2.1
      */
     public Map<String, ObjectId> getFlattenedPathIdMap(ObjectId objectId) {
-        if(trackedFlattenedPaths == null) {
-            return Collections.emptyMap();
-        }
-
-        return trackedFlattenedPaths
-                .getOrDefault(objectId, Collections.emptyMap());
+        ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) 
objectMap.get(objectId);
+        return wrapper.getFlattenedPathIdMap();
     }
 
     /**
      * Mark that flattened path for object has data row in DB.
      * @since 4.1
      */
     public void markFlattenedPath(ObjectId objectId, String path, ObjectId id) 
{
-        if(trackedFlattenedPaths == null) {
-            trackedFlattenedPaths = new ConcurrentHashMap<>();
-        }
-        trackedFlattenedPaths
-                .computeIfAbsent(objectId, o -> new ConcurrentHashMap<>())
-                .put(path, id);
+        ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) 
objectMap.computeIfAbsent(objectId, objId -> {
+            System.out.println("Synthetic node for " + objId);

Review Comment:
   Does this console out stay?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cayenne.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to