Skip to content

Commit 3f5c4f4

Browse files
authored
feat(gql-status-object): add legacy notification fields (#1677)
This update is for Neo4j private use only. It adds the following 3 legacy notification fields to `InternalGqlNotification`: - `code` - `title` - `description`
1 parent 3cb1b14 commit 3f5c4f4

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

driver/src/main/java/org/neo4j/driver/internal/summary/InternalGqlNotification.java

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.neo4j.driver.internal.summary;
1818

1919
import java.util.Map;
20+
import java.util.Objects;
2021
import java.util.Optional;
2122
import org.neo4j.driver.NotificationClassification;
2223
import org.neo4j.driver.NotificationSeverity;
@@ -31,6 +32,11 @@ public final class InternalGqlNotification extends InternalGqlStatusObject imple
3132
private final NotificationClassification classification;
3233
private final String rawClassification;
3334

35+
// private Neo4j use only
36+
private final String code;
37+
private final String title;
38+
private final String description;
39+
3440
public InternalGqlNotification(
3541
String gqlStatus,
3642
String statusDescription,
@@ -39,13 +45,19 @@ public InternalGqlNotification(
3945
NotificationSeverity severityLevel,
4046
String rawSeverityLevel,
4147
NotificationClassification classification,
42-
String rawClassification) {
48+
String rawClassification,
49+
String code,
50+
String title,
51+
String description) {
4352
super(gqlStatus, statusDescription, diagnosticRecord);
4453
this.position = position;
4554
this.severityLevel = severityLevel;
4655
this.rawSeverityLevel = rawSeverityLevel;
4756
this.classification = classification;
4857
this.rawClassification = rawClassification;
58+
this.code = code;
59+
this.title = title;
60+
this.description = description;
4961
}
5062

5163
@Override
@@ -73,11 +85,47 @@ public Optional<String> rawClassification() {
7385
return Optional.ofNullable(rawClassification);
7486
}
7587

88+
@Override
89+
public boolean equals(Object o) {
90+
if (this == o) return true;
91+
if (o == null || getClass() != o.getClass()) return false;
92+
var that = (InternalGqlNotification) o;
93+
return Objects.equals(gqlStatus, that.gqlStatus)
94+
&& Objects.equals(statusDescription, that.statusDescription)
95+
&& Objects.equals(diagnosticRecord, that.diagnosticRecord)
96+
&& Objects.equals(code, that.code)
97+
&& Objects.equals(title, that.title)
98+
&& Objects.equals(description, that.description);
99+
}
100+
101+
@Override
102+
public int hashCode() {
103+
return Objects.hash(gqlStatus, statusDescription, diagnosticRecord, code, title, description);
104+
}
105+
76106
@Override
77107
public String toString() {
78108
return "InternalGqlNotification{" + "gqlStatus='"
79109
+ gqlStatus + '\'' + ", statusDescription='"
80110
+ statusDescription + '\'' + ", diagnosticRecord="
81-
+ diagnosticRecord + '}';
111+
+ diagnosticRecord + '\'' + ", code='"
112+
+ code + '\'' + ", title='"
113+
+ title + '\'' + ", description='"
114+
+ description + '}';
115+
}
116+
117+
// private Neo4j use only
118+
public String code() {
119+
return code;
120+
}
121+
122+
// private Neo4j use only
123+
public String title() {
124+
return title;
125+
}
126+
127+
// private Neo4j use only
128+
public String description() {
129+
return description;
82130
}
83131
}

driver/src/main/java/org/neo4j/driver/internal/util/MetadataExtractor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ private static Stream<GqlStatusObjectAndNotification> generateGqlStatusObjectsAn
282282
severityLevel,
283283
rawSeverityLevel,
284284
(NotificationClassification) category,
285-
rawCategory);
285+
rawCategory,
286+
code,
287+
title,
288+
description);
286289
var notification = new InternalNotification(
287290
code, title, description, severityLevel, rawSeverityLevel, category, rawCategory, position);
288291
return new GqlStatusObjectAndNotification(gqlNotification, notification);
@@ -379,7 +382,10 @@ private static GqlStatusObjectAndNotification extractGqlStatusObjectAndGenerateN
379382
severity,
380383
rawSeverity,
381384
classification,
382-
rawClassification);
385+
rawClassification,
386+
neo4jCode,
387+
title,
388+
notificationDescription);
383389
var notification = new InternalNotification(
384390
neo4jCode,
385391
title,

0 commit comments

Comments
 (0)