Adding preload capability using userParams
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / bpmn / infrastructure / adapter / vnfm / tasks / utils / InputParameter.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Ericsson. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  * 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
21
22 import java.io.Serializable;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.stream.Collectors;
28 import java.util.stream.Stream;
29 import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
30
31 /**
32  * Wrapper class for instance parameters which are based on SOL003
33  * 
34  * @author waqas.ikram@est.tech
35  */
36 public class InputParameter implements Serializable {
37
38     private static final long serialVersionUID = 42034634585595304L;
39
40     private Map<String, String> additionalParams = new HashMap<>();
41
42     private List<ExternalVirtualLink> extVirtualLinks = new ArrayList<>();
43
44     public InputParameter() {}
45
46     public InputParameter(final Map<String, String> additionalParams, final List<ExternalVirtualLink> extVirtualLinks) {
47         this.additionalParams = additionalParams;
48         this.extVirtualLinks = extVirtualLinks;
49     }
50
51     /**
52      * @return the additionalParams
53      */
54     public Map<String, String> getAdditionalParams() {
55         return additionalParams;
56     }
57
58     /**
59      * @return the extVirtualLinks
60      */
61     public List<ExternalVirtualLink> getExtVirtualLinks() {
62         return extVirtualLinks;
63     }
64
65     /**
66      * @param additionalParams the additionalParams to set
67      */
68     public void setAdditionalParams(final Map<String, String> additionalParams) {
69         this.additionalParams = additionalParams;
70     }
71
72     public void putAdditionalParams(final Map<String, String> additionalParams) {
73         if (additionalParams != null) {
74             this.additionalParams.putAll(additionalParams);
75         }
76     }
77
78     /**
79      * @param extVirtualLinks the extVirtualLinks to set
80      */
81     public void setExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) {
82         this.extVirtualLinks = extVirtualLinks;
83     }
84
85     public void addExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) {
86         if (extVirtualLinks != null) {
87             this.extVirtualLinks = Stream.concat(this.extVirtualLinks.stream(), extVirtualLinks.stream()).distinct()
88                     .collect(Collectors.toList());
89         }
90     }
91
92     @Override
93     public String toString() {
94         return this.getClass().getSimpleName() + " [additionalParams=" + additionalParams + ", extVirtualLinks="
95                 + extVirtualLinks + "]";
96     }
97
98 }