diff options
Diffstat (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')
15 files changed, 179 insertions, 186 deletions
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 + <ComponentDependencyModelEntity, ComponentDependencyCreationDto> { + + @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<ComponentDependencyModelEntity, ComponentDependencyResponseDto> { + + @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<ComputeDeta public void doMapping(ComputeDetailsDto source, ComputeEntity target) { ComputeDescription computeDesc = new ComputeDescription(source.getName(), source .getDescription()); - target.setCompositionData(JsonUtil.object2Json(computeDesc)); + target.setCompositionData(computeDesc == null ? null : JsonUtil.object2Json(computeDesc)); } } 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/MapFilesDataStructureToDto.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/MapFilesDataStructureToDto.java new file mode 100644 index 0000000000..09e4d224a0 --- /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/MapFilesDataStructureToDto.java @@ -0,0 +1,17 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + +import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto; + +public class MapFilesDataStructureToDto + extends MappingBase<FilesDataStructure, FileDataStructureDto> { + + @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<FilesDataStructure, GetFileDataStructureResponseDTO> { - @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<Item, VspDetailsDto> { + @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<PackageInfo, Pac target.setVspName(source.getVspName()); target.setPackageId(source.getVspId()); target.setDescription(source.getVspDescription()); - target.setVersion(source.getVersion() == null ? null : source.getVersion().toString()); + target.setVersion(source.getVersion()); target.setPackageType(source.getPackageType()); target.setCategory(source.getCategory()); target.setSubCategory(source.getSubCategory()); 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/MapQuestionnaireToQuestionnaireDto.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/MapQuestionnaireToQuestionnaireDto.java new file mode 100644 index 0000000000..f47f7834fb --- /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/MapQuestionnaireToQuestionnaireDto.java @@ -0,0 +1,21 @@ +package org.openecomp.sdcrests.vsp.rest.mapping; + +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireDto; + +import java.util.HashMap; + +/** + * Created by ayalaben on 9/26/2017 + */ +public class MapQuestionnaireToQuestionnaireDto extends + MappingBase<CompositionEntity, QuestionnaireDto> { + + @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<ValidationResponse, ValidationResponseDto> { + extends MappingBase<ValidationResponse, ValidationResponseDto> { private static Map<String, List<ErrorMessageDto>> mapUploadDataErrors( - Map<String, List<ErrorMessage>> uploadDataErrors) { + Map<String, List<ErrorMessage>> 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<CompositionEntityValidationDataDto> 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<CompositionEntityValidationDataDto> 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<CompositionEntityValidationDataDto> 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<ErrorMessageDto> mapErrorMessages(List<ErrorMessage> 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<ErrorCodeDto> mapErrorCodes(Collection<ErrorCode> 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<VersionedVendorSoftwareProductInfo, VspDetailsDto> { - - @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<VspDescriptionDto, Item> { + @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<VspDescription target.setIcon(source.getIcon()); target.setVendorName(source.getVendorName()); target.setVendorId(source.getVendorId()); - target.setOnboardingMethod(source.getOnboardingMethod()); - target.setOnboardingOrigin(source.getOnboardingOrigin()); - target.setNetworkPackageName(source.getNetworkPackageName()); - VersionDto vlmVersion = source.getLicensingVersion(); - if (vlmVersion != null) { - Version version = Version.valueOf(vlmVersion.getId()); - target.setVlmVersion(version); -// target.setVlmVersion( -// Pattern.compile(Version.VERSION_REGEX).matcher(vlmVersion.getId()).find() ? Version -// .valueOf(vlmVersion.getId()) : null); + if (source.getLicensingVersion() != null) { + target.setVlmVersion(new Version(source.getLicensingVersion())); } LicensingData licensingData = source.getLicensingData(); 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/MapVspDetailsToDto.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/MapVspDetailsToDto.java new file mode 100644 index 0000000000..6e659cbb54 --- /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/MapVspDetailsToDto.java @@ -0,0 +1,53 @@ +/*- + * ============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.sdc.vendorsoftwareproduct.types.LicensingData; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; + +public class MapVspDetailsToDto extends MappingBase<VspDetails, VspDetailsDto> { + + @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<VspDetails, VspCreationDto> { - @Override - public void doMapping(VspDetails source, VspCreationDto target) { - target.setVspId(source.getId()); - } -} |