Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> 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}.
Expand All @@ -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<String, Object> toMap(ODocument doc) {
private static Map<String, Object> toMap(ODocument doc, boolean topLevel) {
Map<String, Object> result = null;
if (doc != null) {
boolean projection = topLevel && !doc.getIdentity().isPersistent();
Expand Down Expand Up @@ -148,7 +159,7 @@ public static Map<String, Object> 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);
Expand Down
Loading