23
23
24
24
import org .apache .commons .logging .LogFactory ;
25
25
import org .jspecify .annotations .Nullable ;
26
- import org .neo4j .driver .NotificationClassification ;
26
+ import org .neo4j .driver .NotificationCategory ;
27
27
import org .neo4j .driver .NotificationSeverity ;
28
28
import org .neo4j .driver .summary .InputPosition ;
29
29
import org .neo4j .driver .summary .Notification ;
@@ -94,8 +94,9 @@ private static void logNotifications(ResultSummary resultSummary) {
94
94
Predicate <Notification > isDeprecationWarningForId ;
95
95
try {
96
96
isDeprecationWarningForId = notification -> supressIdDeprecations
97
- && notification .classification ()
98
- .orElse (NotificationClassification .UNRECOGNIZED ) == NotificationClassification .DEPRECATION
97
+ && notification .category ()
98
+ .orElse (NotificationCategory .UNRECOGNIZED )
99
+ .equals (NotificationCategory .DEPRECATION )
99
100
&& DEPRECATED_ID_PATTERN .matcher (notification .description ()).matches ();
100
101
}
101
102
finally {
@@ -107,7 +108,7 @@ private static void logNotifications(ResultSummary resultSummary) {
107
108
.stream ()
108
109
.filter (Predicate .not (isDeprecationWarningForId ))
109
110
.forEach (notification -> notification .severityLevel ().ifPresent (severityLevel -> {
110
- var category = notification .classification ().orElse (null );
111
+ var category = notification .category ().orElse (null );
111
112
112
113
var logger = getLogAccessor (category );
113
114
Consumer <String > logFunction ;
@@ -129,21 +130,35 @@ else if (severityLevel == NotificationSeverity.OFF) {
129
130
}));
130
131
}
131
132
132
- private static LogAccessor getLogAccessor (@ Nullable NotificationClassification category ) {
133
+ private static LogAccessor getLogAccessor (@ Nullable NotificationCategory category ) {
133
134
if (category == null ) {
134
135
return Neo4jClient .cypherLog ;
135
136
}
136
- return switch (category ) {
137
- case HINT -> cypherHintNotificationLog ;
138
- case DEPRECATION -> cypherDeprecationNotificationLog ;
139
- case PERFORMANCE -> cypherPerformanceNotificationLog ;
140
- case GENERIC -> cypherGenericNotificationLog ;
141
- case UNSUPPORTED -> cypherUnsupportedNotificationLog ;
142
- case UNRECOGNIZED -> cypherUnrecognizedNotificationLog ;
143
- case SECURITY -> cypherSecurityNotificationLog ;
144
- case TOPOLOGY -> cypherTopologyNotificationLog ;
145
- default -> Neo4jClient .cypherLog ;
146
- };
137
+ if (category .equals (NotificationCategory .HINT )) {
138
+ return cypherHintNotificationLog ;
139
+ }
140
+ else if (category .equals (NotificationCategory .DEPRECATION )) {
141
+ return cypherDeprecationNotificationLog ;
142
+ }
143
+ else if (category .equals (NotificationCategory .PERFORMANCE )) {
144
+ return cypherPerformanceNotificationLog ;
145
+ }
146
+ else if (category .equals (NotificationCategory .GENERIC )) {
147
+ return cypherGenericNotificationLog ;
148
+ }
149
+ else if (category .equals (NotificationCategory .UNSUPPORTED )) {
150
+ return cypherUnsupportedNotificationLog ;
151
+ }
152
+ else if (category .equals (NotificationCategory .UNRECOGNIZED )) {
153
+ return cypherUnrecognizedNotificationLog ;
154
+ }
155
+ else if (category .equals (NotificationCategory .SECURITY )) {
156
+ return cypherSecurityNotificationLog ;
157
+ }
158
+ else if (category .equals (NotificationCategory .TOPOLOGY )) {
159
+ return cypherTopologyNotificationLog ;
160
+ }
161
+ return Neo4jClient .cypherLog ;
147
162
}
148
163
149
164
/**
0 commit comments