diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-11-24 17:52:56 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-11-24 18:11:06 +0200 |
commit | 74985d50a82de427c57aac05266ab28ce9bd52ab (patch) | |
tree | 2822d67aa6160fb5f2e1ead863a6f976c1d8ed78 /vid-app-common/src/main | |
parent | d84c152a0e5cba0bdaf7c16ca82b1c9f56bdb7c6 (diff) |
Migrating VfModuleOrVolumeGroupRequestDetails it to Kotlin; avoid the inner static classes
Issue-ID: VID-603
Change-Id: I8ae786d2e0e67300cd6118d41b48ba8483b922f0
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt | 3 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt (renamed from vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java) | 92 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java | 1 |
3 files changed, 33 insertions, 63 deletions
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<VfModuleMacro>()) } - fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<VfModuleOrVolumeGroupRequestDetails.UserParamMap<String, String>> { + fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<UserParamMap<String, String>> { var instanceParamsFinal: Map<String, String> = instanceParams ?: emptyMap() val supplementaryParamsFinal: Map<String, String> = 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.kt index 794714edf..f4318719d 100644 --- 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.kt @@ -17,16 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.vid.mso.model -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; +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL +import java.util.* /* Based on this model: @@ -98,55 +93,32 @@ import java.util.Map; */ -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<RelatedInstance> 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<? extends UserParamTypes> 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<? extends UserParamTypes> 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<? extends UserParamTypes> userParams, Boolean usePreload, String testApi, Boolean rebuildVolumeGroups) { - super(userParams, usePreload, testApi); - this.rebuildVolumeGroups = rebuildVolumeGroups; - } - - public Boolean getRebuildVolumeGroups() { - return rebuildVolumeGroups; - } - } - - public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V> { - public UserParamMap() { - super(); - } - } -} +data class VfModuleOrVolumeGroupRequestDetails( + val modelInfo: ModelInfo, + val cloudConfiguration: CloudConfiguration, + val requestInfo: RequestInfo, + val relatedInstanceList: List<RelatedInstance>?, + val requestParameters: RequestParametersVfModuleOrVolumeGroup?) + : BaseResourceInstantiationRequestDetails(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters) + +open class RequestParametersVfModuleOrVolumeGroup internal constructor( + userParams: List<UserParamTypes>, + @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?, + testApi: String? +) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi) + +class RequestParametersVfModuleOrVolumeGroupInstantiation( + userParams: List<UserParamTypes>, + usePreload: Boolean?, + testApi: String? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class RequestParametersVfModuleUpgrade( + userParams: List<UserParamTypes>, + usePreload: Boolean?, + testApi: String?, + @get:JsonInclude(NON_NULL) val rebuildVolumeGroups: Boolean? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class UserParamMap<K, V> : HashMap<K, V>(), UserParamTypes, MutableMap<K, V> 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 { |