82139f21afa5e4ee3d7e98476cb9393acad76174
[so.git] / adapters / mso-catalog-db-adapter / src / main / java / db / migration / CloudConfig.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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 db.migration;
22
23 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import org.onap.so.db.catalog.beans.CloudIdentity;
26 import org.onap.so.db.catalog.beans.CloudSite;
27 import org.onap.so.db.catalog.beans.CloudifyManager;
28
29 import java.util.HashMap;
30 import java.util.Map;
31
32 /**
33  * @deprecated
34  * This class is introduced as deprecated as its only purpose is for migration of cloud config data. It shouldnt be used elsewhere.
35  */
36
37 @Deprecated
38 @JsonIgnoreProperties(ignoreUnknown = true)
39 public class CloudConfig {
40     @JsonProperty("identity_services")
41     private Map<String, CloudIdentity> identityServices = new HashMap<>();
42
43     @JsonProperty("cloud_sites")
44     private Map<String, CloudSite> cloudSites = new HashMap<>();
45
46     @JsonProperty("cloudify_managers")
47     private Map<String, CloudifyManager> cloudifyManagers = new HashMap<>();
48
49
50     public Map<String, CloudIdentity> getIdentityServices() {
51         return identityServices;
52     }
53
54     public void setIdentityServices(Map<String, CloudIdentity> identityServices) {
55         this.identityServices = identityServices;
56     }
57
58     public Map<String, CloudSite> getCloudSites() {
59         return cloudSites;
60     }
61
62     public void setCloudSites(Map<String, CloudSite> cloudSites) {
63         this.cloudSites = cloudSites;
64     }
65
66     public Map<String, CloudifyManager> getCloudifyManagers() {
67         return cloudifyManagers;
68     }
69
70     public void setCloudifyManagers(Map<String, CloudifyManager> cloudifyManagers) {
71         this.cloudifyManagers = cloudifyManagers;
72     }
73
74     public void populateId(){
75         for (Map.Entry<String, CloudIdentity> entry : identityServices.entrySet()) {
76             entry.getValue().setId(entry.getKey());
77         }
78
79         for (Map.Entry <String, CloudSite> entry : cloudSites.entrySet()) {
80             entry.getValue().setId(entry.getKey());
81         }
82
83         for (Map.Entry<String, CloudifyManager> entry : cloudifyManagers.entrySet()) {
84             entry.getValue().setId(entry.getKey());
85         }
86     }
87 }