ef202d013d2742a6f1f29f1e1886ebec4807a906
[sdc.git] /
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.vendorsoftwareproduct.types.composition;
22
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.HashSet;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Set;
29 import lombok.Getter;
30 import lombok.NoArgsConstructor;
31
32 @Getter
33 @NoArgsConstructor
34 public class ExtractCompositionDataContext {
35
36     private List<Network> networks = new ArrayList<>();
37     private List<Component> components = new ArrayList<>();
38     private Map<String, Nic> nics = new HashMap<>();
39     private Map<String, Image> images = new HashMap<>();
40     private Map<String, ComputeData> computes = new HashMap<>();
41     private Set<String> handledServiceTemplates = new HashSet<>();
42     private Set<String> createdComponents = new HashSet<>();
43
44     public void addHandledServiceTemplates(String handledServiceTemplate) {
45         this.handledServiceTemplates.add(handledServiceTemplate);
46     }
47
48     /**
49      * Add network.
50      *
51      * @param network the network
52      */
53     public void addNetwork(Network network) {
54         if (network != null) {
55             networks.add(network);
56         }
57     }
58
59     /**
60      * Add networks.
61      *
62      * @param network the network
63      */
64     public void addNetworks(List<Network> network) {
65         if (networks != null) {
66             networks.addAll(network);
67         }
68     }
69
70     /**
71      * Add component.
72      *
73      * @param component the component
74      */
75     public void addComponent(Component component) {
76         if (component != null) {
77             components.add(component);
78         }
79     }
80
81     /**
82      * Add components.
83      *
84      * @param components the components
85      */
86     public void addComponents(List<Component> components) {
87         if (components != null) {
88             this.components.addAll(components);
89         }
90     }
91
92     public void addNic(String nicId, Nic nic) {
93         this.nics.put(nicId, nic);
94     }
95
96     public void addImage(String imageId, Image image) {
97         this.images.put(imageId, image);
98     }
99
100     public void addCompute(String computeId, ComputeData computedata) {
101         this.computes.put(computeId, computedata);
102     }
103 }