Skip to content

Commit

Permalink
Also serializing the full name of a Node as name in Neo4J (#1063)
Browse files Browse the repository at this point in the history
* Also serializing the full name of a Node as `name` in Neo4J
* Update libs.versions.toml (Neo4J OGM to 4.0.2)
* Added comments to NameConverter
  • Loading branch information
oxisto authored Feb 1, 2023
1 parent ab0b916 commit 6833080
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,27 @@ class NameConverter : CompositeAttributeConverter<Name> {

companion object {
const val FIELD_FULL_NAME = "fullName"
const val FIELD_NAME = "name"
const val FIELD_LOCAL_NAME = "localName"
const val FIELD_NAME_DELIMITER = "nameDelimiter"
}

override fun toGraphProperties(value: Name): MutableMap<String, *> {
val map = mutableMapOf<String, String>()
// The full name of the node
map[FIELD_FULL_NAME] = value.toString()

// The local name of the node
map[FIELD_LOCAL_NAME] = value.localName

// The delimiter
map[FIELD_NAME_DELIMITER] = value.delimiter

// For reasons such as backwards compatibility and the fact that Neo4J likes to display
// nodes in the UI with a "name" field as default, we also persist the full name (aka the
// toString() representation) as "name"
map[FIELD_NAME] = value.toString()

return map
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
kotlin = "1.8.0"
neo4j = "4.0.1"
neo4j = "4.0.2"
log4j = "2.19.0"
sonarqube = "3.5.0.2730"
spotless = "6.14.0"
Expand Down

0 comments on commit 6833080

Please sign in to comment.