1 package org.onap.so.client.graphinventory;
3 import java.util.Optional;
5 import javax.ws.rs.core.GenericType;
6 import javax.ws.rs.core.Response;
8 import org.onap.so.client.RestProperties;
9 import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
10 import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
11 import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
13 public interface GraphInventoryResourcesClient<Self, Uri extends GraphInventoryUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
16 * creates a new object in GraphInventory
18 * @param obj - can be any object which will marshal into a valid GraphInventory payload
22 void create(Uri uri, Object obj);
25 * creates a new object in GraphInventory with no payload body
30 void createEmpty(Uri uri);
33 * returns false if the object does not exist in GraphInventory
38 boolean exists(Uri uri);
41 * Adds a relationship between two objects in GraphInventory
46 void connect(Uri uriA, Uri uriB);
49 * Adds a relationship between two objects in GraphInventory
50 * with a given edge label
56 void connect(Uri uriA, Uri uriB, EdgeLabel label);
59 * Removes relationship from two objects in GraphInventory
65 void disconnect(Uri uriA, Uri uriB);
68 * Deletes object from GraphInventory. Automatically handles resource-version.
76 * @param obj - can be any object which will marshal into a valid GraphInventory payload
80 void update(Uri uri, Object obj);
83 * Retrieves an object from GraphInventory and unmarshalls it into the Class specified
88 <T> Optional<T> get(Class<T> clazz, Uri uri);
91 * Retrieves an object from GraphInventory and returns complete response
95 Response getFullResponse(Uri uri);
98 * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List
103 <T> Optional<T> get(GenericType<T> resultClass, Uri uri);
106 * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
111 Wrapper get(Uri uri);
114 * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
115 * If the object cannot be found in GraphInventory the method will throw the runtime exception
116 * included as an argument
120 Wrapper get(Uri uri, Class<? extends RuntimeException> c);
123 * Will automatically create the object if it does not exist
125 * @param obj - Optional object which serializes to a valid GraphInventory payload
129 Self createIfNotExists(Uri uri, Optional<Object> obj);
132 * Starts a transaction which encloses multiple GraphInventory mutations
136 TransactionalClient beginTransaction();
139 * Starts a transaction groups multiple GraphInventory mutations
143 SingleTransactionClient beginSingleTransaction();
145 <T extends RestProperties> T getRestProperties();