X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fcrud%2Fdao%2FGraphDao.java;h=867cf564c6eafaae3333081461cdaa214b4b4a3f;hb=f60a17c6abb6deef1c24f917488745cbc6e6a566;hp=7834bb23e30a0eb2d44bd168c94e619f4dc72b0a;hpb=c8d962ad88da4403ae9186e7213a7ce28b82aaa1;p=aai%2Fgizmo.git diff --git a/src/main/java/org/onap/crud/dao/GraphDao.java b/src/main/java/org/onap/crud/dao/GraphDao.java index 7834bb2..867cf56 100644 --- a/src/main/java/org/onap/crud/dao/GraphDao.java +++ b/src/main/java/org/onap/crud/dao/GraphDao.java @@ -1,16 +1,15 @@ /** * ============LICENSE_START======================================================= - * Gizmo + * org.onap.aai * ================================================================================ - * Copyright © 2017 AT&T Intellectual Property. - * Copyright © 2017 Amdocs - * All rights reserved. + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,17 +17,15 @@ * 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.crud.dao; -import java.util.HashSet; import java.util.List; import java.util.Map; - +import java.util.Set; +import org.onap.aai.restclient.client.OperationResult; +import org.onap.crud.dao.champ.ChampBulkPayload; import org.onap.crud.entity.Edge; - import org.onap.crud.entity.Vertex; import org.onap.crud.exception.CrudException; @@ -36,7 +33,7 @@ public interface GraphDao { public Vertex getVertex(String id, String version) throws CrudException; - public Vertex getVertex(String id, String type, String version) throws CrudException; + public OperationResult getVertex(String id, String type, String version, Map queryParams) throws CrudException; /** * Retrieve all of the edges which are incident to the vertex with the @@ -44,10 +41,14 @@ public interface GraphDao { * * @param id * - The unique identifier of the vertex to retrieve the edges for. + * @param queryParams + * - query parameters to be passed + * @param txid + * - a DB transaction ID to use (if null, no transactionId is used) * @return - A collection of edges. * @throws CrudException */ - public List getVertexEdges(String id) throws CrudException; + public List getVertexEdges(String id, Map queryParams, String txId) throws CrudException; /** * Retrieve a collection of {@link Vertex} objects which match the supplied @@ -57,10 +58,10 @@ public interface GraphDao { * - The vertex type that we want to retrieve. * @param filter * - The parameters to filter our results by. - * @return - A collection of vertices. + * @return - The {@link OperationResult} OperationResult * @throws CrudException */ - public List getVertices(String type, Map filter) throws CrudException; + public OperationResult getVertices(String type, Map filter, String version) throws CrudException; /** * Retrieve a collection of {@link Vertex} objects which match the supplied @@ -72,10 +73,10 @@ public interface GraphDao { * - The parameters to filter our results by. * @param properties * - The properties to retrieve with the vertex - * @return - A collection of vertices. + * @return - The {@link OperationResult} OperationResult * @throws CrudException */ - public List getVertices(String type, Map filter, HashSet properties) throws CrudException; + public OperationResult getVertices(String type, Map filter, Set properties, String version) throws CrudException; /** * Retrieve an {@link Edge} from the graph database by specifying its unique @@ -83,10 +84,14 @@ public interface GraphDao { * * @param id * - The unique identifier for the Edge to be retrieved. - * @return - The Edge corresponding to the specified identifier. + * @param type + * - The type that we want to retrieve. + * @param queryParams + * - query parameters to be passed + * @return - The {@link OperationResult} OperationResult corresponding to the specified identifier. * @throws CrudException */ - public Edge getEdge(String id, String type) throws CrudException; + public OperationResult getEdge(String id, String type, Map queryParams) throws CrudException; /** * Retrieve a collection of {@link Edge} objects with a given type and which @@ -96,10 +101,10 @@ public interface GraphDao { * - The type of edges that we are interested in. * @param filter * - The parameters that we want to filter our edges by. - * @return - A collection of edges which match the supplied filter parameters. + * @return - The {@link OperationResult} OperationResult * @throws CrudException */ - public List getEdges(String type, Map filter) throws CrudException; + public OperationResult getEdges(String type, Map filter) throws CrudException; /** * Insert a new {@link Vertex} into the graph data store. @@ -108,10 +113,10 @@ public interface GraphDao { * - The type label to assign to the vertex. * @param properties * - The properties to associated with this vertex. - * @return - The {@link Vertex} object that was created. + * @return - The result of the Vertex creation. * @throws CrudException */ - public Vertex addVertex(String type, Map properties, String version) throws CrudException; + public OperationResult addVertex(String type, Map properties, String version) throws CrudException; /** * Updates an existing {@link Vertex}. @@ -120,10 +125,10 @@ public interface GraphDao { * - The unique identifier of the vertex to be updated. * @param properties * - The properties to associate with the vertex. - * @return - The udpated vertex. + * @return - The result of the update OperationResult. * @throws CrudException */ - public Vertex updateVertex(String id, String type, Map properties, String version) throws CrudException; + public OperationResult updateVertex(String id, String type, Map properties, String version) throws CrudException; /** * Removes the specified vertex from the graph data base. @@ -148,22 +153,20 @@ public interface GraphDao { * - The target vertex for this edge. * @param properties * - The properties map to associate with this edge. - * @return - The {@link Edge} object that was created. + * @return - The {@link OperationResult} OperationResult containing the Edge that was created. * @throws CrudException */ - public Edge addEdge(String type, Vertex source, Vertex target, Map properties, String version) throws CrudException; + public OperationResult addEdge(String type, Vertex source, Vertex target, Map properties, String version) throws CrudException; /** * Updates an existing {@link Edge}. * - * @param id - * - The unique identifier of the edge to be updated. - * @param properties - * - The properties to associate with the edge. - * @return - The update edge. + * @param edge + * - The edge to be updated. + * @return - The result of the update OperationResult. * @throws CrudException */ - public Edge updateEdge(Edge edge) throws CrudException; + public OperationResult updateEdge(Edge edge) throws CrudException; /** * Remove the specified edge from the graph data base. @@ -172,7 +175,7 @@ public interface GraphDao { * - The unique identifier of the edge to be deleted. * @throws CrudException */ - public void deleteEdge(String id, String type) throws CrudException; + public void deleteEdge(String id) throws CrudException; public String openTransaction(); @@ -185,7 +188,7 @@ public interface GraphDao { public Vertex addVertex(String type, Map properties, String version, String txId) throws CrudException; public Edge addEdge(String type, Vertex source, Vertex target, Map properties, String version, String txId) - throws CrudException; + throws CrudException; public Vertex updateVertex(String id, String type, Map properties, String version, String txId) throws CrudException; @@ -193,7 +196,11 @@ public interface GraphDao { public void deleteVertex(String id, String type, String txId) throws CrudException; - public void deleteEdge(String id, String type, String txId) throws CrudException; + public void deleteEdge(String id, String txId) throws CrudException; + + public Edge getEdge(String id, String txId) throws CrudException; + + public Edge getEdge(String id) throws CrudException; - public Edge getEdge(String id, String type, String txId) throws CrudException; + public OperationResult bulkOperation(ChampBulkPayload champPayload) throws CrudException; }