f63fb3365cb3435d50a4f4c01ad1c6930dc70378
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / serviceInstantiation / VfModule.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
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.onap.vid.model.serviceInstantiation;
22
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import org.apache.commons.lang3.StringUtils;
26 import org.onap.vid.domain.mso.ModelInfo;
27
28 import java.util.Collections;
29 import java.util.List;
30 import java.util.Map;
31
32 import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
33
34 /**
35  * The Class VfModule.
36  */
37 public class VfModule {
38
39
40
41         private final ModelInfo modelInfo;
42
43         @JsonInclude(NON_NULL) private final String instanceName;
44
45         private final List<Map<String, String>> instanceParams;
46         @JsonInclude(NON_NULL) private final String volumeGroupInstanceName;
47
48         public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
49                                         @JsonProperty("instanceName") String instanceName,
50                                         @JsonProperty(value = "volumeGroupName") String volumeGroupInstanceName,
51                                         @JsonProperty("instanceParams") List<Map<String, String>> instanceParams) {
52                 this.modelInfo = modelInfo;
53                 this.modelInfo.setModelType("vfModule");
54                 this.instanceName = instanceName;
55                 this.instanceParams = instanceParams;
56                 this.volumeGroupInstanceName = volumeGroupInstanceName;
57         }
58
59         public ModelInfo getModelInfo() {
60                 return modelInfo;
61         }
62
63         public String getInstanceName() {
64                 return instanceName;
65         }
66
67         public String getVolumeGroupInstanceName() {
68                 return volumeGroupInstanceName;
69         }
70
71         public List<Map<String, String>> getInstanceParams() {
72                 return instanceParams == null ? Collections.emptyList() : instanceParams;
73         }
74
75 }