From 74985d50a82de427c57aac05266ab28ce9bd52ab Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 24 Nov 2019 17:52:56 +0200 Subject: Migrating VfModuleOrVolumeGroupRequestDetails it to Kotlin; avoid the inner static classes Issue-ID: VID-603 Change-Id: I8ae786d2e0e67300cd6118d41b48ba8483b922f0 Signed-off-by: Ittay Stern --- .../org/onap/vid/job/command/MsoRequestBuilder.kt | 3 +- .../model/VfModuleOrVolumeGroupRequestDetails.java | 152 --------------------- .../model/VfModuleOrVolumeGroupRequestDetails.kt | 124 +++++++++++++++++ .../vid/mso/model/VolumeGroupRequestDetails.java | 1 - 4 files changed, 125 insertions(+), 155 deletions(-) delete mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt (limited to 'vid-app-common/src/main/java') diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt index e71315d67..ecf7fc933 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt @@ -11,7 +11,6 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper import org.onap.vid.model.serviceInstantiation.* import org.onap.vid.mso.model.* import org.onap.vid.mso.model.BaseResourceInstantiationRequestDetails.* -import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails.* import org.onap.vid.mso.rest.SubscriberInfo import org.onap.vid.properties.Features import org.onap.vid.services.AsyncInstantiationBusinessLogic @@ -295,7 +294,7 @@ class MsoRequestBuilder }.collect(Collectors.toList()) } - fun aggregateAllInstanceParams(instanceParams: Map?, supplementaryParams: Map?): List> { + fun aggregateAllInstanceParams(instanceParams: Map?, supplementaryParams: Map?): List> { var instanceParamsFinal: Map = instanceParams ?: emptyMap() val supplementaryParamsFinal: Map = supplementaryParams ?: emptyMap() diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java deleted file mode 100644 index 794714edf..000000000 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.vid.mso.model; - -import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/* Based on this model: - -{ - "requestDetails": { - "modelInfo": { - “modelType”: “vfModule”, - “modelInvariantId”: “ff5256d2-5a33-55df-13ab-12abad84e7ff”, - “modelVersionId”: “fe6478e5-ea33-3346-ac12-ab121484a3fe”, - “modelCustomizationId”: “856f9806-b01a-11e6-80f5-76304dec7eb7”, - “modelName”: “vSAMP12..base..module-0”, - "modelVersion": "1" - }, - “cloudConfiguration”: { - “lcpCloudRegionId”: “mdt1”, - “tenantId”: “88a6ca3ee0394ade9403f075db23167e” - }, - "requestInfo": { - “instanceName”: “MSOTEST103a-vSAMP12_base_module-0”, - “source”: “VID”, - “suppressRollback”: true, - “requestorId”: “az2016” - }, - "relatedInstanceList": [ - { - // This related instance captures the volumeGroup to attach - “relatedInstance”: { - “instanceId”: “17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c”, - “instanceName”: “MSOTESTVOL103a-vSAMP12_base_module-0_vol”, - “modelInfo”: { - “modelType”: “volumeGroup” - } - } - }, - { - “relatedInstance”: { - “instanceId”: “{serviceInstanceId}”, - “modelInfo”: { - “modelType”: “service”, - “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”, - “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”, - “modelName”: “{parent service model name}”, - "modelVersion": "1.0" - } - } - }, - { - “relatedInstance”: { - “instanceId”: “{vnfInstanceId}”, - "modelInfo": { - “modelType”: “vnf”, - “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”, - “modelVersionId”: “fe6478e4-ea33-3346-ac12-ab121484a3fe”, - “modelName”: “vSAMP12”, - "modelVersion": "1.0", - “modelCustomizationName”: “vSAMP12 1”, - “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7” - } - } - } - ], - “requestParameters”: { - “usePreload”: true, - “userParams”: [] - } - } -} - - - */ - -public class VfModuleOrVolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails { - - public VfModuleOrVolumeGroupRequestDetails( - @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, - @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, - @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, - @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, - @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModuleOrVolumeGroup requestParameters) - { - super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters); - } - - public static class RequestParametersVfModuleOrVolumeGroup extends BaseResourceInstantiationRequestDetails.RequestParameters { - @JsonInclude(NON_NULL) private final Boolean usePreload; - - private RequestParametersVfModuleOrVolumeGroup(List userParams, Boolean usePreload, String testApi) { - super(userParams, testApi); - this.usePreload = usePreload; - } - - public Boolean isUsePreload() { - return usePreload; - } - } - - public static class RequestParametersVfModuleOrVolumeGroupInstantiation extends RequestParametersVfModuleOrVolumeGroup { - public RequestParametersVfModuleOrVolumeGroupInstantiation( - List userParams, Boolean usePreload, String testApi) { - super(userParams, usePreload, testApi); - } - } - - public static class RequestParametersVfModuleUpgrade extends RequestParametersVfModuleOrVolumeGroup { - @JsonInclude(NON_NULL) private final Boolean rebuildVolumeGroups; - - public RequestParametersVfModuleUpgrade(List userParams, Boolean usePreload, String testApi, Boolean rebuildVolumeGroups) { - super(userParams, usePreload, testApi); - this.rebuildVolumeGroups = rebuildVolumeGroups; - } - - public Boolean getRebuildVolumeGroups() { - return rebuildVolumeGroups; - } - } - - public static class UserParamMap extends HashMap implements UserParamTypes, Map { - public UserParamMap() { - super(); - } - } -} - diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt new file mode 100644 index 000000000..f4318719d --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.vid.mso.model + +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL +import java.util.* + +/* Based on this model: + +{ + "requestDetails": { + "modelInfo": { + “modelType”: “vfModule”, + “modelInvariantId”: “ff5256d2-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6478e5-ea33-3346-ac12-ab121484a3fe”, + “modelCustomizationId”: “856f9806-b01a-11e6-80f5-76304dec7eb7”, + “modelName”: “vSAMP12..base..module-0”, + "modelVersion": "1" + }, + “cloudConfiguration”: { + “lcpCloudRegionId”: “mdt1”, + “tenantId”: “88a6ca3ee0394ade9403f075db23167e” + }, + "requestInfo": { + “instanceName”: “MSOTEST103a-vSAMP12_base_module-0”, + “source”: “VID”, + “suppressRollback”: true, + “requestorId”: “az2016” + }, + "relatedInstanceList": [ + { + // This related instance captures the volumeGroup to attach + “relatedInstance”: { + “instanceId”: “17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c”, + “instanceName”: “MSOTESTVOL103a-vSAMP12_base_module-0_vol”, + “modelInfo”: { + “modelType”: “volumeGroup” + } + } + }, + { + “relatedInstance”: { + “instanceId”: “{serviceInstanceId}”, + “modelInfo”: { + “modelType”: “service”, + “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”, + “modelName”: “{parent service model name}”, + "modelVersion": "1.0" + } + } + }, + { + “relatedInstance”: { + “instanceId”: “{vnfInstanceId}”, + "modelInfo": { + “modelType”: “vnf”, + “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6478e4-ea33-3346-ac12-ab121484a3fe”, + “modelName”: “vSAMP12”, + "modelVersion": "1.0", + “modelCustomizationName”: “vSAMP12 1”, + “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7” + } + } + } + ], + “requestParameters”: { + “usePreload”: true, + “userParams”: [] + } + } +} + + + */ + +data class VfModuleOrVolumeGroupRequestDetails( + val modelInfo: ModelInfo, + val cloudConfiguration: CloudConfiguration, + val requestInfo: RequestInfo, + val relatedInstanceList: List?, + val requestParameters: RequestParametersVfModuleOrVolumeGroup?) + : BaseResourceInstantiationRequestDetails(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters) + +open class RequestParametersVfModuleOrVolumeGroup internal constructor( + userParams: List, + @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?, + testApi: String? +) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi) + +class RequestParametersVfModuleOrVolumeGroupInstantiation( + userParams: List, + usePreload: Boolean?, + testApi: String? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class RequestParametersVfModuleUpgrade( + userParams: List, + usePreload: Boolean?, + testApi: String?, + @get:JsonInclude(NON_NULL) val rebuildVolumeGroups: Boolean? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class UserParamMap : HashMap(), UserParamTypes, MutableMap + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java index 6b7d6b9e3..a637f85dc 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java @@ -22,7 +22,6 @@ package org.onap.vid.mso.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails.RequestParametersVfModuleOrVolumeGroup; public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails { -- cgit 1.2.3-korg