From 3c583c9882c1d655c0e5da0dd24f728cc0eeb30c Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Tue, 6 Oct 2026 11:00:47 +0300 Subject: [PATCH] Restore DocumentUtil.toMap(ODocument, boolean) to fix the master build #239 removed the topLevel parameter of the private DocumentUtil.toMap overload as unused and folded the overload into toMap(ODocument). #245, branched before #239 landed, made toMap read topLevel: only a top level document maps @rid to _id/_rev and a projected @version to _rev, while embedded documents are converted as they are. Each change merged cleanly on its own, but together master no longer compiles: DocumentUtil.java:[106,33] error: cannot find symbol: variable topLevel Restore the private toMap(ODocument, boolean topLevel) overload, with the public toMap(ODocument) delegating to it with true and asSimpleBinding passing false for embedded documents. The file is now identical to the version #245 was reviewed and tested with. --- .../openidm/repo/orientdb/impl/DocumentUtil.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/openidm-repo-orientdb/src/main/java/org/forgerock/openidm/repo/orientdb/impl/DocumentUtil.java b/openidm-repo-orientdb/src/main/java/org/forgerock/openidm/repo/orientdb/impl/DocumentUtil.java index 4295faf07..18515f1c9 100644 --- a/openidm-repo-orientdb/src/main/java/org/forgerock/openidm/repo/orientdb/impl/DocumentUtil.java +++ b/openidm-repo-orientdb/src/main/java/org/forgerock/openidm/repo/orientdb/impl/DocumentUtil.java @@ -86,6 +86,16 @@ public static ResourceResponse toResource(ODocument doc) { return result; } + /** + * Convert to JSON object structures (akin to simple binding), + * composed of the basic Java types: {@link Map}, {@link List}, {@link String}, {@link Number}, {@link Boolean}. + * @param doc the OrientDB document to convert + * @return the doc converted into maps, lists, java types; or null if the doc was null + */ + public static Map toMap(ODocument doc) { + return toMap(doc, true); + } + /** * Convert to JSON object structures (akin to simple binding), * composed of the basic Java types: {@link Map}, {@link List}, {@link String}, {@link Number}, {@link Boolean}. @@ -98,9 +108,10 @@ public static ResourceResponse toResource(ODocument doc) { * Embedded documents are converted as they are. * * @param doc the OrientDB document to convert + * @param topLevel if the passed in document represents a top level orientdb class, or false if it is an embedded document * @return the doc converted into maps, lists, java types; or null if the doc was null */ - public static Map toMap(ODocument doc) { + private static Map toMap(ODocument doc, boolean topLevel) { Map result = null; if (doc != null) { boolean projection = topLevel && !doc.getIdentity().isPersistent(); @@ -148,7 +159,7 @@ public static Map toMap(ODocument doc) { private static Object asSimpleBinding(Object objToClean) { if (objToClean instanceof ODocument) { logger.trace("Converting embedded ODocument {} to map ", objToClean); - return DocumentUtil.toMap((ODocument) objToClean); + return DocumentUtil.toMap((ODocument) objToClean, false); } else if (objToClean instanceof List) { logger.trace("Checking embedded list {} ", objToClean); return toSimpleModel((List) objToClean);