8755ad3f580667530e0d50ad5cf60681cd1ba72b
[appc.git] / appc-dispatcher / appc-request-handler / appc-request-handler-core / src / main / java / org / openecomp / appc / workingstatemanager / WorkingStateManager.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                                              reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.appc.workingstatemanager;
23
24 import org.openecomp.appc.requesthandler.exceptions.VNFNotFoundException;
25 import org.openecomp.appc.workingstatemanager.objects.VNFWorkingState;
26
27
28 public interface WorkingStateManager {
29
30     /**
31      * Return true if vnf state exists in working state map and state is STABLE else return false. If vnf does not exists in working state map throws vnf not found  exception.
32      * @param vnfId vnf Id to be verified for stable state
33      * @return True if vnf Exists and state is STABLE else False.
34      */
35     public boolean isVNFStable(String vnfId);
36
37     /**
38      * Updates working state for given vnf Id. Returns true if update was allowed and succeeded. Update will success only if the existing vnf state is 'STABLE' or
39      * if the registered ownerId is equal to the given ownerId or if the forceFlag is true.
40      * Note on case of simultaneously updates the latest updates will be failed, and another attempts will be done after refetching the updated data from persistent store.
41      * @param vnfId vnf Id to be updated
42      * @param workingState new working state
43      * @param ownerId
44      * @param forceFlag - force to update also on case given onwerId is different then the registered one
45      */
46     public boolean setWorkingState(String vnfId, VNFWorkingState workingState, String ownerId, boolean forceFlag);
47
48 }