-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The cypher function `id` has been deprecated since Neo4j 5.0. This PR adds the capability of sniffing the DBMS version so that the DiffService can write an update query that matches the server version. Likewise has `entity.id()` in the driver been deprecated. The driver will set `elementId` to `id.toString()` if the server does not provide it (4.4 and before). Therefore, it's safe to always use `entity.elementId()` regardless of the server version.
- Loading branch information
1 parent
536b4a6
commit 6b1dd30
Showing
23 changed files
with
263 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
.../main/java/com/albertoventurini/graphdbplugin/database/api/data/GraphDatabaseVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copied and adapted from plugin | ||
* <a href="https://github.com/neueda/jetbrains-plugin-graph-database-support">Graph Database Support</a> | ||
* by Neueda Technologies, Ltd. | ||
* Modified by Alberto Venturini, 2022 | ||
*/ | ||
package com.albertoventurini.graphdbplugin.database.api.data; | ||
|
||
public interface GraphDatabaseVersion { | ||
String toString(); | ||
|
||
String idFunction(); | ||
|
||
Object idToParameter(String id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...om/albertoventurini/graphdbplugin/database/neo4j/bolt/data/Neo4jGraphDatabaseVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copied and adapted from plugin | ||
* <a href="https://github.com/neueda/jetbrains-plugin-graph-database-support">Graph Database Support</a> | ||
* by Neueda Technologies, Ltd. | ||
* Modified by Alberto Venturini, 2022 | ||
*/ | ||
package com.albertoventurini.graphdbplugin.database.neo4j.bolt.data; | ||
|
||
import com.albertoventurini.graphdbplugin.database.api.data.GraphDatabaseVersion; | ||
|
||
public record Neo4jGraphDatabaseVersion(int major, int minor, int patch) implements GraphDatabaseVersion { | ||
|
||
@Override | ||
public String toString() { | ||
return "Neo4j/" + major + "." + minor + "." + patch; | ||
} | ||
|
||
@Override | ||
public String idFunction() { | ||
if (major >= 5) { | ||
return "elementId"; | ||
} | ||
return "id"; | ||
} | ||
|
||
@Override | ||
public Object idToParameter(String id) { | ||
if (major >= 5) { | ||
return id; | ||
} | ||
return Long.parseLong(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...oventurini/graphdbplugin/jetbrains/component/datasource/metadata/neo4j/Neo4jMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.