-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #303 - constraint issue (create before delete) with mergeNodes #389
Conversation
copyRelationships(source, copyProperties(source, copyLabels(source, target)), delete); | ||
if (delete) source.delete(); | ||
Map<String, Object> propTemp = new HashMap<>(); | ||
List<String> keys = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need keys?
@@ -299,16 +299,30 @@ public void categorize( | |||
} | |||
|
|||
private Node mergeNodes(Node source, Node target, boolean delete) { | |||
copyRelationships(source, copyProperties(source, copyLabels(source, target)), delete); | |||
if (delete) source.delete(); | |||
Map<String, Object> propTemp = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we find a better name? why not just Map<String, Object> properties = source.getAllProperties()
Didn't we say that we just store/keep the existing properties and then set the new ones after deletion of the source node? Not sure why we have to remove the properties individually?
return target; | ||
} | ||
|
||
private void setProperty(Map<String, Object> propTemp, List<String> keys, Node target) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that the same as copy properties? only from a map source? Best name it the same and have it return the target node too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jexp so we remane it copyProperties
with this signature private Node copyProperties(Map<String, Object> properties, Node target)
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
private Node copyRelationships(Node source, Node target, boolean delete) { | ||
for (Relationship rel : source.getRelationships()) { | ||
copyRelationship(rel, source, target); | ||
if (delete) rel.delete(); | ||
} | ||
if (delete) source.delete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this break any other code that uses this? I think the original contract for this method was that rels are deleted but the nodes are left alone.
so I'd rather move this out of the method back into mergeNodes where it originally was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jexp ok so we move back the delete into mergeNodes
before the call of copyProperties
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
@jexp change requests fixed |
Looks great, thanks a lot. |
No description provided.