[
https://jira.jboss.org/jira/browse/DNA-448?page=com.atlassian.jira.plugin...
]
Brian Carothers updated DNA-448:
--------------------------------
Attachment: DNA-448.patch
The attached patch (DNA-448.patch) replaces the existing Graph create and createIfMissing
methods with a copy of the Graph.Batch create methods (modified to do direct writes, of
course). This improves consistency between the direct and batched create methods, but
forces the use of and() as a terminator to indicate that a set of create settings is
complete and the request should be submitted.
The patch also removes the GetNodeConjunction class, which was only used by the
now-deleted createIfMissing methods. It turns out that there was nowhere in the codebase
that needed this functionality. As the previous implementation wasn't atomic anyway,
the functionality can be replaced with an equivalent create call followed by a getNodeAt
in non-batched mode.
The 'createIfMissing()' methods should be removed from the
Graph API
--------------------------------------------------------------------
Key: DNA-448
URL:
https://jira.jboss.org/jira/browse/DNA-448
Project: DNA
Issue Type: Bug
Components: API, Graph
Affects Versions: 0.4
Reporter: Randall Hauch
Fix For: 0.6
Attachments: DNA-448.patch
This issue stemmed from DNA-443. The existence of the "createIfMissing()"
methods that exist only on the Graph interface (and not the Graph.Batch interface) mask
the existence of newer, more powerful methods that can do the same thing on Graph and
Graph.Batch:
graph.create(path).ifAbsent()...
or
batch.create(path).ifAbsent()...
In fact, this style makes available several other methods than "ifAbsent()",
such as "orUpdate()", "byAppending()", and "orReplace()".
These correspond to the different NodeConflictBehavior options.
Unfortunately, the 'create()' methods just return the Conjunction interface,
while the 'createIfMissing()' methods return the "GetNodeConjunction"
interface (which extends Conjunction and adds the "andReturn():Node" method).
And there is at least one place where 'createIfMissing(...).andReturn()' is being
called. Looking at this now, I'm not sure why the Graph.create(...) methods can't
return the GetNodeConjunction interface. This would allow the existing uses of the
'createIfMissing(...).andReturn()' to replace them with
'create(...).ifAbsent().andReturn()' calls, and enable the removal of the
'createIfMissing(...)' methods.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira