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;
24 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
25 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
26 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
27 import org.apache.tinkerpop.gremlin.structure.Vertex;
28 import org.onap.aai.db.props.AAIProperties;
29 import org.onap.aai.introspection.Loader;
31 public class HistoryTraversalURIOptimizedQuery<E> extends TraversalURIOptimizedQuery {
33 public HistoryTraversalURIOptimizedQuery(Loader loader, GraphTraversalSource source) {
34 super(loader, source);
37 public HistoryTraversalURIOptimizedQuery(Loader loader, GraphTraversalSource source, Vertex start) {
38 super(loader, source, start);
41 protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
42 GraphTraversalBuilder gtb) {
43 super(traversal, loader, source, gtb);
46 protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
47 GraphTraversalBuilder gtb, Map<Integer, String> stepToAaiUri) {
48 super(traversal, loader, source, gtb, stepToAaiUri);
52 protected void vertexHas(String key, Object value) {
53 super.vertexHas(key, value);
54 touchHistoryProperties(key, value);
58 protected void vertexHasNot(String key) {
59 super.vertexHasNot(key);
60 touchHistoryProperties(key);
64 protected void vertexHas(String key) {
66 touchHistoryProperties(key);
69 private void touchHistoryProperties(String key) {
70 if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
71 traversal.where(__.properties(key));
75 private void touchHistoryProperties(String key, Object value) {
76 if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
77 traversal.where(__.properties(key).hasValue(value));