From 8e9c0653dd6c6862123c9609ae34e1206d86456e Mon Sep 17 00:00:00 2001 From: talig Date: Wed, 20 Dec 2017 14:30:43 +0200 Subject: Add collaboration feature Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig --- .../MapComponentDependencyEntityToCreationDto.java | 16 +++++ .../mapping/MapComponentDependencyEntityToDto.java | 18 +++++ .../MapComputeDetailsDtoToComputeEntity.java | 2 +- .../rest/mapping/MapFilesDataStructureToDto.java | 17 +++++ ...StructureToGetFileDataStructureResponseDto.java | 40 ----------- .../vsp/rest/mapping/MapImageDataToImageDto.java | 1 - .../vsp/rest/mapping/MapItemToVspDetailsDto.java | 18 +++++ .../mapping/MapPackageInfoToPackageInfoDto.java | 2 +- .../MapQuestionnaireToQuestionnaireDto.java | 21 ++++++ .../rest/mapping/MapValidationResponseToDto.java | 33 +++++---- ...edVendorSoftwareProductInfoToVspDetailsDto.java | 83 ---------------------- .../rest/mapping/MapVspDescriptionDtoToItem.java | 16 +++++ .../mapping/MapVspDescriptionDtoToVspDetails.java | 13 +--- .../vsp/rest/mapping/MapVspDetailsToDto.java | 53 ++++++++++++++ .../mapping/MapVspDetailsToVspCreationDto.java | 32 --------- 15 files changed, 179 insertions(+), 186 deletions(-) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDto.java delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDto.java delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDto.java delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java new file mode 100644 index 0000000000..cb480b2aa0 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java @@ -0,0 +1,16 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyCreationDto; + +public class MapComponentDependencyEntityToCreationDto extends MappingBase + { + + @Override + public void doMapping(ComponentDependencyModelEntity source, + ComponentDependencyCreationDto target) { + target.setId(source.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java new file mode 100644 index 0000000000..0fe51178a7 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java @@ -0,0 +1,18 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto; + +public class MapComponentDependencyEntityToDto extends + MappingBase { + + @Override + public void doMapping(ComponentDependencyModelEntity source, + ComponentDependencyResponseDto target) { + target.setSourceId(source.getSourceComponentId()); + target.setTargetId(source.getTargetComponentId()); + target.setRelationType(source.getRelation()); + target.setId(source.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java index ee9882369f..7db9a0a9b1 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java @@ -12,6 +12,6 @@ public class MapComputeDetailsDtoToComputeEntity extends MappingBase { + + @Override + public void doMapping(FilesDataStructure source, FileDataStructureDto target) { + target.setModules(source.getModules()); + target.setArtifacts(source.getArtifacts()); + target.setNested(source.getNested()); + target.setUnassigned(source.getUnassigned()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java deleted file mode 100644 index b7d4670203..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 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.openecomp.sdcrests.vsp.rest.mapping; - - -import org.openecomp.sdc.vendorsoftwareproduct.types.GetFileDataStructureResponseDTO; -import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure; -import org.openecomp.sdcrests.mapping.MappingBase; - -/** - * Created by TALIO on 4/27/2016. - */ -public class MapFilesDataStructureToGetFileDataStructureResponseDto - extends MappingBase { - @Override - public void doMapping(FilesDataStructure source, GetFileDataStructureResponseDTO target) { - target.setModules(source.getModules()); - target.setArtifacts(source.getArtifacts()); - target.setUnassigned(source.getUnassigned()); - target.setNested(source.getNested()); - } -} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java index 684cd4c31d..f938c52e5b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java @@ -1,6 +1,5 @@ package org.openecomp.sdcrests.vsp.rest.mapping; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java new file mode 100644 index 0000000000..ad45e63330 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java @@ -0,0 +1,18 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; +import org.openecomp.sdcrests.vsp.rest.services.VspItemProperty; + +public class MapItemToVspDetailsDto extends MappingBase { + @Override + public void doMapping(Item source, VspDetailsDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setVendorId((String) source.getProperties().get(VspItemProperty.VENDOR_ID)); + target.setVendorName((String) source.getProperties().get(VspItemProperty.VENDOR_NAME)); + target.setOnboardingMethod((String) source.getProperties().get(VspItemProperty.ONBOARDING_METHOD)); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java index 34616b4306..eeee4e95d5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java @@ -33,7 +33,7 @@ public class MapPackageInfoToPackageInfoDto extends MappingBase { + + @Override + public void doMapping(CompositionEntity source, QuestionnaireDto target) { + target.setId(source.getId()); + target.setQuestionareData(JsonUtil.json2Object(source.getQuestionnaireData(), HashMap.class)); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java index 3cabebbb69..85b5567ed6 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java @@ -32,9 +32,7 @@ import org.openecomp.sdcrests.common.mapping.MapErrorMessageToDto; import org.openecomp.sdcrests.common.types.ErrorCodeDto; import org.openecomp.sdcrests.common.types.ErrorMessageDto; import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentValidationResultDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorValidationResultDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireValidationResultDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto; @@ -47,30 +45,31 @@ import java.util.Set; import java.util.stream.Collectors; public class MapValidationResponseToDto - extends MappingBase { + extends MappingBase { private static Map> mapUploadDataErrors( - Map> uploadDataErrors) { + Map> uploadDataErrors) { if (MapUtils.isEmpty(uploadDataErrors)) { return null; } return uploadDataErrors.entrySet().stream().collect( - Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue()))); + Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue()))); } private static QuestionnaireValidationResultDto mapQuestionnaireValidationResult( - QuestionnaireValidationResult questionnaireValidationResult) { + QuestionnaireValidationResult questionnaireValidationResult) { if (Objects.isNull(questionnaireValidationResult) - || Objects.isNull(questionnaireValidationResult.getValidationData())) { + || Objects.isNull(questionnaireValidationResult.getValidationData())) { return null; } QuestionnaireValidationResultDto questionnaireValidationResultDto = - new QuestionnaireValidationResultDto(); + new QuestionnaireValidationResultDto(); questionnaireValidationResultDto.setValid(questionnaireValidationResult.isValid()); Set validationDataDto = new HashSet<>(); - for(CompositionEntityValidationData validationData : questionnaireValidationResult.getValidationData()){ + for (CompositionEntityValidationData validationData : questionnaireValidationResult + .getValidationData()) { validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping - (validationData, CompositionEntityValidationDataDto.class)); + (validationData, CompositionEntityValidationDataDto.class)); } questionnaireValidationResultDto.setValidationData(validationDataDto); @@ -87,7 +86,7 @@ public class MapValidationResponseToDto componentValidationResultDto.setValid(componentValidationResult.isValid()); Set validationDataDto = new HashSet<>(); - for(CompositionEntityValidationData validationData : componentValidationResult.getValidationData()){ + for(CompositionEntityValidationData validationData : componentValidationResult.getInfo()){ validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping (validationData, CompositionEntityValidationDataDto.class)); } @@ -106,7 +105,7 @@ public class MapValidationResponseToDto deploymentFlavorValidationResultDto.setValid(deploymentFlavorValidationResult.isValid()); Set validationDataDto = new HashSet<>(); - for(CompositionEntityValidationData validationData : deploymentFlavorValidationResult.getValidationData()){ + for(CompositionEntityValidationData validationData : deploymentFlavorValidationResult.getInfo()){ validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping (validationData, CompositionEntityValidationDataDto.class)); } @@ -117,14 +116,14 @@ public class MapValidationResponseToDto private static List mapErrorMessages(List errorMessages) { return errorMessages == null ? null : errorMessages.stream().map( - errorMessage -> new MapErrorMessageToDto() - .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList()); + errorMessage -> new MapErrorMessageToDto() + .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList()); } private static Collection mapErrorCodes(Collection errorCodes) { return CollectionUtils.isEmpty(errorCodes) ? null : errorCodes.stream() - .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class)) - .collect(Collectors.toList()); + .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class)) + .collect(Collectors.toList()); } @Override @@ -134,6 +133,6 @@ public class MapValidationResponseToDto target.setLicensingDataErrors(mapErrorCodes(source.getLicensingDataErrors())); target.setUploadDataErrors(mapUploadDataErrors(source.getUploadDataErrors())); target.setQuestionnaireValidationResult( - mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult())); + mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult())); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java deleted file mode 100644 index 815135f834..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 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.openecomp.sdcrests.vsp.rest.mapping; - -import org.openecomp.core.utilities.CommonMethods; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData; -import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; -import org.openecomp.sdcrests.common.types.VersionDto; -import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; - -import java.util.stream.Collectors; - -public class MapVersionedVendorSoftwareProductInfoToVspDetailsDto - extends MappingBase { - - @Override - public void doMapping(VersionedVendorSoftwareProductInfo source, VspDetailsDto target) { - VspDetails vsp = source.getVspDetails(); - - target.setId(vsp.getId()); - target.setVersion(new VersionDto(vsp.getVersion().toString(), vsp.getVersion().toString())); - target.setName(vsp.getName()); - target.setDescription(vsp.getDescription()); - target.setCategory(vsp.getCategory()); - target.setSubCategory(vsp.getSubCategory()); - target.setVendorId(vsp.getVendorId()); - target.setVendorName(vsp.getVendorName()); - target.setOnboardingOrigin(vsp.getOnboardingOrigin()); - target.setLicensingVersion(vsp.getVlmVersion() == null ? null : new VersionDto(vsp.getVlmVersion().toString(), vsp.getVlmVersion().toString())); - target.setIsOldVersion("False"); - target.setNetworkPackageName(vsp.getNetworkPackageName()); - - if (vsp.getLicenseAgreement() != null || vsp.getFeatureGroups() != null) { - LicensingData licensingData = new LicensingData(); - licensingData.setLicenseAgreement(vsp.getLicenseAgreement()); - licensingData.setFeatureGroups(vsp.getFeatureGroups()); - target.setLicensingData(licensingData); - } - - target.setValidationData(vsp.getValidationDataStructure()); - - target.setStatus(source.getVersionInfo().getStatus()); - target.setLockingUser(source.getVersionInfo().getLockingUser()); - - if (!CommonMethods.isEmpty(source.getVersionInfo().getViewableVersions())) { - target.setViewableVersions( - source.getVersionInfo().getViewableVersions().stream() - .map(version -> new VersionDto(version.toString(), version.toString())) - .collect(Collectors.toList())); - } - - if (!CommonMethods.isEmpty(source.getVersionInfo().getFinalVersions())) { - target.setFinalVersions( - source.getVersionInfo().getFinalVersions().stream() - .map(version -> new VersionDto(version.toString(), version.toString())) - .collect(Collectors.toList())); - } - - //Onboarding Method valid value will always be present in VSP saved in DB - target.setOnboardingMethod(vsp.getOnboardingMethod()); - - } -} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java new file mode 100644 index 0000000000..3a7800f1c3 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java @@ -0,0 +1,16 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto; +import org.openecomp.sdcrests.vsp.rest.services.VspItemProperty; + +public class MapVspDescriptionDtoToItem extends MappingBase { + @Override + public void doMapping(VspDescriptionDto source, Item target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.addProperty(VspItemProperty.VENDOR_ID, source.getVendorId()); + target.addProperty(VspItemProperty.VENDOR_NAME, source.getVendorName()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java index ba3d92e5d2..634bd90d20 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java @@ -23,7 +23,6 @@ package org.openecomp.sdcrests.vsp.rest.mapping; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdcrests.common.types.VersionDto; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto; @@ -38,17 +37,9 @@ public class MapVspDescriptionDtoToVspDetails extends MappingBase { + + @Override + public void doMapping(VspDetails source, VspDetailsDto target) { + target.setId(source.getId()); + target.setVersion(source.getVersion() == null ? null : source.getVersion().getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setIcon(source.getIcon()); + target.setCategory(source.getCategory()); + target.setSubCategory(source.getSubCategory()); + target.setVendorId(source.getVendorId()); + target.setVendorName(source.getVendorName()); + target.setLicensingVersion( + source.getVlmVersion() == null ? null : source.getVlmVersion().getId()); + + if (source.getLicenseAgreement() != null || source.getFeatureGroups() != null) { + LicensingData licensingData = new LicensingData(); + licensingData.setLicenseAgreement(source.getLicenseAgreement()); + licensingData.setFeatureGroups(source.getFeatureGroups()); + target.setLicensingData(licensingData); + } + + target.setOnboardingMethod(source.getOnboardingMethod()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java deleted file mode 100644 index f009d8bbc6..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 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.openecomp.sdcrests.vsp.rest.mapping; - -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto; - -public class MapVspDetailsToVspCreationDto extends MappingBase { - @Override - public void doMapping(VspDetails source, VspCreationDto target) { - target.setVspId(source.getId()); - } -} -- cgit 1.2.3-korg