Templates: show correct values of sdnc-preload, volume-group name
[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.JsonAlias;
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import java.util.Collection;
29 import java.util.Collections;
30 import java.util.List;
31 import java.util.Map;
32 import javax.annotation.Nullable;
33 import org.onap.vid.job.JobAdapter;
34 import org.onap.vid.job.JobType;
35 import org.onap.vid.mso.model.ModelInfo;
36
37 /**
38  * The Class VfModule.
39  */
40 @JsonInclude(NON_NULL)
41 public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest {
42
43         @JsonInclude(NON_NULL) @JsonProperty("volumeGroupName") private final String volumeGroupInstanceName;
44         @JsonInclude(NON_NULL) @JsonProperty("sdncPreLoad") private Boolean usePreload;
45         private Map<String, String> supplementaryParams;
46
47         @JsonInclude(NON_NULL)
48         private final Boolean retainVolumeGroups;
49
50         @JsonInclude(NON_NULL)
51         private Boolean retainAssignments;
52
53         public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
54                 @JsonProperty("instanceName") String instanceName,
55                 @JsonProperty("volumeGroupName") @JsonAlias("volumeGroupInstanceName") String volumeGroupInstanceName,
56                 @JsonProperty("action") String action,
57                 @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
58                 @JsonProperty("legacyRegion") String legacyRegion,
59                 @JsonProperty("tenantId") String tenantId,
60                 @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
61                 @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams,
62                 @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
63                 @JsonProperty("sdncPreLoad") @JsonAlias("usePreload") Boolean usePreload,
64                 @JsonProperty("instanceId") String instanceId,
65                 @JsonProperty("trackById") String trackById,
66                 @JsonProperty("isFailed") Boolean isFailed,
67                 @JsonProperty("statusMessage") String statusMessage,
68                 @Nullable @JsonProperty("retainAssignments") Boolean retainAssignments,
69                 @Nullable @JsonProperty("retainVolumeGroups") Boolean retainVolumeGroups,
70                 @JsonProperty("position") Integer position) {
71                 super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
72                         position);
73                 this.volumeGroupInstanceName = volumeGroupInstanceName;
74                 this.usePreload = usePreload;
75                 this.supplementaryParams = supplementaryParams;
76                 this.retainAssignments = retainAssignments;
77                 this.retainVolumeGroups = retainVolumeGroups;
78         }
79
80         public String getVolumeGroupInstanceName() {
81                 return volumeGroupInstanceName;
82         }
83
84         public Boolean isUsePreload() {
85
86                 return usePreload;
87         }
88
89         public Map<String, String> getSupplementaryParams() {
90                 return supplementaryParams;
91         }
92
93         @Override
94         protected String getModelType() {
95                 return "vfModule";
96         }
97
98         @Override
99         public Collection<BaseResource> getChildren() {
100                 return Collections.emptyList();
101         }
102
103         @Override
104         public JobType getJobType() {
105                 return JobType.VfmoduleInstantiation;
106         }
107
108         @Nullable
109         public Boolean isRetainAssignments() {
110                 return retainAssignments;
111         }
112
113         @Nullable
114         public Boolean isRetainVolumeGroups() {
115                 return retainVolumeGroups;
116         }
117
118         public VfModule cloneWith(ModelInfo modelInfo) {
119                 return new VfModule(
120                                 modelInfo,
121                                 this.getInstanceName(),
122                                 this.getVolumeGroupInstanceName(),
123                                 this.getAction().toString(),
124                                 this.getLcpCloudRegionId(),
125                                 this.getLcpCloudRegionId(),
126                                 this.getTenantId(),
127                                 this.getInstanceParams(),
128                                 this.getSupplementaryParams(),
129                                 this.isRollbackOnFailure(),
130                                 this.isUsePreload(),
131                                 this.getInstanceId(),
132                                 this.getTrackById(),
133                                 this.getIsFailed(),
134                                 this.getStatusMessage(),
135                                 this.isRetainAssignments(),
136                                 this.isRetainVolumeGroups(),
137                                 this.getPosition());
138         }
139 }