2222import java .util .stream .Stream ;
2323
2424import org .apache .commons .logging .LogFactory ;
25- import org .neo4j .driver .NotificationClassification ;
25+ import org .neo4j .driver .NotificationCategory ;
2626import org .neo4j .driver .NotificationSeverity ;
2727import org .neo4j .driver .summary .InputPosition ;
2828import org .neo4j .driver .summary .Notification ;
@@ -75,18 +75,20 @@ private static void logNotifications(ResultSummary resultSummary) {
7575 Predicate <Notification > isDeprecationWarningForId ;
7676 try {
7777 isDeprecationWarningForId = notification -> supressIdDeprecations
78- && notification .classification ().orElse (NotificationClassification .UNRECOGNIZED )
79- == NotificationClassification .DEPRECATION && DEPRECATED_ID_PATTERN .matcher (notification .description ())
80- .matches ();
78+ && notification .category ()
79+ .orElse (NotificationCategory .UNRECOGNIZED )
80+ .equals (NotificationCategory .DEPRECATION )
81+ && DEPRECATED_ID_PATTERN .matcher (notification .description ()).matches ();
8182 } finally {
8283 Neo4jClient .SUPPRESS_ID_DEPRECATIONS .setRelease (supressIdDeprecations );
8384 }
8485
8586 String query = resultSummary .query ().text ();
8687 resultSummary .notifications ()
87- .stream ().filter (Predicate .not (isDeprecationWarningForId ))
88- .forEach (notification -> notification .severityLevel ().ifPresent (severityLevel -> {
89- var category = notification .classification ().orElse (null );
88+ .stream ()
89+ .filter (Predicate .not (isDeprecationWarningForId ))
90+ .forEach (notification -> notification .severityLevel ().ifPresent (severityLevel -> {
91+ var category = notification .category ().orElse (null );
9092
9193 var logger = getLogAccessor (category );
9294 Consumer <String > logFunction ;
@@ -105,21 +107,35 @@ private static void logNotifications(ResultSummary resultSummary) {
105107 }));
106108 }
107109
108- private static LogAccessor getLogAccessor (@ Nullable NotificationClassification category ) {
110+ private static LogAccessor getLogAccessor (@ Nullable NotificationCategory category ) {
109111 if (category == null ) {
110112 return Neo4jClient .cypherLog ;
111113 }
112- return switch (category ) {
113- case HINT -> cypherHintNotificationLog ;
114- case DEPRECATION -> cypherDeprecationNotificationLog ;
115- case PERFORMANCE -> cypherPerformanceNotificationLog ;
116- case GENERIC -> cypherGenericNotificationLog ;
117- case UNSUPPORTED -> cypherUnsupportedNotificationLog ;
118- case UNRECOGNIZED -> cypherUnrecognizedNotificationLog ;
119- case SECURITY -> cypherSecurityNotificationLog ;
120- case TOPOLOGY -> cypherTopologyNotificationLog ;
121- default -> Neo4jClient .cypherLog ;
122- };
114+ if (category .equals (NotificationCategory .HINT )) {
115+ return cypherHintNotificationLog ;
116+ }
117+ if (category .equals (NotificationCategory .DEPRECATION )) {
118+ return cypherDeprecationNotificationLog ;
119+ }
120+ if (category .equals (NotificationCategory .PERFORMANCE )) {
121+ return cypherPerformanceNotificationLog ;
122+ }
123+ if (category .equals (NotificationCategory .GENERIC )) {
124+ return cypherGenericNotificationLog ;
125+ }
126+ if (category .equals (NotificationCategory .UNSUPPORTED )) {
127+ return cypherUnsupportedNotificationLog ;
128+ }
129+ if (category .equals (NotificationCategory .UNRECOGNIZED )) {
130+ return cypherUnrecognizedNotificationLog ;
131+ }
132+ if (category .equals (NotificationCategory .SECURITY )) {
133+ return cypherSecurityNotificationLog ;
134+ }
135+ if (category .equals (NotificationCategory .TOPOLOGY )) {
136+ return cypherTopologyNotificationLog ;
137+ }
138+ return Neo4jClient .cypherLog ;
123139 }
124140
125141 /**
@@ -180,6 +196,4 @@ private static void printPlan(Consumer<String> log, Plan plan, int level) {
180196 }
181197 }
182198
183- private ResultSummaries () {
184- }
185199}
0 commit comments