Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-448

The 'createIfMissing()' methods should be removed from the Graph API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 0.6
    • 0.4
    • API, Graph (2.x)
    • None
    • Low

      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.

        1. DNA-448.patch
          60 kB
          Brian Carothers

              bcarothers_jira Brian Carothers (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: