[ https://issues.apache.org/jira/browse/TINKERPOP-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16066641#comment-16066641 ]
ASF GitHub Bot commented on TINKERPOP-1701: ------------------------------------------- GitHub user okram opened a pull request: https://github.com/apache/tinkerpop/pull/643 TINKERPOP-1701: HaltedTraverserStrategy should recurse into collections for detachment. https://issues.apache.org/jira/browse/TINKERPOP-1701 `HaltedTraverserStrategy` is used by serializing systems (e.g. GremlinServer, OLAP) to decide how to format the result set. For instance, are the objects `DetachedXXX` or `ReferenceXXX`. In order to make this functionality generalized to objects within collections, `DetachedFactory` and `ReferenceFactory` were updated to handle `Tree`, `Map`, `BulkSet`, `Set`, and `List` (in any arbitrarily nested configuration). Test cases added, and stuff passes. VOTE +1. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1701 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/643.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #643 ---- commit 6e2ebb52fdaa477e93a98d6c7c28b4ce5ed9bdb5 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-27T19:51:47Z added colleciton handling to XXXFactory.detach(). This will ensure that collection nested graph elements get detached accordingly. commit d16d0df5c64f6da04c6a11c9403273f30eb264d4 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-27T20:14:22Z added test cases that verify that nested collection detachment works for Lists, Sets, and Maps (and any arbitrary nest of those collections within themselves). commit 7d54b1814937da8693b8d45498b2f56b941a9caf Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-27T20:23:12Z doh. needed to tweak the ReferenceFactory test as properties don't come over. commit 12de6fbf49028072ffb0933776c516e1bf1e9763 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-27T20:29:09Z add test cases to HaltedTraversaerStrategyTest to verify property collection handling during detachment. commit c01b27ea870b15464a263254248b177a8bd0d9d4 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-27T20:56:48Z the plot thickens with BulkSet and Tree needing special handling during detachment. @spmallette was right about the rabbit hole. Fortuantely, we have lots of test cases that failed cause of not handling these collections correctly. So that is a win. commit f43d1e2dd1635726588bd9c67bc312f8f52c07c6 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-28T14:11:37Z minor nothing. need to switch branches. commit 601f9c3062e78bec8e23d695a75cedb1e3381229 Author: Marko A. Rodriguez <okramma...@gmail.com> Date: 2017-06-28T15:02:49Z being smarter about the collection sizes on object creation. ---- > HaltedTraverserStrategy should recurse into collections for detachment. > ----------------------------------------------------------------------- > > Key: TINKERPOP-1701 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1701 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.2.5 > Reporter: Marko A. Rodriguez > Assignee: Marko A. Rodriguez > > We need to make sure that {{HaltedTraverserStrategy}} recurses into > collections. This will be elegantly handled by updated {{DetachedFactory}} > and {{ReferenceFactory}} accordingly. > For instance: > {code} > public static <D> D detach(final Object object) { > if (object instanceof Element) { > return (D) ReferenceFactory.detach((Element) object); > } else if (object instanceof Property) { > return (D) ReferenceFactory.detach((Property) object); > } else if (object instanceof Path) { > return (D) ReferenceFactory.detach((Path) object); > } else if (object instanceof List) { > final List list = new ArrayList(); > for (final Object item : (List) object) { > list.add(ReferenceFactory.detach(item)); > } > return (D) list; > } else if (object instanceof Set) { > final Set set = object instanceof LinkedHashSet ? new > LinkedHashSet() : new HashSet(); > for (final Object item : (Set) object) { > set.add(ReferenceFactory.detach(item)); > } > return (D) set; > } else if (object instanceof Map) { > final Map map = object instanceof LinkedHashMap ? new > LinkedHashMap() : new HashMap(); > for (final Map.Entry<Object, Object> entry : ((Map<Object, > Object>) object).entrySet()) { > map.put(ReferenceFactory.detach(entry.getKey()), > ReferenceFactory.detach(entry.getValue())); > } > return (D) map; > } else { > return (D) object; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)