-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
InternalWrapping.scala
85 lines (80 loc) · 5.85 KB
/
InternalWrapping.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Copyright (c) 2002-2017 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.cypher.internal.compatibility.v3_4.runtime.helpers
import org.neo4j.cypher.internal.frontend.v3_4.notification.{DeprecatedPlannerNotification, InternalNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _}
import org.neo4j.cypher.internal.util.v3_4.InputPosition
import org.neo4j.graphdb
import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail}
import scala.collection.JavaConverters._
object InternalWrapping {
def asKernelNotification(offset: Option[InputPosition])(notification: InternalNotification) = notification match {
case DeprecatedStartNotification(pos, message) =>
NotificationCode.START_DEPRECATED.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.message("START", message))
case CartesianProductNotification(pos, variables) =>
NotificationCode.CARTESIAN_PRODUCT.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.cartesianProduct(variables.asJava))
case LengthOnNonPathNotification(pos) =>
NotificationCode.LENGTH_ON_NON_PATH.notification(pos.withOffset(offset).asInputPosition)
case PlannerUnsupportedNotification =>
NotificationCode.PLANNER_UNSUPPORTED.notification(graphdb.InputPosition.empty)
case RuntimeUnsupportedNotification =>
NotificationCode.RUNTIME_UNSUPPORTED.notification(graphdb.InputPosition.empty)
case IndexHintUnfulfillableNotification(label, propertyKeys) =>
NotificationCode.INDEX_HINT_UNFULFILLABLE.notification(graphdb.InputPosition.empty, NotificationDetail.Factory.index(label, propertyKeys: _*))
case JoinHintUnfulfillableNotification(variables) =>
NotificationCode.JOIN_HINT_UNFULFILLABLE.notification(graphdb.InputPosition.empty, NotificationDetail.Factory.joinKey(variables.asJava))
case JoinHintUnsupportedNotification(variables) =>
NotificationCode.JOIN_HINT_UNSUPPORTED.notification(graphdb.InputPosition.empty, NotificationDetail.Factory.joinKey(variables.asJava))
case IndexLookupUnfulfillableNotification(labels) =>
NotificationCode.INDEX_LOOKUP_FOR_DYNAMIC_PROPERTY.notification(graphdb.InputPosition.empty, NotificationDetail.Factory.indexSeekOrScan(labels.asJava))
case EagerLoadCsvNotification =>
NotificationCode.EAGER_LOAD_CSV.notification(graphdb.InputPosition.empty)
case LargeLabelWithLoadCsvNotification =>
NotificationCode.LARGE_LABEL_LOAD_CSV.notification(graphdb.InputPosition.empty)
case MissingLabelNotification(pos, label) =>
NotificationCode.MISSING_LABEL.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.label(label))
case MissingRelTypeNotification(pos, relType) =>
NotificationCode.MISSING_REL_TYPE.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.relationshipType(relType))
case MissingPropertyNameNotification(pos, name) =>
NotificationCode.MISSING_PROPERTY_NAME.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.propertyName(name))
case UnboundedShortestPathNotification(pos) =>
NotificationCode.UNBOUNDED_SHORTEST_PATH.notification(pos.withOffset(offset).asInputPosition)
case ExhaustiveShortestPathForbiddenNotification(pos) =>
NotificationCode.EXHAUSTIVE_SHORTEST_PATH.notification(pos.withOffset(offset).asInputPosition)
case DeprecatedFunctionNotification(pos, oldName, newName) =>
NotificationCode.DEPRECATED_FUNCTION.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.deprecatedName(oldName, newName))
case DeprecatedProcedureNotification(pos, oldName, newName) =>
NotificationCode.DEPRECATED_PROCEDURE.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.deprecatedName(oldName, newName))
case DeprecatedFieldNotification(pos, procedure, field) =>
NotificationCode.DEPRECATED_PROCEDURE_RETURN_FIELD.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.deprecatedField(procedure, field))
case DeprecatedVarLengthBindingNotification(pos, variable) =>
NotificationCode.DEPRECATED_BINDING_VAR_LENGTH_RELATIONSHIP.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.bindingVarLengthRelationship(variable))
case DeprecatedRelTypeSeparatorNotification(pos) =>
NotificationCode.DEPRECATED_RELATIONSHIP_TYPE_SEPARATOR.notification(pos.withOffset(offset).asInputPosition)
case DeprecatedPlannerNotification =>
NotificationCode.DEPRECATED_PLANNER.notification(graphdb.InputPosition.empty)
case ProcedureWarningNotification(pos, name, warning) =>
NotificationCode.PROCEDURE_WARNING.notification(pos.withOffset(offset).asInputPosition, NotificationDetail.Factory.procedureWarning(name, warning))
case ExperimentalFeatureNotification(msg) =>
NotificationCode.EXPERIMENTAL_FEATURE.notification(graphdb.InputPosition.empty, NotificationDetail.Factory.message("MORSEL", msg))
}
private implicit class ConvertibleCompilerInputPosition(pos: InputPosition) {
def asInputPosition = new graphdb.InputPosition(pos.offset, pos.line, pos.column)
}
}