Merge "use encrypted auth for dmaap"
[so.git] / common / src / main / java / org / onap / so / client / graphinventory / GraphInventoryResourcesClient.java
1 package org.onap.so.client.graphinventory;
2
3 import java.util.Optional;
4
5 import javax.ws.rs.core.GenericType;
6 import javax.ws.rs.core.Response;
7
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;
12
13 public interface GraphInventoryResourcesClient<Self, Uri extends GraphInventoryUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
14
15         /**
16          * creates a new object in GraphInventory
17          * 
18          * @param obj - can be any object which will marshal into a valid GraphInventory payload
19          * @param uri
20          * @return
21          */
22         void create(Uri uri, Object obj);
23
24         /**
25          * creates a new object in GraphInventory with no payload body
26          * 
27          * @param uri
28          * @return
29          */
30         void createEmpty(Uri uri);
31
32         /**
33          * returns false if the object does not exist in GraphInventory
34          * 
35          * @param uri
36          * @return
37          */
38         boolean exists(Uri uri);
39
40         /**
41          * Adds a relationship between two objects in GraphInventory 
42          * @param uriA
43          * @param uriB
44          * @return
45          */
46         void connect(Uri uriA, Uri uriB);
47
48         /**
49          * Adds a relationship between two objects in GraphInventory 
50          * with a given edge label
51          * @param uriA
52          * @param uriB
53          * @param edge label
54          * @return
55          */
56         void connect(Uri uriA, Uri uriB, EdgeLabel label);
57
58         /**
59          * Removes relationship from two objects in GraphInventory
60          * 
61          * @param uriA
62          * @param uriB
63          * @return
64          */
65         void disconnect(Uri uriA, Uri uriB);
66
67         /**
68          * Deletes object from GraphInventory. Automatically handles resource-version.
69          * 
70          * @param uri
71          * @return
72          */
73         void delete(Uri uri);
74
75         /**
76          * @param obj - can be any object which will marshal into a valid GraphInventory payload
77          * @param uri
78          * @return
79          */
80         void update(Uri uri, Object obj);
81
82         /**
83          * Retrieves an object from GraphInventory and unmarshalls it into the Class specified
84          * @param clazz
85          * @param uri
86          * @return
87          */
88         <T> Optional<T> get(Class<T> clazz, Uri uri);
89
90         /**
91          * Retrieves an object from GraphInventory and returns complete response
92          * @param uri
93          * @return
94          */
95         Response getFullResponse(Uri uri);
96
97         /**
98          * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List 
99          * @param resultClass
100          * @param uri
101          * @return
102          */
103         <T> Optional<T> get(GenericType<T> resultClass, Uri uri);
104
105         /**
106          * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
107          * 
108          * @param uri
109          * @return
110          */
111         Wrapper get(Uri uri);
112
113         /**
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
117          * @param uri
118          * @return
119          */
120         Wrapper get(Uri uri, Class<? extends RuntimeException> c);
121
122         /**
123          * Will automatically create the object if it does not exist
124          * 
125          * @param obj - Optional object which serializes to a valid GraphInventory payload
126          * @param uri
127          * @return
128          */
129         Self createIfNotExists(Uri uri, Optional<Object> obj);
130
131         /**
132          * Starts a transaction which encloses multiple GraphInventory mutations
133          * 
134          * @return
135          */
136         TransactionalClient beginTransaction();
137
138         /**
139          * Starts a transaction groups multiple GraphInventory mutations
140          * 
141          * @return
142          */
143         SingleTransactionClient beginSingleTransaction();
144
145         <T extends RestProperties> T getRestProperties();
146
147 }