[SDC-29] rebase continue work to align source
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / operations / api / IConsumerOperation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.model.operations.api;
22
23 import org.openecomp.sdc.be.resources.data.ConsumerData;
24
25 import fj.data.Either;
26
27 import java.util.List;
28
29 public interface IConsumerOperation {
30
31         /**
32          * the method updates the node in the graph with the given ConsumerData
33          * 
34          * @param consumerData
35          *            the object we want to store
36          * @param inTransaction
37          *            inTransaction is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
38          * @return the updated object returned from the graph
39          */
40         Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData, boolean inTransaction);
41
42         /**
43          * the method updates the node in the graph with the given ConsumerData
44          * 
45          * @param consumerData
46          *            the object we want to store
47          * @return the updated object returned from the graph
48          */
49         Either<ConsumerData, StorageOperationStatus> updateCredentials(ConsumerData consumerData);
50
51         /**
52          * the method deletes the node with the given unique id
53          * 
54          * @param consumerName
55          *            the unique id by witch we will look up the credential we want to delete
56          * @param inTransaction
57          *            inTransaction is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
58          * @return the deleted object returned from the graph
59          */
60         Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName, boolean inTransaction);
61
62         /**
63          * the method deletes the node with the given unique id
64          * 
65          * @param consumerName
66          *            the unique id by witch we will look up the credential we want to delete
67          * @return the deleted object returned from the graph
68          */
69         Either<ConsumerData, StorageOperationStatus> deleteCredentials(String consumerName);
70
71         /**
72          * the method creates a new nod in the grape representing the supplied credential object
73          * 
74          * @param consumerData
75          *            the object we want to store
76          * @param inTransaction
77          *            is the operation part of a transaction, in case the value is false the action will be committed in the end of the method
78          * @return the newly stored object returned from the graph
79          */
80         Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData, boolean inTransaction);
81
82         /**
83          * the method creates a new nod in the grape representing the supplied credential object
84          * 
85          * @param consumerData
86          *            the object we want to store
87          * @return the newly stored object returned from the graph
88          */
89         Either<ConsumerData, StorageOperationStatus> createCredentials(ConsumerData consumerData);
90
91         /**
92          * the method retrieves the credential for the given consumer name
93          * 
94          * @param consumerName
95          *            the unique id by witch we will look up the credential
96          * @return ConsumerData or the error received during the operation
97          */
98         Either<ConsumerData, StorageOperationStatus> getCredentials(String consumerName);
99
100         /**
101          *
102          * @return all consumers
103      */
104         Either<List<ConsumerData>, StorageOperationStatus> getAll();
105
106 }