Merge changes from topics "VID-14", "VID-13", "VID-12"
[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 static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
24
25 import com.fasterxml.jackson.annotation.JsonInclude;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import java.util.Collection;
28 import java.util.Collections;
29 import java.util.List;
30 import java.util.Map;
31 import org.onap.vid.job.JobAdapter;
32 import org.onap.vid.job.JobType;
33 import org.onap.vid.mso.model.ModelInfo;
34
35 /**
36  * The Class VfModule.
37  */
38 @JsonInclude(NON_NULL)
39 public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest {
40
41         @JsonInclude(NON_NULL) private final String volumeGroupInstanceName;
42         @JsonInclude(NON_NULL) private Boolean usePreload;
43         private Map<String, String> supplementaryParams;
44
45         public VfModule( @JsonProperty("modelInfo") ModelInfo modelInfo,
46                                          @JsonProperty("instanceName") String instanceName,
47                                          @JsonProperty("volumeGroupName") String volumeGroupInstanceName,
48                                          @JsonProperty("action") String action,
49                                          @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
50                                          @JsonProperty("legacyRegion") String legacyRegion,
51                                          @JsonProperty("tenantId") String tenantId,
52                                          @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
53                                          @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams,
54                                          @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
55                                          @JsonProperty("sdncPreLoad") Boolean usePreload,
56                                          @JsonProperty("instanceId") String instanceId,
57                                          @JsonProperty("trackById") String trackById,
58                                          @JsonProperty("isFailed") Boolean isFailed,
59                                          @JsonProperty("statusMessage") String statusMessage) {
60                 super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
61                 this.volumeGroupInstanceName = volumeGroupInstanceName;
62                 this.usePreload = usePreload;
63                 this.supplementaryParams = supplementaryParams;
64         }
65
66         public String getVolumeGroupInstanceName() {
67                 return volumeGroupInstanceName;
68         }
69
70         public Boolean isUsePreload() {
71
72                 return usePreload;
73         }
74
75         public Map<String, String> getSupplementaryParams() {
76                 return supplementaryParams;
77         }
78
79         @Override
80         protected String getModelType() {
81                 return "vfModule";
82         }
83
84         @Override
85         public Collection<BaseResource> getChildren() {
86                 return Collections.emptyList();
87         }
88
89         @Override
90         public JobType getJobType() {
91                 return JobType.VfmoduleInstantiation;
92         }
93
94         public VfModule cloneWith(ModelInfo modelInfo) {
95                 return new VfModule(
96                                 modelInfo,
97                                 this.getInstanceName(),
98                                 this.getVolumeGroupInstanceName(),
99                                 this.getAction().toString(),
100                                 this.getLcpCloudRegionId(),
101                                 this.getLcpCloudRegionId(),
102                                 this.getTenantId(),
103                                 this.getInstanceParams(),
104                                 this.getSupplementaryParams(),
105                                 this.isRollbackOnFailure(),
106                                 this.isUsePreload(),
107                                 this.getInstanceId(),
108                                 this.getTrackById(),
109                                 this.getIsFailed(),
110                                 this.getStatusMessage()
111                 );
112
113         }
114 }