* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.serialization.engines.query;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.introspection.Loader;
+import org.onap.aai.logging.StopWatch;
/*
* This class needs some big explanation despite its compact size.
*/
@Override
public List<Vertex> findParents(Vertex start) {
-
- final GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).emit(v -> true).repeat(__.union(__.inE().has(CONTAINS.toString(), OUT.toString()).outV(), __.outE().has(CONTAINS.toString(), IN.toString()).inV()));
- return pipe.toList();
+ try {
+ StopWatch.conditionalStart();
+ @SuppressWarnings("unchecked")
+ final GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).emit(v -> true).repeat(__.union(__.inE().has(CONTAINS.toString(), OUT.toString()).outV(), __.outE().has(CONTAINS.toString(), IN.toString()).inV()));
+ return pipe.toList();
+ }
+ finally {
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
}
/**
@Override
public List<Vertex> findAllChildren(Vertex start) {
+ @SuppressWarnings("unchecked")
GraphTraversal<Vertex, Vertex> pipe = this.g
.V(start).emit(v -> true).repeat(__.union(__.outE().has(CONTAINS.toString(), OUT.toString()).inV(), __.inE().has(CONTAINS.toString(), IN.toString()).outV()));
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public List<Vertex> findChildrenOfType(Vertex start, String type) {
+ @SuppressWarnings("unchecked")
GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).union(
__.outE().has(CONTAINS.toString(), OUT.toString()).inV(),
__.inE().has(CONTAINS.toString(), IN.toString()).outV()
return pipe.toList();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public List<Vertex> findChildren(Vertex start) {
+ @SuppressWarnings("unchecked")
GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).union(
__.outE().has(CONTAINS.toString(), OUT.toString()),
__.inE().has(CONTAINS.toString(), IN.toString())
*/
@Override
public List<Vertex> findDeletable(Vertex start) {
+ @SuppressWarnings("unchecked")
GraphTraversal<Vertex, Vertex> pipe = this.g
.V(start).emit(v -> true).repeat(
__.union(
- __.outE().or(
- __.has(CONTAINS.toString(), OUT.toString()),
- __.has(DELETE_OTHER_V.toString(), OUT.toString())
- ).inV(),
- __.inE().or(
- __.has(CONTAINS.toString(), IN.toString()),
- __.has(DELETE_OTHER_V.toString(), IN.toString())
- ).outV()
+ __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
+ __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
)
- );
+ ).dedup();
return pipe.toList();
}
return pipeline.toList();
}
+ public double getDBTimeMsecs() {
+ return (dbTimeMsecs);
+ }
}