2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.query.builder;
25 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
26 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
27 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
28 import org.apache.tinkerpop.gremlin.structure.Vertex;
29 import org.onap.aai.db.props.AAIProperties;
30 import org.onap.aai.introspection.Loader;
32 public class HistoryTraversalURIOptimizedQuery<E> extends TraversalURIOptimizedQuery {
34 public HistoryTraversalURIOptimizedQuery(Loader loader, GraphTraversalSource source) {
35 super(loader, source);
38 public HistoryTraversalURIOptimizedQuery(Loader loader, GraphTraversalSource source, Vertex start) {
39 super(loader, source, start);
42 protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
43 GraphTraversalBuilder gtb) {
44 super(traversal, loader, source, gtb);
47 protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
48 GraphTraversalBuilder gtb, Map<Integer, String> stepToAaiUri) {
49 super(traversal, loader, source, gtb, stepToAaiUri);
53 protected void vertexHas(String key, Object value) {
54 super.vertexHas(key, value);
55 touchHistoryProperties(key, value);
59 protected void vertexHasNot(String key) {
60 super.vertexHasNot(key);
61 touchHistoryProperties(key);
65 protected void vertexHas(String key) {
67 touchHistoryProperties(key);
70 private void touchHistoryProperties(String key) {
71 if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
72 traversal.where(__.properties(key));
76 private void touchHistoryProperties(String key, Object value) {
77 if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
78 traversal.where(__.properties(key).hasValue(value));