[AAI-178 Amsterdam] Make Edge Properties to be
[aai/aai-common.git] / aai-core / src / main / java / org / openecomp / aai / serialization / engines / query / QueryEngine.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.openecomp.aai
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.aai.serialization.engines.query;
22
23 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
24 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
25 import org.apache.tinkerpop.gremlin.structure.Direction;
26 import org.apache.tinkerpop.gremlin.structure.Edge;
27 import org.apache.tinkerpop.gremlin.structure.Element;
28 import org.apache.tinkerpop.gremlin.structure.Vertex;
29 import org.openecomp.aai.db.props.AAIProperties;
30 import org.openecomp.aai.introspection.Loader;
31
32 import java.util.List;
33
34 public abstract class QueryEngine {
35
36         final protected GraphTraversalSource g;
37
38         /**
39          * Instantiates a new query engine.
40          *
41          * @param graphEngine the graph engine
42          */
43         public QueryEngine (GraphTraversalSource g) {
44                 this.g = g;
45         }
46         
47         /**
48          * Find parents.
49          *
50          * @param start the start
51          * @return the list
52          */
53         public abstract List<Vertex> findParents(Vertex start);
54         
55         /**
56          * Find children.
57          *
58          * @param start the start
59          * @return the list
60          */
61         public abstract List<Vertex> findAllChildren(Vertex start);
62         
63         public abstract List<Vertex> findChildrenOfType(Vertex start, String type);
64         
65         public abstract List<Vertex> findChildren(Vertex start);
66         /**
67          * Find deletable.
68          *
69          * @param start the start
70          * @return the list
71          */
72         public abstract List<Vertex> findDeletable(Vertex start);
73         
74         public Tree<Element> findSubGraph(Vertex start) {
75                 return findSubGraph(start, AAIProperties.MAXIMUM_DEPTH, false);
76         }
77         public abstract Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly);
78         /**
79          * Find related vertices.
80          *
81          * @param start the start
82          * @param direction the direction
83          * @param label the label
84          * @param nodeType the node type
85          * @return the list
86          */
87         public abstract List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType);
88
89         public abstract List<Edge> findEdgesForVersion(Vertex start, Loader loader);
90         
91         public abstract List<Vertex> findCousinVertices(Vertex start);
92
93 }